aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-08-30 09:37:29 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-08-31 19:23:41 +0100
commitf32508381ce0b555fc14978cbaa458aa4e2d91c5 (patch)
tree1cab66e5372b6467f288ae1351ce836e4eba2d03 /testsuites/integration
parent052038c7a7e0b385462b3b653b7d06094d472df3 (diff)
Use parameter service in apex
Switch parameter handling in apex to use the ONAP PF common parameter service Change-Id: Id318d19c726b18b1a69c630fa81ca7d695355e9c Issue-ID: POLICY-954 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'testsuites/integration')
-rw-r--r--testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java9
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java55
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java55
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java54
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java55
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMVEL.java55
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java52
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java52
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java50
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java18
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java27
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java6
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java73
16 files changed, 485 insertions, 82 deletions
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
index 87968e64d..e5dab9706 100644
--- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
+++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
@@ -40,7 +40,6 @@ import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistribut
import org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager;
import org.onap.policy.apex.context.parameters.ContextParameters;
import org.onap.policy.apex.context.parameters.DistributorParameters;
-import org.onap.policy.apex.context.parameters.LockManagerParameters;
import org.onap.policy.apex.context.test.concepts.TestContextLongItem;
import org.onap.policy.apex.context.test.lock.modifier.LockType;
import org.onap.policy.apex.context.test.locking.ConcurrentContext;
@@ -52,13 +51,13 @@ import org.onap.policy.apex.context.test.utils.ZooKeeperServerServiceProvider;
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;
-import org.onap.policy.apex.model.basicmodel.service.ParameterService;
import org.onap.policy.apex.plugins.context.distribution.hazelcast.HazelcastContextDistributor;
import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanContextDistributor;
import org.onap.policy.apex.plugins.context.distribution.infinispan.InfinispanDistributorParameters;
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.common.parameters.ParameterService;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -226,7 +225,7 @@ public class TestConcurrentContext {
curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName());
curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort);
contextParameters.setLockManagerParameters(curatorParameters);
- ParameterService.registerParameters(LockManagerParameters.class, curatorParameters);
+ ParameterService.register(curatorParameters);
final ConfigrationProvider configrationProvider = getConfigrationProvider("CuratorLock",
TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS);
@@ -308,7 +307,7 @@ public class TestConcurrentContext {
curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName());
curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort);
contextParameters.setLockManagerParameters(curatorParameters);
- ParameterService.registerParameters(LockManagerParameters.class, curatorParameters);
+ ParameterService.register(curatorParameters);
final ConfigrationProvider configrationProvider = getConfigrationProvider("InfinispanMultiCuratorLock",
TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS);
@@ -342,7 +341,7 @@ public class TestConcurrentContext {
curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName());
curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort);
contextParameters.setLockManagerParameters(curatorParameters);
- ParameterService.registerParameters(LockManagerParameters.class, curatorParameters);
+ ParameterService.register(curatorParameters);
final ConfigrationProvider configrationProvider = getConfigrationProvider("HazelcastMultiCuratorLock",
TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS);
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java
index 8b1cc0b04..3c0e9f984 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java
@@ -22,12 +22,60 @@ package org.onap.policy.apex.plugins.executor.test.script.engine;
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.core.engine.EngineParameters;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters;
+import org.onap.policy.common.parameters.ParameterService;
public class TestApexEngineJRuby {
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("JRUBY", new JrubyExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
/**
* Test apex engine.
@@ -38,10 +86,7 @@ public class TestApexEngineJRuby {
*/
@Test
public void testApexEngineJRuby() throws ApexException, InterruptedException, IOException {
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("JRUBY", new JrubyExecutorParameters());
-
- new TestApexEngine("JRUBY", parameters);
- new TestApexEngine("JRUBY", parameters);
+ new TestApexEngine("JRUBY", engineParameters);
+ new TestApexEngine("JRUBY", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java
index 44593a0a2..c1d68760d 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java
@@ -22,10 +22,17 @@ package org.onap.policy.apex.plugins.executor.test.script.engine;
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.core.engine.EngineParameters;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters;
+import org.onap.policy.common.parameters.ParameterService;
/**
* The Class TestApexEngine_Java.
@@ -33,6 +40,47 @@ import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestApexEngineJava {
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
/**
* Test apex engine.
@@ -43,10 +91,7 @@ public class TestApexEngineJava {
*/
@Test
public void testApexEngineJava() throws InterruptedException, IOException, ApexException {
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters());
-
- new TestApexEngine("JAVA", parameters);
- new TestApexEngine("JAVA", parameters);
+ new TestApexEngine("JAVA", engineParameters);
+ new TestApexEngine("JAVA", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java
index 1f55f8458..1f5c1d4b8 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java
@@ -22,12 +22,60 @@ package org.onap.policy.apex.plugins.executor.test.script.engine;
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.core.engine.EngineParameters;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters;
+import org.onap.policy.common.parameters.ParameterService;
public class TestApexEngineJavascript {
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
/**
* Test apex engine.
@@ -38,10 +86,8 @@ public class TestApexEngineJavascript {
*/
@Test
public void testApexEngineJavascript() throws ApexException, InterruptedException, IOException {
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters());
- new TestApexEngine("JAVASCRIPT", parameters);
- new TestApexEngine("JAVASCRIPT", parameters);
+ new TestApexEngine("JAVASCRIPT", engineParameters);
+ new TestApexEngine("JAVASCRIPT", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java
index eabe63dfb..b5b0f9a78 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java
@@ -22,12 +22,60 @@ package org.onap.policy.apex.plugins.executor.test.script.engine;
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.core.engine.EngineParameters;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters;
+import org.onap.policy.common.parameters.ParameterService;
public class TestApexEngineJython {
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("JYTHON", new JythonExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
/**
* Test apex engine.
@@ -38,10 +86,7 @@ public class TestApexEngineJython {
*/
@Test
public void testApexEngineJython() throws ApexException, InterruptedException, IOException {
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("JYTHON", new JythonExecutorParameters());
-
- new TestApexEngine("JYTHON", parameters);
- new TestApexEngine("JYTHON", parameters);
+ new TestApexEngine("JYTHON", engineParameters);
+ new TestApexEngine("JYTHON", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMVEL.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMVEL.java
index aea7cecc6..e500c9d3b 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMVEL.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMVEL.java
@@ -22,12 +22,60 @@ package org.onap.policy.apex.plugins.executor.test.script.engine;
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.core.engine.EngineParameters;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters;
+import org.onap.policy.common.parameters.ParameterService;
public class TestApexEngineMVEL {
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
/**
* Test apex engine.
@@ -38,10 +86,7 @@ public class TestApexEngineMVEL {
*/
@Test
public void testApexEngineMVEL() throws ApexException, InterruptedException, IOException {
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
-
- new TestApexEngine("MVEL", parameters);
- new TestApexEngine("MVEL", parameters);
+ new TestApexEngine("MVEL", engineParameters);
+ new TestApexEngine("MVEL", engineParameters);
}
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java
index 0ed78a13f..07a374926 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java
@@ -30,7 +30,13 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+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.core.engine.EngineParameters;
import org.onap.policy.apex.core.engine.engine.ApexEngine;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory;
@@ -41,6 +47,7 @@ import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters;
import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -53,6 +60,48 @@ public class TestEventInstantiation {
// Logger for this class
private static final XLogger logger = XLoggerFactory.getXLogger(TestEventInstantiation.class);
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
+
/**
* Test event instantiation.
*
@@ -69,9 +118,6 @@ public class TestEventInstantiation {
final AxPolicyModel apexPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("MVEL");
assertNotNull(apexPolicyModel);
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
-
final ApexEngine apexEngine = new ApexEngineFactory().createApexEngine(apexPolicyModel.getKey());
apexEngine.updateModel(apexPolicyModel);
apexEngine.start();
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java
index 5ca71cf33..83e69c98f 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java
@@ -27,8 +27,14 @@ import static org.junit.Assert.fail;
import java.io.IOException;
+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.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.core.engine.EngineParameters;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineImpl;
@@ -38,6 +44,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters;
import org.onap.policy.apex.plugins.executor.test.script.engine.TestApexActionListener;
import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -50,6 +57,48 @@ public class TestContextUpdateDifferentModels {
// Logger for this class
private static final XLogger logger = XLoggerFactory.getXLogger(TestContextUpdateDifferentModels.class);
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
+
@Test
public void testContextUpdateDifferentModels() throws ApexException, InterruptedException, IOException {
logger.debug("Running test testContextUpdateDifferentModels . . .");
@@ -57,9 +106,6 @@ public class TestContextUpdateDifferentModels {
final AxPolicyModel apexModelSample = new SampleDomainModelFactory().getSamplePolicyModel("MVEL");
assertNotNull(apexModelSample);
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
-
final ApexEngineImpl apexEngine =
(ApexEngineImpl) new ApexEngineFactory().createApexEngine(new AxArtifactKey("TestApexEngine", "0.0.1"));
final TestApexActionListener listener = new TestApexActionListener("Test");
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java
index e78d4c5bb..7aaa1e585 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java
@@ -30,8 +30,13 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import org.onap.policy.apex.context.ContextException;
+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.core.engine.EngineParameters;
import org.onap.policy.apex.core.engine.engine.ApexEngine;
import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory;
@@ -42,6 +47,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters;
import org.onap.policy.apex.plugins.executor.test.script.engine.TestApexActionListener;
import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -54,14 +60,52 @@ public class TestContextUpdateModel {
// Logger for this class
private static final XLogger logger = XLoggerFactory.getXLogger(TestContextUpdateModel.class);
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineParameters engineParameters;
+
+ @Before
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineParameters = new EngineParameters();
+ engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
+ ParameterService.register(engineParameters);
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineParameters);
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
@Test
public void testContextUpdateModel() throws ApexException, InterruptedException, IOException {
final AxArtifactKey key = new AxArtifactKey("TestApexEngine", "0.0.1");
- final EngineParameters parameters = new EngineParameters();
- parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
-
final ApexEngine apexEngine = new ApexEngineFactory().createApexEngine(key);
final TestApexActionListener listener = new TestApexActionListener("Test");
apexEngine.addEventListener("listener", listener);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java
index 639b450df..c243b8b07 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java
@@ -40,14 +40,12 @@ public class KafkaEventProducer implements Runnable {
private final long eventInterval;
private long eventsSentCount = 0;
- private Producer<String, String> producer;
-
private final Thread producerThread;
private boolean sendEventsFlag = false;
private boolean stopFlag = false;
public KafkaEventProducer(final String topic, final String kafkaServerAddress, final int eventCount,
- final boolean xmlEvents, final long eventInterval) {
+ final boolean xmlEvents, final long eventInterval) {
this.topic = topic;
this.kafkaServerAddress = kafkaServerAddress;
this.eventCount = eventCount;
@@ -70,13 +68,13 @@ public class KafkaEventProducer implements Runnable {
kafkaProducerProperties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
kafkaProducerProperties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
- producer = new KafkaProducer<String, String>(kafkaProducerProperties);
+ final Producer<String, String> producer = new KafkaProducer<String, String>(kafkaProducerProperties);
while (producerThread.isAlive() && !stopFlag) {
ThreadUtilities.sleep(50);
if (sendEventsFlag) {
- sendEventsToTopic();
+ sendEventsToTopic(producer);
sendEventsFlag = false;
}
}
@@ -88,13 +86,13 @@ public class KafkaEventProducer implements Runnable {
sendEventsFlag = true;
}
- private void sendEventsToTopic() {
+ private void sendEventsToTopic(final Producer<String, String> producer) {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": sending events to Kafka server at "
- + kafkaServerAddress + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
+ + kafkaServerAddress + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
for (int i = 0; i < eventCount; i++) {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": waiting " + eventInterval
- + " milliseconds before sending next event");
+ + " milliseconds before sending next event");
ThreadUtilities.sleep(eventInterval);
String eventString = null;
@@ -159,8 +157,8 @@ public class KafkaEventProducer implements Runnable {
return;
}
- final KafkaEventProducer producer =
- new KafkaEventProducer(args[0], args[1], eventCount, xmlEvents, eventInterval);
+ final KafkaEventProducer producer = new KafkaEventProducer(args[0], args[1], eventCount, xmlEvents,
+ eventInterval);
producer.sendEvents();
producer.shutdown();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
index d624d66bf..9aa9ac931 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
@@ -26,6 +26,16 @@ import java.io.IOException;
import java.nio.file.Files;
import java.util.Properties;
+import kafka.admin.AdminUtils;
+import kafka.admin.RackAwareMode;
+import kafka.server.BrokerState;
+import kafka.server.KafkaConfig;
+import kafka.server.KafkaServer;
+import kafka.utils.TestUtils;
+import kafka.utils.ZKStringSerializer$;
+import kafka.utils.ZkUtils;
+import kafka.zk.EmbeddedZookeeper;
+
import org.I0Itec.zkclient.ZkClient;
import org.apache.kafka.common.utils.MockTime;
import org.apache.kafka.common.utils.Time;
@@ -37,14 +47,6 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.main.ApexMain;
-import kafka.admin.AdminUtils;
-import kafka.admin.RackAwareMode;
-import kafka.server.KafkaConfig;
-import kafka.server.KafkaServer;
-import kafka.utils.TestUtils;
-import kafka.utils.ZKStringSerializer$;
-import kafka.utils.ZkUtils;
-import kafka.zk.EmbeddedZookeeper;
public class TestKafka2Kafka {
// The method of starting an embedded Kafka server used in this example is based on the method
@@ -84,11 +86,13 @@ public class TestKafka2Kafka {
final KafkaConfig config = new KafkaConfig(brokerProps);
final Time mock = new MockTime();
kafkaServer = TestUtils.createServer(config, mock);
-
+ kafkaServer.startup();
+
// create topics
AdminUtils.createTopic(zkUtils, "apex-in-0", 1, 1, new Properties(), RackAwareMode.Disabled$.MODULE$);
AdminUtils.createTopic(zkUtils, "apex-in-1", 1, 1, new Properties(), RackAwareMode.Disabled$.MODULE$);
AdminUtils.createTopic(zkUtils, "apex-out", 1, 1, new Properties(), RackAwareMode.Disabled$.MODULE$);
+
}
@AfterClass
@@ -120,12 +124,13 @@ public class TestKafka2Kafka {
throws MessagingException, ApexException {
final KafkaEventSubscriber subscriber =
new KafkaEventSubscriber("apex-out-" + topicSuffix, "localhost:" + BROKERPORT);
- final KafkaEventProducer producer = new KafkaEventProducer("apex-in-" + topicSuffix, "localhost:" + BROKERPORT,
- EVENT_COUNT, xmlEvents, EVENT_INTERVAL);
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(3000);
+ final KafkaEventProducer producer = new KafkaEventProducer("apex-in-" + topicSuffix, "localhost:" + BROKERPORT,
+ EVENT_COUNT, xmlEvents, EVENT_INTERVAL);
+
producer.sendEvents();
final long testStartTime = System.currentTimeMillis();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java
index d304eb9d0..dd3f15ab6 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java
@@ -140,7 +140,7 @@ public class TestFile2REST {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
+ assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
}
@Test
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java
index f8898a7c5..922e03217 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java
@@ -123,7 +123,7 @@ public class TestREST2File {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
+ assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
}
@Test
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java
index b0bcac439..15928b3c7 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java
@@ -201,7 +201,7 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(" host and port are specified only in standalone mode"));
+ assertTrue(outString.contains(" host is specified only in standalone mode"));
}
@Test
@@ -220,7 +220,7 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(" host and port are specified only in standalone mode"));
+ assertTrue(outString.contains(" port is specified only in standalone mode"));
}
@Test
@@ -300,7 +300,7 @@ public class TestRESTServer {
System.setErr(stderr);
assertTrue(outString.contains(
- "event output for peered mode \"SYNCHRONOUS\": peer \"FirstConsumer\" for event handler \"FirstProducer\" does not exist or is not defined as being synchronous"));
+ "peer \"FirstConsumer for peered mode SYNCHRONOUS does not exist or is not defined with the same peered mode"));
}
@Test
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
index bcdcd571f..d68576d16 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
@@ -33,9 +33,9 @@ import org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.service.ModelService;
-import org.onap.policy.apex.model.basicmodel.service.ParameterService;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.apex.service.engine.main.ApexMain;
+import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.common.utils.resources.ResourceUtils;
public class EventAlbumContextTest {
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java
index adc416dca..451b4c76a 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java
@@ -33,6 +33,10 @@ import java.util.Map;
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.core.deployment.BatchDeployer;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
@@ -42,6 +46,7 @@ import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters;
import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters;
import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -58,13 +63,55 @@ public class EngDepMessagingTest {
private static final long MAX_START_WAIT = 10000; // 10 sec
- /**
- * Sets the up.
- *
- * @throws Exception the exception
- */
+ private SchemaParameters schemaParameters;
+ private ContextParameters contextParameters;
+ private EngineServiceParameters engineServiceParameters;
+
@Before
- public void setUp() throws Exception {}
+ public void beforeTest() {
+ schemaParameters = new SchemaParameters();
+
+ schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
+
+ ParameterService.register(schemaParameters);
+
+ 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);
+
+ ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters.getDistributorParameters());
+ ParameterService.register(contextParameters.getLockManagerParameters());
+ ParameterService.register(contextParameters.getPersistorParameters());
+
+ engineServiceParameters = new EngineServiceParameters();
+ engineServiceParameters.setName("EngDepMessagingTest");
+ engineServiceParameters.setVersion("0.0.1");
+ engineServiceParameters.setDeploymentPort(58820);
+ engineServiceParameters.setInstanceCount(3);
+ engineServiceParameters.setId(100);
+ engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
+
+ ParameterService.register(engineServiceParameters);
+ ParameterService.register(engineServiceParameters.getEngineParameters());
+ }
+
+ @After
+ public void afterTest() {
+ ParameterService.deregister(engineServiceParameters);
+ ParameterService.deregister(engineServiceParameters.getEngineParameters());
+
+ ParameterService.deregister(contextParameters.getDistributorParameters());
+ ParameterService.deregister(contextParameters.getLockManagerParameters());
+ ParameterService.deregister(contextParameters.getPersistorParameters());
+ ParameterService.deregister(contextParameters);
+
+ ParameterService.deregister(schemaParameters);
+ }
/**
* Test EngDep messaging.
@@ -79,15 +126,7 @@ public class EngDepMessagingTest {
ModelService.clear();
- final EngineServiceParameters parameters = new EngineServiceParameters();
- parameters.setName("EngDepMessagingTest");
- parameters.setVersion("0.0.1");
- parameters.setDeploymentPort(58820);
- parameters.setInstanceCount(3);
- parameters.setId(100);
- parameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MVELExecutorParameters());
-
- final EngineTestServer server = new EngineTestServer(parameters);
+ final EngineTestServer server = new EngineTestServer(engineServiceParameters);
assertNotNull(server);
final Thread serverThread = new Thread(server);
@@ -135,7 +174,7 @@ public class EngDepMessagingTest {
}
ThreadUtilities.sleep(500);
- assertEquals(server.getTotalActionEventsReceived(), 2);
+ assertEquals(2, server.getTotalActionEventsReceived());
deployer1.init();
deployer1.stopEngines();
@@ -160,7 +199,7 @@ public class EngDepMessagingTest {
}
ThreadUtilities.sleep(500);
- assertEquals(server.getTotalActionEventsReceived(), 4);
+ assertEquals(4, server.getTotalActionEventsReceived());
deployer2.init();
deployer2.stopEngines();