diff options
author | 2016-09-29 15:16:23 +0800 | |
---|---|---|
committer | 2016-09-29 15:16:23 +0800 | |
commit | 8f0af18222fa4474b1e405c2cd2b473b411d671c (patch) | |
tree | 0ec72d1a22413ab936029ac2bf291dfaa00ec498 /catalog-core/catalog-mgr | |
parent | 50ddc3e017fcbccb636762d048f28373343c3e77 (diff) |
Modify the bug which "Catalog unit test failure on latest daily build"
Issue-id:TOSCA-83
Change-Id: Ife531fe8662cfd7c0735d7e1fd9075238aaa5994
Signed-off-by: nancylizi <li.zi30@zte.com.cn>
Diffstat (limited to 'catalog-core/catalog-mgr')
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(); |