aboutsummaryrefslogtreecommitdiffstats
path: root/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-11-27 12:05:55 -0500
committerJim Hahn <jrh3@att.com>2018-11-27 12:15:57 -0500
commitebf62c0900b295f06034843a1ff5fa49066a3a06 (patch)
tree194b38ad581f88f018704d206c73a6f0bcf4cf83 /BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java
parent2debf0105268423d5401f7cb5af4df5f4bceb1b1 (diff)
Eliminate error messages about BACKUPMONITORENTITY
Change-Id: Ibf4ed1c684c7e29730e2ce4934e267d55b57e02d Issue-ID: POLICY-1290 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java')
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java
index 4a1b4f8d4..de1a7d6eb 100644
--- a/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/BrmsPushTest.java
@@ -28,16 +28,48 @@ import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
-
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.api.PolicyException;
import org.onap.policy.brms.api.BrmsHandler;
+import org.onap.policy.brms.api.BrmsPush;
public class BrmsPushTest {
private static final String VALID_FILE = "src/test/resources/config.properties";
private static final String INVALID_FILE = "src/test/resources/failure.properties";
+ private static EntityManagerFactory emf;
+
+ /**
+ * Creates the test DB and keeps it open until all tests complete.
+ *
+ * @throws Exception if an error occurs
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ Properties props = new Properties();
+ try (FileInputStream inp = new FileInputStream(VALID_FILE)) {
+ props.load(inp);
+ }
+ props.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML,
+ props.getProperty(BrmsPush.BRMSPERSISTENCE));
+
+ emf = Persistence.createEntityManagerFactory("BRMSGW", props);
+ }
+
+ /**
+ * Closes the test DB.
+ */
+ @AfterClass
+ public static void tearDownAfterClass() {
+ emf.close();
+ }
+
@Test(expected = PolicyException.class)
public void brmsHandlerFailTest() throws PolicyException {
new BrmsHandler(null);