aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServer.java2
-rw-r--r--catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/HibernateSession.java4
-rw-r--r--catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/wrapper/ServiceTemplateWrapperTest.java1
3 files changed, 6 insertions, 1 deletions
diff --git a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServer.java b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServer.java
index 26835515..831b9a29 100644
--- a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServer.java
+++ b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/H2DbServer.java
@@ -47,9 +47,11 @@ public class H2DbServer {
*/
public static void shutDown() {
if (h2DbWebServer.isRunning(true)) {
+ h2DbWebServer.stop();
h2DbWebServer.shutdown();
}
if (h2DbTcpServer.isRunning(true)) {
+ h2DbTcpServer.stop();
h2DbTcpServer.shutdown();
}
}
diff --git a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/HibernateSession.java b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/HibernateSession.java
index 141aba66..93b02f64 100644
--- a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/HibernateSession.java
+++ b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/db/util/HibernateSession.java
@@ -59,7 +59,9 @@ public class HibernateSession {
* Destory a hibernate sessionFactory.
*/
public static void destory() {
- sessionFactory.close();
+ if (sessionFactory != null && !sessionFactory.isClosed()) {
+ sessionFactory.close();
+ }
}
/* Maybe you don't need it. */
diff --git a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/wrapper/ServiceTemplateWrapperTest.java b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/wrapper/ServiceTemplateWrapperTest.java
index 365dbaab..ac87302b 100644
--- a/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/wrapper/ServiceTemplateWrapperTest.java
+++ b/catalog-core/catalog-mgr/src/test/java/org/openo/commontosca/catalog/wrapper/ServiceTemplateWrapperTest.java
@@ -85,6 +85,7 @@ public class ServiceTemplateWrapperTest {
@BeforeClass
public static void setUpBeforeClass() {
H2DbServer.startUp();
+ DaoManager.getInstance().setDaoNull();
DaoManager.getInstance().setSessionFactory(HibernateSession.init());
serviceTemplateWrapper = ServiceTemplateWrapper.getInstance();
templateManager = TemplateManager.getInstance();