diff options
author | Jorge Hernandez <jh1730@att.com> | 2018-07-06 13:39:39 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-07-06 13:39:39 +0000 |
commit | 000291ee3624776e193411ef21c119e671be7011 (patch) | |
tree | 02e64e1fcb69d187a2c6a2619e72cba27dbc739f /plugins/plugins-context/context-distribution | |
parent | 6bc18bc966bc9448505e55dec9ee11a8cea9a38c (diff) | |
parent | 3f300de4a4ab68feef455e43b18cac804323fd8e (diff) |
Merge "Refactoring existing integration tests"
Diffstat (limited to 'plugins/plugins-context/context-distribution')
4 files changed, 179 insertions, 0 deletions
diff --git a/plugins/plugins-context/context-distribution/context-distribution-hazelcast/pom.xml b/plugins/plugins-context/context-distribution/context-distribution-hazelcast/pom.xml index ce80a7a89..71806c54f 100644 --- a/plugins/plugins-context/context-distribution/context-distribution-hazelcast/pom.xml +++ b/plugins/plugins-context/context-distribution/context-distribution-hazelcast/pom.xml @@ -36,5 +36,11 @@ <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> </project>
\ No newline at end of file diff --git a/plugins/plugins-context/context-distribution/context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java b/plugins/plugins-context/context-distribution/context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java new file mode 100644 index 000000000..c999c95f0 --- /dev/null +++ b/plugins/plugins-context/context-distribution/context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java @@ -0,0 +1,74 @@ +/*- + * ============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.plugins.context.distribution.hazelcast; + +import java.io.IOException; + +import org.junit.Test; +import org.onap.policy.apex.context.parameters.ContextParameters; +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.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +public class HazelcastContextDistributorTest { + private static final String HAZEL_CAST_PLUGIN_CLASS = HazelcastContextDistributor.class.getCanonicalName(); + // Logger for this class + private static final XLogger logger = XLoggerFactory.getXLogger(HazelcastContextDistributorTest.class); + + + @Test + public void testContextAlbumUpdateHazelcast() throws ApexModelException, IOException, ApexException { + logger.debug("Running testContextAlbumUpdateHazelcast test . . ."); + + final ContextParameters contextParameters = new ContextParameters(); + contextParameters.getDistributorParameters().setPluginClass(HAZEL_CAST_PLUGIN_CLASS); + new ContextAlbumUpdate().testContextAlbumUpdate(); + + logger.debug("Ran testContextAlbumUpdateHazelcast test"); + } + + @Test + public void testContextInstantiationHazelcast() throws ApexModelException, IOException, ApexException { + logger.debug("Running testContextInstantiationHazelcast test . . ."); + + final ContextParameters contextParameters = new ContextParameters(); + contextParameters.getDistributorParameters().setPluginClass(HAZEL_CAST_PLUGIN_CLASS); + new ContextInstantiation().testContextInstantiation(); + + logger.debug("Ran testContextInstantiationHazelcast test"); + } + + @Test + public void testContextUpdateHazelcast() throws ApexModelException, IOException, ApexException { + logger.debug("Running testContextUpdateHazelcast test . . ."); + + final ContextParameters contextParameters = new ContextParameters(); + contextParameters.getDistributorParameters().setPluginClass(HAZEL_CAST_PLUGIN_CLASS); + new ContextUpdate().testContextUpdate(); + + logger.debug("Ran testContextUpdateHazelcast test"); + } + +} diff --git a/plugins/plugins-context/context-distribution/context-distribution-infinispan/pom.xml b/plugins/plugins-context/context-distribution/context-distribution-infinispan/pom.xml index 7592edd91..c6985a952 100644 --- a/plugins/plugins-context/context-distribution/context-distribution-infinispan/pom.xml +++ b/plugins/plugins-context/context-distribution/context-distribution-infinispan/pom.xml @@ -42,6 +42,12 @@ </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> </project>
\ No newline at end of file diff --git a/plugins/plugins-context/context-distribution/context-distribution-infinispan/src/test/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributorTest.java b/plugins/plugins-context/context-distribution/context-distribution-infinispan/src/test/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributorTest.java new file mode 100644 index 000000000..34fa7d439 --- /dev/null +++ b/plugins/plugins-context/context-distribution/context-distribution-infinispan/src/test/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributorTest.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 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.plugins.context.distribution.infinispan; + +import java.io.IOException; + +import org.junit.Test; +import org.onap.policy.apex.context.parameters.ContextParameters; +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.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; + +public class InfinispanContextDistributorTest { + private static final XLogger logger = XLoggerFactory.getXLogger(InfinispanContextDistributorTest.class); + + private static final String PLUGIN_CLASS = InfinispanContextDistributor.class.getCanonicalName(); + + @Test + public void testContextAlbumUpdateInfinispan() throws ApexModelException, IOException, ApexException { + logger.debug("Running testContextAlbumUpdateInfinispan test . . ."); + + final ContextParameters contextParameters = new ContextParameters(); + contextParameters.getDistributorParameters().setPluginClass(PLUGIN_CLASS); + new InfinispanDistributorParameters(); + + new ContextAlbumUpdate().testContextAlbumUpdate(); + + logger.debug("Ran testContextAlbumUpdateInfinispan test"); + } + + @Test + public void testContextInstantiationInfinispan() throws ApexModelException, IOException, ApexException { + logger.debug("Running testContextInstantiationInfinispan test . . ."); + + final ContextParameters contextParameters = new ContextParameters(); + contextParameters.getDistributorParameters().setPluginClass(PLUGIN_CLASS); + new InfinispanDistributorParameters(); + + new ContextInstantiation().testContextInstantiation(); + + logger.debug("Ran testContextInstantiationInfinispan test"); + } + + @Test + public void testContextUpdateInfinispan() throws ApexModelException, IOException, ApexException { + logger.debug("Running testContextUpdateInfinispan test . . ."); + + final ContextParameters contextParameters = new ContextParameters(); + contextParameters.getDistributorParameters().setPluginClass(PLUGIN_CLASS); + new InfinispanDistributorParameters(); + + new ContextUpdate().testContextUpdate(); + + logger.debug("Ran testContextUpdateInfinispan test"); + } + + @Test + public void testSequentialContextInstantiationInfinispan() throws ApexModelException, IOException, ApexException { + logger.debug("Running testSequentialContextInstantiationInfinispan test . . ."); + + final ContextParameters contextParameters = new ContextParameters(); + contextParameters.getDistributorParameters().setPluginClass(PLUGIN_CLASS); + new InfinispanDistributorParameters(); + + new SequentialContextInstantiation().testSequentialContextInstantiation(); + + logger.debug("Ran testSequentialContextInstantiationInfinispan test"); + } + + +} |