From 3cb682fa71a1749fb99a47d7c8ede2b8984e2c07 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 16 Apr 2019 11:20:08 +0000 Subject: Fix Security and Unit Test DB issues This review removes more links to the Zookeeper version 3.5.4-beta with Zookeeper version 3.4.14. It also replaces the Derby in-memory database with the H2 in memory database for unit tests. Issue-ID: POLICY-1540 Change-Id: Ic44f2e866644114b7c0cf66aac7e528017b8206b Signed-off-by: liamfallon --- examples/examples-aadm/pom.xml | 6 ------ .../onap/policy/apex/examples/aadm/AadmDbWriteTest.java | 15 --------------- .../org/onap/policy/apex/examples/aadm/AadmModelTest.java | 15 --------------- .../src/test/resources/META-INF/persistence.xml | 6 ++---- 4 files changed, 2 insertions(+), 40 deletions(-) (limited to 'examples/examples-aadm') diff --git a/examples/examples-aadm/pom.xml b/examples/examples-aadm/pom.xml index d1a8223b5..f478119f8 100644 --- a/examples/examples-aadm/pom.xml +++ b/examples/examples-aadm/pom.xml @@ -53,12 +53,6 @@ ${project.version} test - - org.apache.derby - derby - ${version.derby} - test - diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java index 1cc379938..58987533a 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java @@ -20,11 +20,6 @@ package org.onap.policy.apex.examples.aadm; -import java.io.File; -import java.sql.Connection; -import java.sql.DriverManager; - -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; @@ -32,7 +27,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; public class AadmDbWriteTest { - private Connection connection; TestApexModel testApexModel; /** @@ -41,18 +35,9 @@ public class AadmDbWriteTest { */ @Before public void setup() throws Exception { - Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); - connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - testApexModel = new TestApexModel(AxPolicyModel.class, new TestAadmModelCreator()); } - @After - public void teardown() throws Exception { - connection.close(); - new File("derby.log").delete(); - } - @Test public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java index b0aa23949..a44a4cc1a 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java @@ -22,11 +22,6 @@ package org.onap.policy.apex.examples.aadm; import static org.junit.Assert.assertTrue; -import java.io.File; -import java.sql.Connection; -import java.sql.DriverManager; - -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; @@ -35,7 +30,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; public class AadmModelTest { - private Connection connection; TestApexModel testApexModel; /** @@ -44,18 +38,9 @@ public class AadmModelTest { */ @Before public void setup() throws Exception { - Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); - connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - testApexModel = new TestApexModel(AxPolicyModel.class, new TestAadmModelCreator()); } - @After - public void teardown() throws Exception { - connection.close(); - new File("derby.log").delete(); - } - @Test public void testModelValid() throws Exception { final AxValidationResult result = testApexModel.testApexModelValid(); diff --git a/examples/examples-aadm/src/test/resources/META-INF/persistence.xml b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml index eb28ad809..10a720dd7 100644 --- a/examples/examples-aadm/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml @@ -57,10 +57,8 @@ org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel - - - - + + -- cgit 1.2.3-korg