aboutsummaryrefslogtreecommitdiffstats
path: root/context/context-test/src/test
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-07-05 18:57:02 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-07-06 09:27:14 +0100
commit3f300de4a4ab68feef455e43b18cac804323fd8e (patch)
tree0576d3bc84f573cd1020c0d8c6d9ddd313b1bc23 /context/context-test/src/test
parentf149399d9fed5949bf9afc3eeac1da9bf0b905fa (diff)
Refactoring existing integration tests
Change-Id: I1aedd94d5197b8c6513fc701e9df2aab4edec088 Issue-ID: POLICY-865 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'context/context-test/src/test')
-rw-r--r--context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java65
-rw-r--r--context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java75
-rw-r--r--context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java62
-rw-r--r--context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java73
-rw-r--r--context/context-test/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java97
-rw-r--r--context/context-test/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java184
-rw-r--r--context/context-test/src/test/resources/META-INF/persistence.xml50
7 files changed, 0 insertions, 606 deletions
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java
deleted file mode 100644
index 7d5693d5a..000000000
--- a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.context.test.distribution;
-
-
-import java.io.IOException;
-
-import org.junit.After;
-import org.junit.Test;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-public class TestContextAlbumUpdate {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(TestContextAlbumUpdate.class);
-
- @Test
- public void testContextAlbumUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextAlbumUpdateJVMLocalVarSet test . . .");
-
- final ContextParameters contextParameters = new ContextParameters();
- contextParameters.getDistributorParameters()
- .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
- new ContextAlbumUpdate().testContextAlbumUpdate();
-
- logger.debug("Ran testContextAlbumUpdateJVMLocalVarSet test");
- }
-
- @Test
- public void testContextAlbumUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextAlbumUpdateJVMLocalVarNotSet test . . .");
-
- new ContextParameters();
- new ContextAlbumUpdate().testContextAlbumUpdate();
-
- logger.debug("Ran testContextAlbumUpdateJVMLocalVarNotSet test");
- }
-
- /**
- * Test context update cleardown.
- */
- @After
- public void testContextAlbumUpdateCleardown() {}
-}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java
deleted file mode 100644
index f640b339e..000000000
--- a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.context.test.distribution;
-
-
-import java.io.IOException;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextInstantiation.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class TestContextInstantiation {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(TestContextInstantiation.class);
-
- @Before
- public void beforeTest() {}
-
- /**
- * Test context instantiation clear down.
- */
- @After
- public void afterTest() {}
-
- @Test
- public void testContextInstantiationJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextInstantiationJVMLocalVarSet test . . .");
-
- final ContextParameters contextParameters = new ContextParameters();
- contextParameters.getDistributorParameters()
- .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
- new ContextInstantiation().testContextInstantiation();
-
- logger.debug("Ran testContextInstantiationJVMLocalVarSet test");
- }
-
- @Test
- public void testContextInstantiationJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextInstantiationJVMLocalVarNotSet test . . .");
-
- new ContextParameters();
- new ContextInstantiation().testContextInstantiation();
-
- logger.debug("Ran testContextInstantiationJVMLocalVarNotSet test");
- }
-
-}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java
deleted file mode 100644
index d140b0da1..000000000
--- a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.context.test.distribution;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextUpdate.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class TestContextUpdate {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(TestContextUpdate.class);
-
- @Test
- public void testContextUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextUpdateJVMLocalVarSet test . . .");
-
- final ContextParameters contextParameters = new ContextParameters();
- contextParameters.getDistributorParameters()
- .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
- new ContextUpdate().testContextUpdate();
-
- logger.debug("Ran testContextUpdateJVMLocalVarSet test");
- }
-
- @Test
- public void testContextUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testContextUpdateJVMLocalVarNotSet test . . .");
-
- new ContextParameters();
- new ContextUpdate().testContextUpdate();
-
- logger.debug("Ran testContextUpdateJVMLocalVarNotSet test");
- }
-}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java
deleted file mode 100644
index 27987595c..000000000
--- a/context/context-test/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.context.test.distribution;
-
-
-import java.io.IOException;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestContextInstantiation.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class TestSequentialContextInstantiation {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(TestSequentialContextInstantiation.class);
-
- @Before
- public void beforeTest() {}
-
- @After
- public void afterTest() {}
-
- @Test
- public void testSequentialContextInstantiationJVMLocalVarSet()
- throws ApexModelException, IOException, ApexException {
- logger.debug("Running testSequentialContextInstantiationJVMLocalVarSet test . . .");
-
- final ContextParameters contextParameters = new ContextParameters();
- contextParameters.getDistributorParameters()
- .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
- new SequentialContextInstantiation().testSequentialContextInstantiation();
-
- logger.debug("Ran testSequentialContextInstantiationJVMLocalVarSet test");
- }
-
- @Test
- public void testSequentialContextInstantiationJVMLocalVarNotSet()
- throws ApexModelException, IOException, ApexException {
- logger.debug("Running testSequentialContextInstantiationJVMLocalVarNotSet test . . .");
-
- new ContextParameters();
- new SequentialContextInstantiation().testSequentialContextInstantiation();
-
- logger.debug("Ran testSequentialContextInstantiationJVMLocalVarNotSet test");
- }
-}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java
deleted file mode 100644
index 0f6626ff1..000000000
--- a/context/context-test/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.context.test.locking;
-
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class TestConcurrentContext tests concurrent use of context.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class TestConcurrentContext {
- // Logger for this class
- private static final XLogger logger = XLoggerFactory.getXLogger(TestConcurrentContext.class);
-
- // Test parameters
- private static final int TEST_JVM_COUNT_SINGLE_JVM = 1;
- private static final int TEST_JVM_COUNT_MULTI_JVM = 3;
- private static final int TEST_THREAD_COUNT_SINGLE_JVM = 64;
- private static final int TEST_THREAD_COUNT_MULTI_JVM = 20;
- private static final int TEST_THREAD_LOOPS = 100;
-
- @Test
- public void testConcurrentContextJVMLocalVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testConcurrentContextJVMLocalVarSet test . . .");
-
- final ContextParameters contextParameters = new ContextParameters();
- contextParameters.getLockManagerParameters()
- .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager");
- final long result = new ConcurrentContext().testConcurrentContext("JVMLocalVarSet", TEST_JVM_COUNT_SINGLE_JVM,
- TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS);
-
- assertEquals(TEST_JVM_COUNT_SINGLE_JVM * TEST_THREAD_COUNT_SINGLE_JVM * TEST_THREAD_LOOPS, result);
-
- logger.debug("Ran testConcurrentContextJVMLocalVarSet test");
- }
-
- @Test
- public void testConcurrentContextJVMLocalNoVarSet() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testConcurrentContextJVMLocalNoVarSet test . . .");
-
- new ContextParameters();
- final long result = new ConcurrentContext().testConcurrentContext("JVMLocalNoVarSet", TEST_JVM_COUNT_SINGLE_JVM,
- TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS);
-
- assertEquals(TEST_JVM_COUNT_SINGLE_JVM * TEST_THREAD_COUNT_SINGLE_JVM * TEST_THREAD_LOOPS, result);
-
- logger.debug("Ran testConcurrentContextJVMLocalNoVarSet test");
- }
-
- @Test
- public void testConcurrentContextMultiJVMNoLock() throws ApexModelException, IOException, ApexException {
- logger.debug("Running testConcurrentContextMultiJVMNoLock test . . .");
-
- final ContextParameters contextParameters = new ContextParameters();
- contextParameters.getDistributorParameters()
- .setPluginClass("org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor");
- contextParameters.getLockManagerParameters()
- .setPluginClass("org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager");
-
- final long result = new ConcurrentContext().testConcurrentContext("testConcurrentContextMultiJVMNoLock",
- TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS);
-
- // No concurrent map so result will be zero
- assertEquals(0, result);
-
- logger.debug("Ran testConcurrentContextMultiJVMNoLock test");
- }
-}
diff --git a/context/context-test/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java b/context/context-test/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java
deleted file mode 100644
index db1ac47fe..000000000
--- a/context/context-test/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.context.test.persistence;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.context.ContextAlbum;
-import org.onap.policy.apex.context.Distributor;
-import org.onap.policy.apex.context.impl.distribution.DistributorFactory;
-import org.onap.policy.apex.context.parameters.ContextParameters;
-import org.onap.policy.apex.context.parameters.PersistorParameters;
-import org.onap.policy.apex.context.test.concepts.TestContextItem003;
-import org.onap.policy.apex.context.test.concepts.TestContextItem008;
-import org.onap.policy.apex.context.test.concepts.TestContextItem00A;
-import org.onap.policy.apex.context.test.concepts.TestContextItem00C;
-import org.onap.policy.apex.context.test.factory.TestContextAlbumFactory;
-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.dao.ApexDao;
-import org.onap.policy.apex.model.basicmodel.dao.ApexDaoFactory;
-import org.onap.policy.apex.model.basicmodel.dao.DAOParameters;
-import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
-
-/**
- * The Class TestContextInstantiation.
- *
- * @author Sergey Sachkov (sergey.sachkov@ericsson.com)
- */
-public class TestPersistentContextInstantiation {
- // Logger for this class
- // private static final XLogger logger = XLoggerFactory.getXLogger(TestPersistentContextInstantiation.class);
-
- private Connection connection;
-
- @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();
- }
-
- @After
- public void afterTest() throws IOException {}
-
- @Test
- public void testContextPersistentInstantiation() throws ApexModelException, IOException, ApexException {
-
- final ContextParameters contextParameters = new ContextParameters();
- contextParameters.setPersistorParameters(new PersistorParameters());
-
- final AxArtifactKey distributorKey = new AxArtifactKey("AbstractDistributor", "0.0.1");
- final Distributor contextDistributor = new DistributorFactory().getDistributor(distributorKey);
-
- final AxArtifactKey[] usedArtifactStackArray = { new AxArtifactKey("testC-top", "0.0.1"),
- new AxArtifactKey("testC-next", "0.0.1"), new AxArtifactKey("testC-bot", "0.0.1") };
-
- final DAOParameters daoParameters = new DAOParameters();
- daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
- daoParameters.setPersistenceUnit("DAOTest");
- final ApexDao apexDao = new ApexDaoFactory().createApexDao(daoParameters);
- apexDao.init(daoParameters);
-
- final AxContextModel someContextModel = TestContextAlbumFactory.createMultiAlbumsContextModel();
-
- // Context for Storing Map values
- final AxContextAlbum axContextAlbumForMap =
- someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("MapContextAlbum", "0.0.1"));
- apexDao.create(axContextAlbumForMap);
- contextDistributor.registerModel(someContextModel);
- final ContextAlbum contextAlbumForMap = contextDistributor.createContextAlbum(axContextAlbumForMap.getKey());
- assertNotNull(contextAlbumForMap);
- contextAlbumForMap.setUserArtifactStack(usedArtifactStackArray);
-
- final Map<String, String> testMap = new HashMap<String, String>();
- testMap.put("key", "This is a policy context string");
-
- final Map<String, Object> valueMap0 = new HashMap<String, Object>();
- valueMap0.put("TestPolicyContextItem000", new TestContextItem00C(testMap));
-
- contextAlbumForMap.putAll(valueMap0);
-
- assertEquals(((TestContextItem00C) contextAlbumForMap.get("TestPolicyContextItem000")).getMapValue().get("key"),
- "This is a policy context string");
-
- contextAlbumForMap.flush();
-
- // Context for Storing Date values
- final AxContextAlbum axContextAlbumForDate =
- someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("DateContextAlbum", "0.0.1"));
- apexDao.create(axContextAlbumForDate);
- contextDistributor.registerModel(someContextModel);
- final ContextAlbum contextAlbumForDate = contextDistributor.createContextAlbum(axContextAlbumForDate.getKey());
- assertNotNull(contextAlbumForDate);
- contextAlbumForDate.setUserArtifactStack(usedArtifactStackArray);
-
- final TestContextItem008 testDate = new TestContextItem008(new Date());
- final TestContextItem00A tci00A = new TestContextItem00A();
- tci00A.setDateValue(testDate);
- tci00A.setTZValue(TimeZone.getTimeZone("Europe/Dublin").toString());
- tci00A.setDST(true);
-
- final Map<String, Object> valueMap1 = new HashMap<String, Object>();
- valueMap1.put("TestPolicyContextItem00A", tci00A);
-
- contextAlbumForDate.putAll(valueMap1);
-
- assertEquals(((TestContextItem00A) contextAlbumForDate.get("TestPolicyContextItem00A")).getDateValue(),
- testDate);
- assertEquals(((TestContextItem00A) contextAlbumForDate.get("TestPolicyContextItem00A")).getDST(), true);
-
- contextAlbumForDate.flush();
-
- // Context for Storing Long values
- final AxContextAlbum axContextAlbumForLong =
- someContextModel.getAlbums().getAlbumsMap().get(new AxArtifactKey("LTypeContextAlbum", "0.0.1"));
- apexDao.create(axContextAlbumForLong);
- contextDistributor.registerModel(someContextModel);
- final ContextAlbum contextAlbumForLong = contextDistributor.createContextAlbum(axContextAlbumForLong.getKey());
- assertNotNull(contextAlbumForLong);
- contextAlbumForLong.setUserArtifactStack(usedArtifactStackArray);
-
- final Map<String, Object> valueMap2 = new HashMap<String, Object>();
- valueMap2.put("TestPolicyContextItem0031", new TestContextItem003(0xFFFFFFFFFFFFFFFFL));
- valueMap2.put("TestPolicyContextItem0032", new TestContextItem003(0xFFFFFFFFFFFFFFFEL));
- valueMap2.put("TestPolicyContextItem0033", new TestContextItem003(0xFFFFFFFFFFFFFFFDL));
- valueMap2.put("TestPolicyContextItem0034", new TestContextItem003(0xFFFFFFFFFFFFFFFCL));
- valueMap2.put("TestPolicyContextItem0035", new TestContextItem003(0xFFFFFFFFFFFFFFFBL));
-
- contextAlbumForLong.putAll(valueMap2);
-
- assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0031")).getLongValue(),
- 0xFFFFFFFFFFFFFFFFL);
- assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0032")).getLongValue(),
- 0xFFFFFFFFFFFFFFFEL);
- assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0033")).getLongValue(),
- 0xFFFFFFFFFFFFFFFDL);
- assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0034")).getLongValue(),
- 0xFFFFFFFFFFFFFFFCL);
- assertEquals(((TestContextItem003) contextAlbumForLong.get("TestPolicyContextItem0035")).getLongValue(),
- 0xFFFFFFFFFFFFFFFBL);
-
- contextAlbumForLong.flush();
- contextDistributor.clear();
-
- }
-}
diff --git a/context/context-test/src/test/resources/META-INF/persistence.xml b/context/context-test/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index ec9357851..000000000
--- a/context/context-test/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2016-2018 Ericsson. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- 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=========================================================
--->
-
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
- <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class>
- <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="eclipselink.ddl-generation" value="drop-and-create-tables" />
- <property name="eclipselink.ddl-generation.output-mode" value="database" />
- <property name="eclipselink.logging.level" value="INFO" />
- </properties>
- </persistence-unit>
-</persistence>