Fix Security and Unit Test DB issues 48/85448/2
authorliamfallon <liam.fallon@est.tech>
Tue, 16 Apr 2019 11:20:08 +0000 (11:20 +0000)
committerliamfallon <liam.fallon@est.tech>
Tue, 16 Apr 2019 11:20:08 +0000 (11:20 +0000)
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 <liam.fallon@est.tech>
81 files changed:
examples/examples-aadm/pom.xml
examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java
examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
examples/examples-aadm/src/test/resources/META-INF/persistence.xml
examples/examples-adaptive/pom.xml
examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java
examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java
examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java
examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java
examples/examples-adaptive/src/test/resources/META-INF/persistence.xml
examples/examples-myfirstpolicy/pom.xml
examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelTest.java
examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml
examples/examples-pcvs/pom.xml
examples/examples-servlet/pom.xml
examples/pom.xml
model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java
model/basic-model/src/test/resources/META-INF/persistence.xml
model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java
model/context-model/src/test/resources/META-INF/persistence.xml
model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java
model/engine-model/src/test/resources/META-INF/persistence.xml
model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
model/event-model/src/test/resources/META-INF/persistence.xml
model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java
model/model-api/src/test/resources/META-INF/persistence.xml
model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
model/policy-model/src/test/resources/META-INF/persistence.xml
model/pom.xml
packages/apex-pdp-package-full/pom.xml
plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml
plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml
plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java
plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java [new file with mode: 0644]
plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java [new file with mode: 0644]
plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/package-info.java [new file with mode: 0644]
plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/resources/META-INF/persistence.xml
plugins/plugins-persistence/plugins-persistence-jpa/pom.xml
pom.xml
services/services-engine/pom.xml
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextBooleanItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextByteItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateItem.java with 98% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateLocaleItem.java with 99% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateTzItem.java with 98% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDoubleItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextFloatItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextIntItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongObjectItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextStringItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeMapItem.java with 97% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeSetItem.java with 98% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestExternalContextItem.java with 99% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestGlobalContextItem.java with 99% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestPolicyContextItem.java with 99% similarity]
testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java [moved from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/package-info.java with 93% similarity]
testsuites/integration/integration-context-test/pom.xml
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/HazelcastContextDistributorTest.java [moved from plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java with 94% similarity]
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/InfinispanContextDistributorTest.java [moved from plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/test/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributorTest.java with 93% similarity]
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/NoLockAlbumModifier.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/ReadLockAlbumModifier.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/SingleValueWriteLockAlbumModifier.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/WriteLockAlbumModifier.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContext.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProviderImpl.java
testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java
testsuites/integration/integration-executor-test/pom.xml
testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java
testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml
testsuites/integration/integration-uservice-test/pom.xml
testsuites/integration/pom.xml
testsuites/performance/performance-benchmark-test/pom.xml

