diff options
author | liamfallon <liam.fallon@est.tech> | 2019-04-16 11:20:08 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-04-16 11:20:08 +0000 |
commit | 3cb682fa71a1749fb99a47d7c8ede2b8984e2c07 (patch) | |
tree | 08aa6b83f985cfefcb0618d146b2e77428110055 | |
parent | 2ba499f11094cfd1321e59789869a0c475406b58 (diff) |
Fix Security and Unit Test DB issues
This review removes more links to the Zookeeper version 3.5.4-beta with
Zookeeper version 3.4.14.
It also replaces the Derby in-memory database with the H2 in memory
database for unit tests.
Issue-ID: POLICY-1540
Change-Id: Ic44f2e866644114b7c0cf66aac7e528017b8206b
Signed-off-by: liamfallon <liam.fallon@est.tech>
81 files changed, 706 insertions, 489 deletions
diff --git a/examples/examples-aadm/pom.xml b/examples/examples-aadm/pom.xml index d1a8223b5..f478119f8 100644 --- a/examples/examples-aadm/pom.xml +++ b/examples/examples-aadm/pom.xml @@ -53,12 +53,6 @@ <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> diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java index 1cc379938..58987533a 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmDbWriteTest.java @@ -20,11 +20,6 @@ package org.onap.policy.apex.examples.aadm; -import java.io.File; -import java.sql.Connection; -import java.sql.DriverManager; - -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; @@ -32,7 +27,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; public class AadmDbWriteTest { - private Connection connection; TestApexModel<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(); diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java index b0aa23949..a44a4cc1a 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java @@ -22,11 +22,6 @@ package org.onap.policy.apex.examples.aadm; import static org.junit.Assert.assertTrue; -import java.io.File; -import java.sql.Connection; -import java.sql.DriverManager; - -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; @@ -35,7 +30,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; public class AadmModelTest { - private Connection connection; TestApexModel<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(); diff --git a/examples/examples-aadm/src/test/resources/META-INF/persistence.xml b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml index eb28ad809..10a720dd7 100644 --- a/examples/examples-aadm/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-aadm/src/test/resources/META-INF/persistence.xml @@ -57,10 +57,8 @@ <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" /> diff --git a/examples/examples-adaptive/pom.xml b/examples/examples-adaptive/pom.xml index 1104ca932..cff709239 100644 --- a/examples/examples-adaptive/pom.xml +++ b/examples/examples-adaptive/pom.xml @@ -63,12 +63,6 @@ <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> diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java index 885704497..3004bccb3 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java @@ -20,11 +20,6 @@ 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(); diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java index 552ca2f37..5a36d4070 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java @@ -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(); diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java index 828a56133..b72514f49 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java @@ -20,11 +20,6 @@ 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(); diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java index f4cddc580..1823f9871 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java @@ -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(); diff --git a/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml b/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml index 4dcd879b6..1e70abc6d 100644 --- a/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml @@ -57,10 +57,8 @@ <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" /> diff --git a/examples/examples-myfirstpolicy/pom.xml b/examples/examples-myfirstpolicy/pom.xml index 8ce34c027..e56a5b12b 100644 --- a/examples/examples-myfirstpolicy/pom.xml +++ b/examples/examples-myfirstpolicy/pom.xml @@ -69,12 +69,6 @@ <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> diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelTest.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelTest.java index d6ec2bb8d..1bd67f961 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelTest.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpModelTest.java @@ -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,24 +44,11 @@ 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. * * @throws Exception if there is an error diff --git a/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml b/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml index 7acc7a0e9..909f413eb 100644 --- a/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml +++ b/examples/examples-myfirstpolicy/src/test/resources/META-INF/persistence.xml @@ -57,10 +57,8 @@ <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" /> diff --git a/examples/examples-pcvs/pom.xml b/examples/examples-pcvs/pom.xml index 5cc65e6a1..7b5b92c77 100644 --- a/examples/examples-pcvs/pom.xml +++ b/examples/examples-pcvs/pom.xml @@ -71,12 +71,6 @@ <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> diff --git a/examples/examples-servlet/pom.xml b/examples/examples-servlet/pom.xml index d1bd0a28c..fcf773022 100644 --- a/examples/examples-servlet/pom.xml +++ b/examples/examples-servlet/pom.xml @@ -56,11 +56,6 @@ <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> <version>${project.version}</version> diff --git a/examples/pom.xml b/examples/pom.xml index a8dca24b2..acba94098 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -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> @@ -44,6 +43,14 @@ <module>examples-servlet</module> </modules> + <dependencies> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <profiles> <profile> <id>apexSite</id> diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java index 0258b9305..36b18d783 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java @@ -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(); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java index a89be5477..375d15ae8 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTester.java @@ -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(); diff --git a/model/basic-model/src/test/resources/META-INF/persistence.xml b/model/basic-model/src/test/resources/META-INF/persistence.xml index 68f03e8e5..01a8989bb 100644 --- a/model/basic-model/src/test/resources/META-INF/persistence.xml +++ b/model/basic-model/src/test/resources/META-INF/persistence.xml @@ -33,10 +33,8 @@ <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" /> diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java index 948c2024c..f41c39fd2 100644 --- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java +++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/ApexContextModelTest.java @@ -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(); diff --git a/model/context-model/src/test/resources/META-INF/persistence.xml b/model/context-model/src/test/resources/META-INF/persistence.xml index b7911caa2..b4ba68a38 100644 --- a/model/context-model/src/test/resources/META-INF/persistence.xml +++ b/model/context-model/src/test/resources/META-INF/persistence.xml @@ -38,10 +38,8 @@ <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" /> diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java index d0b8f3e78..770c29a93 100644 --- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java +++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java @@ -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(); diff --git a/model/engine-model/src/test/resources/META-INF/persistence.xml b/model/engine-model/src/test/resources/META-INF/persistence.xml index a157cf34f..42048d85d 100644 --- a/model/engine-model/src/test/resources/META-INF/persistence.xml +++ b/model/engine-model/src/test/resources/META-INF/persistence.xml @@ -59,10 +59,8 @@ <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" /> diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java index 88736d1f0..db752a61b 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java @@ -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(); diff --git a/model/event-model/src/test/resources/META-INF/persistence.xml b/model/event-model/src/test/resources/META-INF/persistence.xml index 9e61cbd73..0184cada6 100644 --- a/model/event-model/src/test/resources/META-INF/persistence.xml +++ b/model/event-model/src/test/resources/META-INF/persistence.xml @@ -44,10 +44,8 @@ <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" /> diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java index 462b1cd8b..df5e54ca9 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java @@ -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 diff --git a/model/model-api/src/test/resources/META-INF/persistence.xml b/model/model-api/src/test/resources/META-INF/persistence.xml index f834e0f49..2603d5496 100644 --- a/model/model-api/src/test/resources/META-INF/persistence.xml +++ b/model/model-api/src/test/resources/META-INF/persistence.xml @@ -57,11 +57,9 @@ <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> diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java index 7a240e18b..a521272ae 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java @@ -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(); diff --git a/model/policy-model/src/test/resources/META-INF/persistence.xml b/model/policy-model/src/test/resources/META-INF/persistence.xml index cd9a420d0..0eee729a1 100644 --- a/model/policy-model/src/test/resources/META-INF/persistence.xml +++ b/model/policy-model/src/test/resources/META-INF/persistence.xml @@ -57,10 +57,8 @@ <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" /> diff --git a/model/pom.xml b/model/pom.xml index 187a043da..2ff6aa110 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -32,15 +32,6 @@ <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> @@ -51,6 +42,14 @@ <module>model-api</module> </modules> + <dependencies> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <profiles> <profile> <id>apexSite</id> diff --git a/packages/apex-pdp-package-full/pom.xml b/packages/apex-pdp-package-full/pom.xml index 078088bad..4897cbe8d 100644 --- a/packages/apex-pdp-package-full/pom.xml +++ b/packages/apex-pdp-package-full/pom.xml @@ -135,11 +135,6 @@ <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> @@ -213,11 +208,6 @@ <!-- 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> <version>${project.version}</version> diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml index 28b822553..582ef1c71 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/pom.xml @@ -35,12 +35,6 @@ <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> diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml index 5cfdc2e18..b01b955c4 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/pom.xml @@ -41,12 +41,6 @@ </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> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml index 0459cd75c..6aa42291f 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml @@ -53,12 +53,6 @@ <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> <scope>test</scope> diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java index 21b58f878..311af8257 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/java/org/onap/policy/apex/plugins/persistence/jpa/eclipselink/EclipselinkApexDaoTest.java @@ -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 index 000000000..cd0d7d16d --- /dev/null +++ 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 @@ -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 index 000000000..eb5db7145 --- /dev/null +++ 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 @@ -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 index 000000000..b30d40559 --- /dev/null +++ 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 @@ -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; diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/resources/META-INF/persistence.xml b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/resources/META-INF/persistence.xml index 130079dd9..3f8be58e4 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/resources/META-INF/persistence.xml +++ b/plugins/plugins-persistence/plugins-persistence-jpa/plugins-persistence-jpa-eclipselink/src/test/resources/META-INF/persistence.xml @@ -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" /> diff --git a/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml b/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml index 8425af3ee..b43cc4d71 100644 --- a/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml +++ b/plugins/plugins-persistence/plugins-persistence-jpa/pom.xml @@ -39,11 +39,6 @@ <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> <scope>test</scope> @@ -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> diff --git a/services/services-engine/pom.xml b/services/services-engine/pom.xml index 2b68f2731..24872d536 100644 --- a/services/services-engine/pom.xml +++ b/services/services-engine/pom.xml @@ -55,12 +55,6 @@ <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> </dependency> diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextBooleanItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java index 24193848b..84d896c8a 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextBooleanItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextByteItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java index a6d4b1a1e..87d9bc678 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextByteItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java index 9cd3c6e81..c6cc4a781 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; import java.util.Calendar; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateLocaleItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java index 28c3e9ee3..84024578d 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateLocaleItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; import java.util.Locale; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateTzItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java index b081cd55f..90f108ce2 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDateTzItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; import java.util.TimeZone; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDoubleItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java index 19f756051..99bde4a5c 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextDoubleItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextFloatItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java index 0883c1d8f..b7545653e 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextFloatItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextIntItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java index 5932769b3..e2b68f78b 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextIntItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java index 8ab1c2bd0..6c9571f4d 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongObjectItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java index 56b027279..73d47c414 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextLongObjectItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextStringItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java index bbf3167ad..b1b27e7d3 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextStringItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeMapItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java index 0d5741a8e..9111109fe 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeMapItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; import java.util.Map; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeSetItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java index 80cd3b179..7172fa478 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestContextTreeSetItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; import java.util.Arrays; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestExternalContextItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java index fbf5e6c80..77f86d226 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestExternalContextItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestGlobalContextItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java index c139d7469..5cd6a437d 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestGlobalContextItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestPolicyContextItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java index 39a0408a8..f52d60228 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/TestPolicyContextItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/package-info.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java index e897dda2a..547d23878 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/concepts/package-info.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/package-info.java @@ -25,4 +25,4 @@ * @author Liam Fallon (liam.fallon@ericsson.com) */ -package org.onap.policy.apex.testsuites.integration.context.concepts; +package org.onap.policy.apex.context.test.concepts; diff --git a/testsuites/integration/integration-context-test/pom.xml b/testsuites/integration/integration-context-test/pom.xml index f8a96fd12..361d20a98 100644 --- a/testsuites/integration/integration-context-test/pom.xml +++ b/testsuites/integration/integration-context-test/pom.xml @@ -45,6 +45,12 @@ <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> <version>${project.version}</version> diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java index aa806b5e8..0759b7eeb 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java index 186df673b..502ccc17c 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java index 0ed036992..24c63a12b 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextUpdate.java @@ -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; diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/HazelcastContextDistributorTest.java index 9d7f003ee..9e6002565 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/HazelcastContextDistributorTest.java @@ -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. * diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/test/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributorTest.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/InfinispanContextDistributorTest.java index 3da1cf509..b8cc597ef 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/test/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributorTest.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/InfinispanContextDistributorTest.java @@ -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()); diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java index 4c9339514..12f7f373f 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java index 2efa80154..f8c1f597c 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java @@ -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. diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/NoLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/NoLockAlbumModifier.java index 26f54e08c..e541aada7 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/NoLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/NoLockAlbumModifier.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/ReadLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/ReadLockAlbumModifier.java index f5d22ed87..e9c435af5 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/ReadLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/ReadLockAlbumModifier.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/SingleValueWriteLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/SingleValueWriteLockAlbumModifier.java index b54fe166f..ad38b03b5 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/SingleValueWriteLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/SingleValueWriteLockAlbumModifier.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/WriteLockAlbumModifier.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/WriteLockAlbumModifier.java index 87214fb47..552365e92 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/WriteLockAlbumModifier.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/lock/modifier/WriteLockAlbumModifier.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContext.java index 4326d5adb..2bcb38fec 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContext.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContext.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProviderImpl.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProviderImpl.java index fa5b564b8..0a9a195e9 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProviderImpl.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/ConfigrationProviderImpl.java @@ -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; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java index ea80d4e7d..6fdcf6121 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/utils/Constants.java @@ -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. diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml index 1a106eeeb..f50b84460 100644 --- a/testsuites/integration/integration-executor-test/pom.xml +++ b/testsuites/integration/integration-executor-test/pom.xml @@ -38,12 +38,6 @@ <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> @@ -78,12 +72,6 @@ <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> diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java index e863a990a..426db8328 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java @@ -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,23 +43,11 @@ 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. * * @throws Exception the exception @@ -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(); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java index 1e7daad03..a5800956d 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java @@ -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,23 +47,11 @@ 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. * * @throws Exception the exception @@ -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(); } - + } diff --git a/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml b/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml index 40773a4d4..b2d6a96ed 100644 --- a/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml +++ b/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml @@ -57,10 +57,8 @@ <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" /> diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml index 8772db0dd..1d48bf449 100644 --- a/testsuites/integration/integration-uservice-test/pom.xml +++ b/testsuites/integration/integration-uservice-test/pom.xml @@ -50,12 +50,6 @@ <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> <version>${project.version}</version> diff --git a/testsuites/integration/pom.xml b/testsuites/integration/pom.xml index c5b89a71c..17798d6ee 100644 --- a/testsuites/integration/pom.xml +++ b/testsuites/integration/pom.xml @@ -37,6 +37,14 @@ <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> diff --git a/testsuites/performance/performance-benchmark-test/pom.xml b/testsuites/performance/performance-benchmark-test/pom.xml index 6f6a978b1..747c3ddef 100644 --- a/testsuites/performance/performance-benchmark-test/pom.xml +++ b/testsuites/performance/performance-benchmark-test/pom.xml @@ -104,12 +104,6 @@ <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> <scope>test</scope> |