summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-executor
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-executor')
-rw-r--r--plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutorTest.java13
-rw-r--r--plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java6
-rw-r--r--plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java17
3 files changed, 11 insertions, 25 deletions
diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutorTest.java b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutorTest.java
index 2da6a5c73..2a10e70ca 100644
--- a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutorTest.java
@@ -22,10 +22,7 @@ package org.onap.policy.apex.plugins.executor.javascript;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
@@ -94,7 +91,7 @@ public class JavascriptStateFinalizerExecutorTest {
assertThatThrownBy(() -> {
jsfe.prepare();
}).hasMessage("logic failed to compile for NULL:0.0.0:NULL:NULL "
- + "with message: invalid return (NULL:0.0.0:NULL:NULL#1)");
+ + "with message: invalid return (NULL:0.0.0:NULL:NULL#1)");
stateFinalizerLogic.setLogic("java.lang.String");
jsfe.prepare();
@@ -102,10 +99,10 @@ public class JavascriptStateFinalizerExecutorTest {
AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
EnEvent event = new EnEvent(axEvent);
stateFinalizerLogic.setLogic("if(executor.executionId==-1)" + "{\r\n"
- + "var returnValueType = java.lang.Boolean;" + "var returnValue = new returnValueType(false); }\n"
- + "else{\n" + "executor.setSelectedStateOutputName(\"SelectedOutputIsMe\");\n"
- + "var returnValueType = java.lang.Boolean;\n" + "\n"
- + "var returnValue = new returnValueType(true);} true;");
+ + "var returnValueType = java.lang.Boolean;" + "var returnValue = new returnValueType(false); }\n"
+ + "else{\n" + "executor.setSelectedStateOutputName(\"SelectedOutputIsMe\");\n"
+ + "var returnValueType = java.lang.Boolean;\n" + "\n"
+ + "var returnValue = new returnValueType(true);} true;");
assertThatThrownBy(() -> {
jsfe.prepare();
diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java
index a6e410cd0..78ac85366 100644
--- a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java
@@ -22,7 +22,6 @@ package org.onap.policy.apex.plugins.executor.javascript;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.util.Properties;
@@ -83,9 +82,6 @@ public class JavascriptTaskSelectExecutorTest {
jtse.prepare();
}).hasMessage("no logic specified for NULL:0.0.0:NULL:NULL");
- AxEvent axEvent1 = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
- EnEvent event1 = new EnEvent(axEvent1);
-
state.getTaskSelectionLogic().setLogic("java.lang.String");
jtse.prepare();
@@ -99,7 +95,7 @@ public class JavascriptTaskSelectExecutorTest {
assertThatThrownBy(() -> {
jtse.execute(-1, new Properties(), event);
}).hasMessage(
- "execute: logic for NULL:0.0.0:NULL:NULL returned a non-boolean value [JavaClass java.lang.String]");
+ "execute: logic for NULL:0.0.0:NULL:NULL returned a non-boolean value [JavaClass java.lang.String]");
state.getTaskSelectionLogic().setLogic("var x=1;\n" + "false; ");
diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java
index 2cd19c6f6..4dd400bbc 100644
--- a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java
@@ -47,17 +47,12 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.model.policymodel.concepts.AxState;
import org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic;
import org.onap.policy.common.parameters.ParameterService;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
/**
* Test the MvelStateFinalizerExecutor class.
*
*/
public class MvelStateFinalizerExecutorTest {
-
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(MvelStateFinalizerExecutorTest.class);
-
/**
* Initiate Parameters.
*/
@@ -85,8 +80,7 @@ public class MvelStateFinalizerExecutorTest {
MvelStateFinalizerExecutor msfe = new MvelStateFinalizerExecutor();
assertNotNull(msfe);
- assertThatThrownBy(msfe::prepare)
- .isInstanceOf(java.lang.NullPointerException.class);
+ assertThatThrownBy(msfe::prepare).isInstanceOf(java.lang.NullPointerException.class);
ApexInternalContext internalContext = null;
internalContext = new ApexInternalContext(new AxPolicyModel());
@@ -100,8 +94,7 @@ public class MvelStateFinalizerExecutorTest {
msfe.setContext(parentStateExcutor, stateFinalizerLogic, internalContext);
stateFinalizerLogic.setLogic("x > 1 2 ()");
- assertThatThrownBy(msfe::prepare)
- .hasMessage("failed to compile MVEL code for state NULL:0.0.0:NULL:NULL");
+ assertThatThrownBy(msfe::prepare).hasMessage("failed to compile MVEL code for state NULL:0.0.0:NULL:NULL");
stateFinalizerLogic.setLogic("java.lang.String");
msfe.prepare();
@@ -117,9 +110,9 @@ public class MvelStateFinalizerExecutorTest {
assertThatThrownBy(() -> msfe.execute(-1, new Properties(), event))
.hasMessage("execute-post: state finalizer logic execution failure on state \"NULL:0.0.0:"
+ "NULL:NULL\" on finalizer logic NULL:0.0.0:NULL:NULL");
- stateFinalizerLogic.setLogic(
- "if (executionId == -1) {return false;}setSelectedStateOutputName(\"SelectedOutputIsMe\");"
- + "return true;");
+ stateFinalizerLogic
+ .setLogic("if (executionId == -1) {return false;}setSelectedStateOutputName(\"SelectedOutputIsMe\");"
+ + "return true;");
state.getStateOutputs().put("SelectedOutputIsMe", null);
msfe.prepare();