index d1a8223..f478119 100644 (file)
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <version>${version.derby}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
index 1cc3799..5898753 100644 (file)
 
 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<AxPolicyModel> 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>(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();
index b0aa239..a44a4cc 100644 (file)
@@ -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<AxPolicyModel> 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>(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();
index eb28ad8..10a720d 100644 (file)
         <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index 1104ca9..cff7092 100644 (file)
             <artifactId>commons-math3</artifactId>
             <version>3.2</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <version>${version.derby}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
index 8857044..3004bcc 100644 (file)
 
 package org.onap.policy.apex.examples.adaptive;
 
-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 AnomalyDetectionDbWriteTest {
-    private Connection connection;
     TestApexModel<AxPolicyModel> testApexModel;
 
     /**
@@ -41,18 +35,9 @@ public class AnomalyDetectionDbWriteTest {
      */
     @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 TestAnomalyDetectionModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelWriteReadJpa() throws Exception {
         final DaoParameters DaoParameters = new DaoParameters();
index 552ca2f..5a36d40 100644 (file)
@@ -22,11 +22,6 @@ package org.onap.policy.apex.examples.adaptive;
 
 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 AnomalyDetectionModelTest {
-    private Connection connection;
     TestApexModel<AxPolicyModel> testApexModel;
 
     /**
@@ -44,18 +38,9 @@ public class AnomalyDetectionModelTest {
      */
     @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 TestAnomalyDetectionModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
index 828a561..b72514f 100644 (file)
 
 package org.onap.policy.apex.examples.adaptive;
 
-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 AutoLearnDbWriteTest {
-    private Connection connection;
     TestApexModel<AxPolicyModel> testApexModel;
 
     /**
@@ -41,18 +35,9 @@ public class AutoLearnDbWriteTest {
      */
     @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 TestAutoLearnModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelWriteReadJpa() throws Exception {
         final DaoParameters DaoParameters = new DaoParameters();
index f4cddc5..1823f98 100644 (file)
@@ -22,11 +22,6 @@ package org.onap.policy.apex.examples.adaptive;
 
 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 AutoLearnModelTest {
-    private Connection connection;
     TestApexModel<AxPolicyModel> testApexModel;
 
     /**
@@ -44,18 +38,9 @@ public class AutoLearnModelTest {
      */
     @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 TestAutoLearnModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
index 4dcd879..1e70abc 100644 (file)
         <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index 8ce34c0..e56a5b1 100644 (file)
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <version>${version.derby}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
index d6ec2bb..1bd67f9 100644 (file)
@@ -22,11 +22,6 @@ package org.onap.policy.apex.examples.myfirstpolicy;
 
 import static org.junit.Assert.assertTrue;
 
-import java.io.File;
-import java.sql.Connection;
-import java.sql.DriverManager;
-
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
@@ -39,8 +34,6 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
  * @author John Keeney (john.keeney@ericsson.com)
  */
 public class MfpModelTest {
-
-    private static Connection connection;
     private static TestApexModel<AxPolicyModel> testApexModel1;
     private static TestApexModel<AxPolicyModel> testApexModel2;
 
@@ -51,23 +44,10 @@ public class MfpModelTest {
      */
     @BeforeClass
     public static void setup() throws Exception {
-        Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
-        connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
         testApexModel1 = new TestApexModel<>(AxPolicyModel.class, new TestMfpModelCreator.TestMfp1ModelCreator());
         testApexModel2 = new TestApexModel<>(AxPolicyModel.class, new TestMfpModelCreator.TestMfp2ModelCreator());
     }
 
-    /**
-     * Teardown.
-     *
-     * @throws Exception if there is an error
-     */
-    @AfterClass
-    public static void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     /**
      * Test model is valid.
      *
index 7acc7a0..909f413 100644 (file)
         <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index 5cc65e6..7b5b92c 100644 (file)
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <version>${version.derby}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
index d1bd0a2..fcf7730 100644 (file)
             <artifactId>plugins-executor-javascript</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
             <artifactId>integration-common</artifactId>
index a8dca24..acba940 100644 (file)
@@ -32,7 +32,6 @@
     <name>${project.artifactId}</name>
     <description>Specific source code and other artifacts for Apex example applications.</description>
 
-
     <modules>
         <module>examples-myfirstpolicy</module>
         <module>examples-aadm</module>
         <module>examples-servlet</module>
     </modules>
 
+    <dependencies>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
     <profiles>
         <profile>
             <id>apexSite</id>
index 0258b93..36b18d7 100644 (file)
@@ -26,17 +26,12 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import java.io.File;
-import java.sql.Connection;
-import java.sql.DriverManager;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.UUID;
 
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
@@ -48,21 +43,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.DummyEntity;
  * JUnit test class.
  */
 public class EntityTest {
-    private Connection connection;
     private ApexDao apexDao;
 
-    @Before
-    public void setup() throws Exception {
-        Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
-        connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-    }
-
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testEntityTestSanity() throws ApexException {
         final DaoParameters daoParameters = new DaoParameters();
index a89be54..375d15a 100644 (file)
@@ -23,11 +23,6 @@ package org.onap.policy.apex.model.basicmodel.handling;
 import static org.junit.Assert.assertEquals;
 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.ApexException;
@@ -37,28 +32,18 @@ import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
 import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
 
 public class SupportApexBasicModelTester {
-    private Connection connection;
     TestApexModel<AxModel> testApexModel;
 
     /**
      * Set up the test.
-     * 
+     *
      * @throws Exception any exception thrown by the test
      */
     @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<AxModel>(AxModel.class, new DummyApexBasicModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
index 68f03e8..01a8989 100644 (file)
         <class>org.onap.policy.apex.model.basicmodel.concepts.DummyEntity</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database"/>
             <property name="eclipselink.logging.level"  value="INFO" />
index 948c202..f41c39f 100644 (file)
@@ -22,11 +22,6 @@ package org.onap.policy.apex.model.contextmodel.handling;
 
 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;
@@ -36,33 +31,23 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
 
 /**
  * Apex context model tests.
- * 
+ *
  * @author liam
  *
  */
 public class ApexContextModelTest {
-    private Connection connection;
     TestApexModel<AxContextModel> testApexModel;
 
     /**
      * Set up tests.
-     * 
+     *
      * @throws Exception a testing exception
      */
     @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<AxContextModel>(AxContextModel.class, new TestApexContextModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
index b7911ca..b4ba68a 100644 (file)
         <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index d0b8f3e..770c29a 100644 (file)
@@ -5,15 +5,15 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -22,11 +22,6 @@ package org.onap.policy.apex.model.enginemodel.handling;
 
 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,28 +30,18 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
 import org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel;
 
 public class ApexEngineModelTest {
-    private Connection connection;
     TestApexModel<AxEngineModel> testApexModel;
 
     /**
      * Set up the test.
-     * 
+     *
      * @throws Exception errors from test setup
      */
     @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<AxEngineModel>(AxEngineModel.class, new DummyTestApexEngineModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
index a157cf3..42048d8 100644 (file)
         <class>org.onap.policy.apex.model.enginemodel.concepts.AxEngineStats</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index 88736d1..db752a6 100644 (file)
@@ -22,11 +22,6 @@ package org.onap.policy.apex.model.eventmodel.handling;
 
 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,28 +30,18 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
 import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel;
 
 public class ApexEventModelTest {
-    private Connection connection;
     TestApexModel<AxEventModel> testApexModel;
 
     /**
      * Set up the test.
-     * 
+     *
      * @throws Exception exceptions from the test
      */
     @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<AxEventModel>(AxEventModel.class, new DummyTestApexEventModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
index 9e61cbd..0184cad 100644 (file)
         <class>org.onap.policy.apex.model.eventmodel.concepts.AxEventModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index 462b1cd..df5e54c 100644 (file)
@@ -5,15 +5,15 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -48,14 +48,14 @@ public class ApexModelApiTest {
 
     @Before
     public void setup() throws Exception {
-        Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
-        connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
+        // Hold the h2 database up for entire tests
+        connection = DriverManager.getConnection("jdbc:h2:mem:testdb");
     }
 
     @After
     public void teardown() throws Exception {
+        // Close the h2 database after tests
         connection.close();
-        new File("derby.log").delete();
     }
 
     @Test
index f834e0f..2603d54 100644 (file)
         <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
-            <property name="eclipselink.ddl-generation" value="create-tables" />
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
+            <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
         </properties>
index 7a240e1..a521272 100644 (file)
@@ -5,15 +5,15 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -23,11 +23,6 @@ package org.onap.policy.apex.model.policymodel.handling;
 import static org.junit.Assert.assertEquals;
 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;
@@ -36,28 +31,18 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
 import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
 
 public class ApexPolicyModelTest {
-    private Connection connection;
     TestApexModel<AxPolicyModel> testApexModel;
 
     /**
      * Set up the policy model tests.
-     * 
+     *
      * @throws Exception on setup errors
      */
     @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>(AxPolicyModel.class, new SupportApexPolicyModelCreator());
     }
 
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-        new File("derby.log").delete();
-    }
-
     @Test
     public void testModelValid() throws Exception {
         final AxValidationResult result = testApexModel.testApexModelValid();
index cd9a420..0eee729 100644 (file)
         <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index 187a043..2ff6aa1 100644 (file)
     <name>${project.artifactId}</name>
     <description>The model for Apex, it comtains definitions of all Apex concepts and also has handling for Apex models.</description>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <version>${version.derby}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
     <modules>
         <module>utilities</module>
         <module>basic-model</module>
         <module>model-api</module>
     </modules>
 
+    <dependencies>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
     <profiles>
         <profile>
             <id>apexSite</id>
index 078088b..4897cbe 100644 (file)
             <artifactId>plugins-persistence-jpa-eclipselink</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.plugins.plugins-persistence.plugins-persistence-jpa</groupId>
-            <artifactId>plugins-persistence-jpa-hibernate</artifactId>
-            <version>${project.version}</version>
-        </dependency>
 
         <!-- Plugins for event carrier technologies -->
         <dependency>
         </dependency>
         
         <!-- Test Data used by examples -->
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
             <artifactId>integration-common</artifactId>
index 28b8225..582ef1c 100644 (file)
             <artifactId>hazelcast</artifactId>
             <version>${version.hazelcast}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <profiles>
index 5cfdc2e..b01b955 100644 (file)
                 </exclusion>
             </exclusions>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <profiles>
index 0459cd7..6aa4229 100644 (file)
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.glassfish.jersey.inject</groupId>
             <artifactId>jersey-hk2</artifactId>
index 21b58f8..311af82 100644 (file)
@@ -5,15 +5,15 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -32,16 +32,16 @@ import java.util.List;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.onap.policy.apex.context.test.entities.ArtifactKeyTestEntity;
-import org.onap.policy.apex.context.test.entities.ReferenceKeyTestEntity;
 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
 import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
+import org.onap.policy.apex.plugins.persistence.jpa.eclipselink.entities.ArtifactKeyTestEntity;
+import org.onap.policy.apex.plugins.persistence.jpa.eclipselink.entities.ReferenceKeyTestEntity;
 
 /**
  * Junit tests for class EclipselinkApexDao.
- * 
+ *
  * @author Dinh Danh Le (dinh.danh.le@ericsson.com)
  *
  */
@@ -57,7 +57,7 @@ public class EclipselinkApexDaoTest {
 
     /**
      * Setup the tests.
-     * 
+     *
      * @throws ApexException Exceptions from test setup
      */
     @Before
@@ -192,7 +192,7 @@ public class EclipselinkApexDaoTest {
             new AxReferenceKey(owner0Key, "Entity02"),
             new AxReferenceKey(owner0Key, "Entity03")
         });
-        
+
         // prepare 2 more AxReferenceKeys corresponding to owner1Key
         final AxReferenceKey refKey11 = new AxReferenceKey(owner1Key, "Entity11");
         final AxReferenceKey refKey12 = new AxReferenceKey(owner1Key, "Entity12");
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ArtifactKeyTestEntity.java
new file mode 100644 (file)
index 0000000..cd0d7d1
--- /dev/null
@@ -0,0 +1,257 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.plugins.persistence.jpa.eclipselink.entities;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlElement;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+
+/**
+ * The Class ArtifactKeyTestEntity is an entity for testing artifact keys.
+ */
+@Entity
+@Table(name = "ArtifactKeyTestEntity")
+public class ArtifactKeyTestEntity extends AxConcept {
+    private static final long serialVersionUID = -2962570563281067896L;
+
+    @EmbeddedId()
+    @XmlElement(name = "key", required = true)
+    protected AxArtifactKey key;
+
+    private double doubleValue;
+
+    /**
+     * Instantiates a new artifact key test entity.
+     */
+    public ArtifactKeyTestEntity() {
+        this.key = new AxArtifactKey();
+        this.doubleValue = 0;
+    }
+
+    /**
+     * Instantiates a new artifact key test entity.
+     *
+     * @param doubleValue the double value
+     */
+    public ArtifactKeyTestEntity(final Double doubleValue) {
+        this.key = new AxArtifactKey();
+        this.doubleValue = doubleValue;
+    }
+
+    /**
+     * Instantiates a new artifact key test entity.
+     *
+     * @param key the key
+     * @param doubleValue the double value
+     */
+    public ArtifactKeyTestEntity(final AxArtifactKey key, final Double doubleValue) {
+        this.key = key;
+        this.doubleValue = doubleValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
+     */
+    @Override
+    public AxArtifactKey getKey() {
+        return key;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
+     */
+    @Override
+    public List<AxKey> getKeys() {
+        return Arrays.asList((AxKey) getKey());
+    }
+
+    /**
+     * Sets the key.
+     *
+     * @param key the new key
+     */
+    public void setKey(final AxArtifactKey key) {
+        this.key = key;
+    }
+
+    /**
+     * Check set key.
+     *
+     * @return true, if successful
+     */
+    public boolean checkSetKey() {
+        return (this.key != null);
+    }
+
+    /**
+     * Gets the double value.
+     *
+     * @return the double value
+     */
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    /**
+     * Sets the double value.
+     *
+     * @param doubleValue the new double value
+     */
+    public void setDoubleValue(final double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+     * AxValidationResult)
+     */
+    @Override
+    public AxValidationResult validate(final AxValidationResult result) {
+        return key.validate(result);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
+     */
+    @Override
+    public void clean() {
+        key.clean();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
+     */
+    @Override
+    public String toString() {
+        return "ArtifactKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]";
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+     * AxConcept)
+     */
+    @Override
+    public AxConcept copyTo(final AxConcept target) {
+        final Object copyObject = ((target == null) ? new ArtifactKeyTestEntity() : target);
+        if (copyObject instanceof ArtifactKeyTestEntity) {
+            final ArtifactKeyTestEntity copy = ((ArtifactKeyTestEntity) copyObject);
+            if (this.checkSetKey()) {
+                copy.setKey(new AxArtifactKey(key));
+            } else {
+                copy.key = null;
+            }
+            copy.doubleValue = doubleValue;
+            return copy;
+        } else {
+            return null;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((key == null) ? 0 : key.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (this == obj) {
+            return true;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) obj;
+        if (key == null) {
+            if (other.key != null) {
+                return false;
+            }
+        } else if (!key.equals(other.key)) {
+            return false;
+        }
+        return (Double.compare(doubleValue, other.doubleValue) == 0);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    @Override
+    public int compareTo(final AxConcept otherObj) {
+        if (otherObj == null) {
+            return -1;
+        }
+        if (this == otherObj) {
+            return 0;
+        }
+        if (getClass() != otherObj.getClass()) {
+            return -1;
+        }
+        final ArtifactKeyTestEntity other = (ArtifactKeyTestEntity) otherObj;
+        if (key == null) {
+            if (other.key != null) {
+                return 1;
+            }
+        } else if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+        return Double.compare(doubleValue, other.doubleValue);
+    }
+}
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/ReferenceKeyTestEntity.java
new file mode 100644 (file)
index 0000000..eb5db71
--- /dev/null
@@ -0,0 +1,260 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.plugins.persistence.jpa.eclipselink.entities;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
+
+/**
+ * The Class ReferenceKeyTestEntity provides a reference key test concept.
+ */
+@Entity
+@Table(name = "ReferenceKeyTestEntity")
+public class ReferenceKeyTestEntity extends AxConcept {
+    private static final long serialVersionUID = -2962570563281067895L;
+
+    @EmbeddedId()
+    @XmlElement(name = "key", required = true)
+    @XmlJavaTypeAdapter(AxReferenceKeyAdapter.class)
+    protected AxReferenceKey key;
+
+    private double doubleValue;
+
+    /**
+     * Instantiates a new reference key test entity.
+     */
+    public ReferenceKeyTestEntity() {
+        this.key = new AxReferenceKey();
+        this.doubleValue = 0;
+    }
+
+    /**
+     * Instantiates a new reference key test entity.
+     *
+     * @param doubleValue the double value
+     */
+    public ReferenceKeyTestEntity(final Double doubleValue) {
+        this.key = new AxReferenceKey();
+        this.doubleValue = doubleValue;
+    }
+
+    /**
+     * Instantiates a new reference key test entity.
+     *
+     * @param key the key
+     * @param doubleValue the double value
+     */
+    public ReferenceKeyTestEntity(final AxReferenceKey key, final Double doubleValue) {
+        this.key = key;
+        this.doubleValue = doubleValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKey()
+     */
+    @Override
+    public AxReferenceKey getKey() {
+        return key;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#getKeys()
+     */
+    @Override
+    public List<AxKey> getKeys() {
+        return Arrays.asList((AxKey) getKey());
+    }
+
+    /**
+     * Sets the key.
+     *
+     * @param key the new key
+     */
+    public void setKey(final AxReferenceKey key) {
+        this.key = key;
+    }
+
+    /**
+     * Check set key.
+     *
+     * @return true, if successful
+     */
+    public boolean checkSetKey() {
+        return (this.key != null);
+    }
+
+    /**
+     * Gets the double value.
+     *
+     * @return the double value
+     */
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    /**
+     * Sets the double value.
+     *
+     * @param doubleValue the new double value
+     */
+    public void setDoubleValue(final double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#validate(org.onap.policy.apex.model.basicmodel.concepts.
+     * AxValidationResult)
+     */
+    @Override
+    public AxValidationResult validate(final AxValidationResult result) {
+        return key.validate(result);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#clean()
+     */
+    @Override
+    public void clean() {
+        key.clean();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#toString()
+     */
+    @Override
+    public String toString() {
+        return "ReferenceKeyTestEntity [key=" + key + ", doubleValue=" + doubleValue + "]";
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.onap.policy.apex.model.basicmodel.concepts.AxConcept#copyTo(org.onap.policy.apex.model.basicmodel.concepts.
+     * AxConcept)
+     */
+    @Override
+    public AxConcept copyTo(final AxConcept target) {
+        final Object copyObject = ((target == null) ? new ReferenceKeyTestEntity() : target);
+        if (copyObject instanceof ReferenceKeyTestEntity) {
+            final ReferenceKeyTestEntity copy = ((ReferenceKeyTestEntity) copyObject);
+            if (this.checkSetKey()) {
+                copy.setKey(new AxReferenceKey(key));
+            } else {
+                copy.key = null;
+            }
+            copy.doubleValue = doubleValue;
+            return copy;
+        } else {
+            return null;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((key == null) ? 0 : key.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.onap.policy.apex.model.basicmodel.concepts.AxConcept#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (this == obj) {
+            return true;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) obj;
+        if (key == null) {
+            if (other.key != null) {
+                return false;
+            }
+        } else if (!key.equals(other.key)) {
+            return false;
+        }
+        return (Double.compare(doubleValue, other.doubleValue) == 0);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    @Override
+    public int compareTo(final AxConcept otherObj) {
+        if (otherObj == null) {
+            return -1;
+        }
+        if (this == otherObj) {
+            return 0;
+        }
+        if (getClass() != otherObj.getClass()) {
+            return -1;
+        }
+        final ReferenceKeyTestEntity other = (ReferenceKeyTestEntity) otherObj;
+        if (key == null) {
+            if (other.key != null) {
+                return 1;
+            }
+        } else if (!key.equals(other.key)) {
+            return key.compareTo(other.key);
+        }
+        return Double.compare(doubleValue, other.doubleValue);
+    }
+}
diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/package-info.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/entities/package-info.java
new file mode 100644 (file)
index 0000000..b30d405
--- /dev/null
@@ -0,0 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/**
+ * Contains common test entities.
+ */
+package org.onap.policy.apex.plugins.persistence.jpa.eclipselink.entities;
index 130079d..3f8be58 100644 (file)
@@ -24,8 +24,8 @@
     <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
         <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
 
-        <class>org.onap.policy.apex.context.test.entities.ReferenceKeyTestEntity</class>
-        <class>org.onap.policy.apex.context.test.entities.ArtifactKeyTestEntity</class>
+        <class>org.onap.policy.apex.plugins.persistence.jpa.eclipselink.entities.ReferenceKeyTestEntity</class>
+        <class>org.onap.policy.apex.plugins.persistence.jpa.eclipselink.entities.ArtifactKeyTestEntity</class>
 
         <properties>
             <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
index 8425af3..b43cc4d 100644 (file)
             <artifactId>basic-model</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
diff --git a/pom.xml b/pom.xml
index 95c1123..f464f2c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,6 @@
     <properties>
         <encoding>UTF-8</encoding>
         <file.encoding>UTF-8</file.encoding>
-        <version.derby>10.13.1.1</version.derby>
         <version.commons-cli>1.4</version.commons-cli>
         <version.kafka>1.1.1</version.kafka>
         <version.jersey>2.26</version.jersey>
index 2b68f27..24872d5 100644 (file)
             <artifactId>core-protocols</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>commons-cli</groupId>
             <artifactId>commons-cli</artifactId>
index f8a96fd..361d20a 100644 (file)
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
+            <artifactId>integration-common</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution</groupId>
             <artifactId>plugins-context-distribution-hazelcast</artifactId>
index aa806b5..0759b7e 100644 (file)
@@ -45,6 +45,7 @@ import org.onap.policy.apex.context.parameters.ContextParameterConstants;
 import org.onap.policy.apex.context.parameters.ContextParameters;
 import org.onap.policy.apex.context.parameters.DistributorParameters;
 import org.onap.policy.apex.context.parameters.SchemaParameters;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
 import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils;
 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
 import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
@@ -54,7 +55,6 @@ import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDi
 import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManager;
 import org.onap.policy.apex.plugins.context.locking.curator.CuratorLockManagerParameters;
 import org.onap.policy.apex.plugins.context.locking.hazelcast.HazelcastLockManager;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
 import org.onap.policy.apex.testsuites.integration.context.lock.modifier.LockType;
 import org.onap.policy.apex.testsuites.integration.context.locking.ConcurrentContext;
 import org.onap.policy.apex.testsuites.integration.context.utils.ConfigrationProvider;
index 186df67..502ccc1 100644 (file)
@@ -62,25 +62,25 @@ import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.context.ContextRuntimeException;
 import org.onap.policy.apex.context.Distributor;
 import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextBooleanItem;
+import org.onap.policy.apex.context.test.concepts.TestContextByteItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDateItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDateTzItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDoubleItem;
+import org.onap.policy.apex.context.test.concepts.TestContextFloatItem;
+import org.onap.policy.apex.context.test.concepts.TestContextIntItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongObjectItem;
+import org.onap.policy.apex.context.test.concepts.TestContextStringItem;
+import org.onap.policy.apex.context.test.concepts.TestContextTreeMapItem;
+import org.onap.policy.apex.context.test.concepts.TestContextTreeSetItem;
+import org.onap.policy.apex.context.test.concepts.TestExternalContextItem;
+import org.onap.policy.apex.context.test.concepts.TestGlobalContextItem;
+import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
 import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextBooleanItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextByteItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateTzItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDoubleItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextFloatItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextIntItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongObjectItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextStringItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeMapItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeSetItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestExternalContextItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestGlobalContextItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestPolicyContextItem;
 import org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory;
 import org.onap.policy.apex.testsuites.integration.context.utils.Constants;
 import org.slf4j.ext.XLogger;
index 0ed0369..24c63a1 100644 (file)
@@ -45,12 +45,12 @@ import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.context.ContextRuntimeException;
 import org.onap.policy.apex.context.Distributor;
 import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextDateItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
+import org.onap.policy.apex.context.test.concepts.TestContextTreeMapItem;
 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeMapItem;
 import org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
@@ -5,20 +5,20 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.apex.plugins.context.distribution.hazelcast;
+package org.onap.policy.apex.testsuites.integration.context.distribution;
 
 import java.io.IOException;
 
@@ -29,11 +29,9 @@ import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
 import org.onap.policy.apex.context.parameters.ContextParameterConstants;
 import org.onap.policy.apex.context.parameters.ContextParameters;
 import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.context.test.distribution.ContextAlbumUpdate;
-import org.onap.policy.apex.context.test.distribution.ContextInstantiation;
-import org.onap.policy.apex.context.test.distribution.ContextUpdate;
 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
 import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.onap.policy.apex.plugins.context.distribution.hazelcast.HazelcastContextDistributor;
 import org.onap.policy.common.parameters.ParameterService;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
@@ -67,7 +65,7 @@ public class HazelcastContextDistributorTest {
         ParameterService.register(contextParameters.getDistributorParameters());
         ParameterService.register(contextParameters.getLockManagerParameters());
         ParameterService.register(contextParameters.getPersistorParameters());
-        
+
         schemaParameters = new SchemaParameters();
         schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
         schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
@@ -87,7 +85,7 @@ public class HazelcastContextDistributorTest {
         ParameterService.deregister(contextParameters.getPersistorParameters());
         ParameterService.deregister(contextParameters);
     }
-    
+
     /**
      * Test context album update hazelcast.
      *
@@ -5,20 +5,20 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.apex.plugins.context.distribution.infinispan;
+package org.onap.policy.apex.testsuites.integration.context.distribution;
 
 import java.io.IOException;
 
@@ -29,12 +29,10 @@ import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
 import org.onap.policy.apex.context.parameters.ContextParameterConstants;
 import org.onap.policy.apex.context.parameters.ContextParameters;
 import org.onap.policy.apex.context.parameters.SchemaParameters;
-import org.onap.policy.apex.context.test.distribution.ContextAlbumUpdate;
-import org.onap.policy.apex.context.test.distribution.ContextInstantiation;
-import org.onap.policy.apex.context.test.distribution.ContextUpdate;
-import org.onap.policy.apex.context.test.distribution.SequentialContextInstantiation;
 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
 import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
+import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanContextDistributor;
+import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDistributorParameters;
 import org.onap.policy.common.parameters.ParameterService;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
@@ -69,7 +67,7 @@ public class InfinispanContextDistributorTest {
         ParameterService.register(contextParameters.getDistributorParameters());
         ParameterService.register(contextParameters.getLockManagerParameters());
         ParameterService.register(contextParameters.getPersistorParameters());
-        
+
         schemaParameters = new SchemaParameters();
         schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
         schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
index 4c93395..12f7f37 100644 (file)
@@ -52,18 +52,18 @@ import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.context.Distributor;
 import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextBooleanItem;
+import org.onap.policy.apex.context.test.concepts.TestContextByteItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDateItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDateTzItem;
+import org.onap.policy.apex.context.test.concepts.TestContextDoubleItem;
+import org.onap.policy.apex.context.test.concepts.TestContextFloatItem;
+import org.onap.policy.apex.context.test.concepts.TestContextIntItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongObjectItem;
+import org.onap.policy.apex.context.test.concepts.TestContextStringItem;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextBooleanItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextByteItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateTzItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDoubleItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextFloatItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextIntItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongObjectItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextStringItem;
 import org.onap.policy.apex.testsuites.integration.context.utils.Constants;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
index 2efa801..f8c1f59 100644 (file)
@@ -29,6 +29,12 @@ import static org.onap.policy.apex.testsuites.integration.context.utils.Constant
 import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.POLICY_CONTEXT_ALBUM;
 import static org.onap.policy.apex.testsuites.integration.context.utils.Constants.VERSION;
 
+import org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
+import org.onap.policy.apex.context.test.concepts.TestContextTreeMapItem;
+import org.onap.policy.apex.context.test.concepts.TestExternalContextItem;
+import org.onap.policy.apex.context.test.concepts.TestGlobalContextItem;
+import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
 import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
@@ -36,12 +42,6 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
 import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
 import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
 import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextDateLocaleItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextTreeMapItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestExternalContextItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestGlobalContextItem;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestPolicyContextItem;
 
 /**
  * The Class TestContextAlbumFactory creates test context albums.
index 26f54e0..e541aad 100644 (file)
@@ -24,7 +24,7 @@ package org.onap.policy.apex.testsuites.integration.context.lock.modifier;
 import java.util.Random;
 
 import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
index f5d22ed..e9c435a 100644 (file)
@@ -25,7 +25,7 @@ import java.util.Random;
 
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
index b54fe16..ad38b03 100644 (file)
@@ -25,7 +25,7 @@ import static org.onap.policy.apex.testsuites.integration.context.utils.Constant
 
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
index 87214fb..552365e 100644 (file)
@@ -25,7 +25,7 @@ import java.util.Random;
 
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextException;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
 
index 4326d5a..2bcb38f 100644 (file)
@@ -34,8 +34,8 @@ import java.util.concurrent.TimeUnit;
 import org.onap.policy.apex.context.ContextAlbum;
 import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.context.Distributor;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
 import org.onap.policy.apex.testsuites.integration.context.utils.ConfigrationProvider;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
index fa5b564..0a9a195 100644 (file)
@@ -31,9 +31,9 @@ import org.onap.policy.apex.context.ContextException;
 import org.onap.policy.apex.context.ContextRuntimeException;
 import org.onap.policy.apex.context.Distributor;
 import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
+import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
 import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestContextLongItem;
 import org.onap.policy.apex.testsuites.integration.context.factory.TestContextAlbumFactory;
 import org.onap.policy.apex.testsuites.integration.context.lock.modifier.AlbumModifier;
 import org.onap.policy.apex.testsuites.integration.context.lock.modifier.LockType;
index ea80d4e..6fdcf61 100644 (file)
@@ -23,8 +23,8 @@ package org.onap.policy.apex.testsuites.integration.context.utils;
 
 import java.util.TimeZone;
 
+import org.onap.policy.apex.context.test.concepts.TestPolicyContextItem;
 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.testsuites.integration.context.concepts.TestPolicyContextItem;
 
 /**
  * The Class Constants provides constants for context tests.
index 1a106ee..f50b844 100644 (file)
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
             <artifactId>integration-common</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <version>${version.derby}</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <profiles>
index e863a99..426db83 100644 (file)
@@ -5,15 +5,15 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -23,7 +23,6 @@ package org.onap.policy.apex.testsuites.integration.executor.handling;
 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;
@@ -35,7 +34,6 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
  * The Class TestApexSamplePolicyDbWrite.
  */
 public class TestApexSamplePolicyDbWrite {
-    private Connection connection;
     TestApexModel<AxPolicyModel> testApexModel;
 
     /**
@@ -45,22 +43,10 @@ public class TestApexSamplePolicyDbWrite {
      */
     @Before
     public void setup() throws Exception {
-        connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-
         final TestApexSamplePolicyModelCreator apexPolicyModelCreator = new TestApexSamplePolicyModelCreator("MVEL");
         testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator);
     }
 
-    /**
-     * Teardown.
-     *
-     * @throws Exception the exception
-     */
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-    }
-
     /**
      * Test model write read jpa.
      *
@@ -72,6 +58,8 @@ public class TestApexSamplePolicyDbWrite {
         DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName());
         DaoParameters.setPersistenceUnit("SampleModelTest");
 
+        Connection connection = DriverManager.getConnection("jdbc:h2:mem:testdb");
         testApexModel.testApexModelWriteReadJpa(DaoParameters);
+        connection.close();
     }
 }
index 1e7daad..a580095 100644 (file)
@@ -5,15 +5,15 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue;
 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;
@@ -39,7 +38,6 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
  */
 public class TestApexSamplePolicyModel {
     private static final String VALID_MODEL_STRING = "***validation of model successful***";
-    private Connection connection;
     private TestApexModel<AxPolicyModel> testApexModel;
 
     /**
@@ -49,22 +47,10 @@ public class TestApexSamplePolicyModel {
      */
     @Before
     public void setup() throws Exception {
-        connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-
         testApexModel =
                 new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestApexSamplePolicyModelCreator("MVEL"));
     }
 
-    /**
-     * Teardown.
-     *
-     * @throws Exception the exception
-     */
-    @After
-    public void teardown() throws Exception {
-        connection.close();
-    }
-
     /**
      * Test model valid.
      *
@@ -107,8 +93,10 @@ public class TestApexSamplePolicyModel {
         DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName());
         DaoParameters.setPersistenceUnit("SampleModelTest");
 
+        Connection connection = DriverManager.getConnection("jdbc:h2:mem:testdb");
         testApexModel.testApexModelWriteReadJpa(DaoParameters);
+        connection.close();
     }
 
-    
+
 }
index 40773a4..b2d6a96 100644 (file)
         <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
 
         <properties>
-            <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
-            <property name="javax.persistence.target-database" value="Derby" />
-            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
-
+            <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
+            <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
             <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
             <property name="eclipselink.ddl-generation.output-mode" value="database" />
             <property name="eclipselink.logging.level" value="INFO" />
index 8772db0..1d48bf4 100644 (file)
             <artifactId>core-deployment</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId>
             <artifactId>plugins-context-schema-avro</artifactId>
index c5b89a7..17798d6 100644 (file)
         <module>integration-uservice-test</module>
     </modules>
 
+    <dependencies>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
     <profiles>
         <profile>
             <id>apexAll</id>
index 6f6a978..747c3dd 100644 (file)
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-test-utils</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-all</artifactId>