summaryrefslogtreecommitdiffstats
path: root/feature-state-management/src/test/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-02-26 00:46:09 -0500
committerJim Hahn <jrh3@att.com>2020-02-26 00:52:51 -0500
commita0a97b52416729cc9bc6da6d43c3bd03b29faa96 (patch)
treeb1b42b3655cda0c45e598f292289be0f2e665ed8 /feature-state-management/src/test/java
parent46523eee161e53f7aaf0e52978aa8834b6df82c5 (diff)
Reapply SQL output feature-state-mgt
Just need to keep the memory DB open until the test completes. Issue-ID: POLICY-2381 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I7833a66d86ea12e46460b37f695c8b4d938a9077
Diffstat (limited to 'feature-state-management/src/test/java')
-rw-r--r--feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java b/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java
index 86125069..f6c42b5f 100644
--- a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java
+++ b/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-persistence
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +54,9 @@ public class StateManagementTest {
// get an instance of logger
private static Logger logger = LoggerFactory.getLogger(StateManagementTest.class);
+ private static EntityManagerFactory emf;
+ private static EntityManager em;
+
StateManagementFeatureApi stateManagementFeature;
/**
@@ -80,7 +83,8 @@ public class StateManagementTest {
@AfterClass
public static void tearDownClass() throws Exception {
-
+ em.close();
+ emf.close();
}
@Before
@@ -239,13 +243,13 @@ public class StateManagementTest {
Properties cleanProperties = new Properties();
cleanProperties.put(StateManagementProperties.DB_DRIVER,"org.h2.Driver");
- cleanProperties.put(StateManagementProperties.DB_URL, "jdbc:h2:file:./sql/statemanagement");
+ cleanProperties.put(StateManagementProperties.DB_URL, "jdbc:h2:mem:statemanagement");
cleanProperties.put(StateManagementProperties.DB_USER, "sa");
cleanProperties.put(StateManagementProperties.DB_PWD, "");
- EntityManagerFactory emf = Persistence.createEntityManagerFactory("junitPU", cleanProperties);
+ emf = Persistence.createEntityManagerFactory("junitPU", cleanProperties);
- EntityManager em = emf.createEntityManager();
+ em = emf.createEntityManager();
// Start a transaction
EntityTransaction et = em.getTransaction();
@@ -258,7 +262,6 @@ public class StateManagementTest {
// commit transaction
et.commit();
- em.close();
logger.debug("initializeDb: Exiting");
}