aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast')
-rw-r--r--plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java47
1 files changed, 40 insertions, 7 deletions
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/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java
index c999c95f0..c3c137349 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/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/test/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributorTest.java
@@ -22,13 +22,19 @@ package org.onap.policy.apex.plugins.context.distribution.hazelcast;
import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
+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.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -37,13 +43,45 @@ public class HazelcastContextDistributorTest {
// Logger for this class
private static final XLogger logger = XLoggerFactory.getXLogger(HazelcastContextDistributorTest.class);
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ @Before
+ public void beforeTest() {
+ contextParameters = new ContextParameters();
+
+ contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
+ contextParameters.getDistributorParameters().setName(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
+ contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
+ contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
+
+ contextParameters.getDistributorParameters().setPluginClass(HAZEL_CAST_PLUGIN_CLASS);
+
+ ParameterService.register(contextParameters);
+ 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());
+
+ ParameterService.register(schemaParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(schemaParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+ }
@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");
@@ -53,8 +91,6 @@ public class HazelcastContextDistributorTest {
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");
@@ -64,11 +100,8 @@ public class HazelcastContextDistributorTest {
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");
}
-
}