aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugins-executor/plugins-executor-mvel/src
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-07-10 19:44:39 +0000
committerliamfallon <liam.fallon@est.tech>2019-07-10 19:44:39 +0000
commitadf67497761295115dc75b525500d687518fc4fd (patch)
treec5c5b5e737ac08256e9f782b5dccbd3ddc08d3c3 /plugins/plugins-executor/plugins-executor-mvel/src
parent5c384fb2888029c2babb859c30318749e1ce828c (diff)
Add integration tests for executor properties
Added integration test that sets properties in a dummy plugin and amends them in tasks in a policy. Variosu tests added to check combinations of where properties are set in plugins or in tasks or both. Implementaiton changed to: - Always pass in a Properies object, the properties object coming into the policy cannot be null because the task/TSL/SFL may wish to set it - Fix a bug where the properties were not passed from the ApexEvent to the engine event in the ApexEventUnmarshaller class Issue-ID: POLICY-1743 Change-Id: I6aa152b28d46cf3cc6fa56a1a95b76a8e55f5a49 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'plugins/plugins-executor/plugins-executor-mvel/src')
-rw-r--r--plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java10
-rw-r--r--plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java9
-rw-r--r--plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java10
3 files changed, 17 insertions, 12 deletions
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 5e66be30f..52d9a9a0a 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
@@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -126,7 +128,7 @@ public class MvelStateFinalizerExecutorTest {
}
try {
- msfe.execute(-1, null, null);
+ msfe.execute(-1, new Properties(), null);
fail("test should throw an exception here");
} catch (Exception msfeException) {
assertEquals("failed to execute MVEL code for state NULL:0.0.0:NULL:NULL",
@@ -136,7 +138,7 @@ public class MvelStateFinalizerExecutorTest {
AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
EnEvent event = new EnEvent(axEvent);
try {
- msfe.execute(-1, null, event);
+ msfe.execute(-1, new Properties(), event);
fail("test should throw an exception here");
} catch (Exception msfeException) {
assertEquals("failed to execute MVEL code for state NULL:0.0.0:NULL:NULL",
@@ -146,7 +148,7 @@ public class MvelStateFinalizerExecutorTest {
stateFinalizerLogic.setLogic("executionId !=-1");
try {
msfe.prepare();
- msfe.execute(-1, null, event);
+ msfe.execute(-1, new Properties(), event);
fail("test should throw an exception here");
} catch (Exception msfeException) {
assertEquals(
@@ -161,7 +163,7 @@ public class MvelStateFinalizerExecutorTest {
state.getStateOutputs().put("SelectedOutputIsMe", null);
try {
msfe.prepare();
- String stateOutput = msfe.execute(0, null, event);
+ String stateOutput = msfe.execute(0, new Properties(), event);
assertEquals("SelectedOutputIsMe", stateOutput);
} catch (Exception msfeException) {
LOGGER.warn("Unexpected exception happened here.", msfeException);
diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java
index 18bccd670..d4f84da7a 100644
--- a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
import org.junit.After;
import org.junit.Before;
@@ -103,7 +104,7 @@ public class MvelTaskExecutorTest {
}
try {
- mte.execute(-1, null, null);
+ mte.execute(-1, new Properties(), null);
fail("test should throw an exception here");
} catch (Exception mteException) {
assertEquals(java.lang.NullPointerException.class, mteException.getClass());
@@ -111,7 +112,7 @@ public class MvelTaskExecutorTest {
Map<String, Object> incomingParameters = new HashMap<>();
try {
- mte.execute(-1, null, incomingParameters);
+ mte.execute(-1, new Properties(), incomingParameters);
fail("test should throw an exception here");
} catch (Exception mteException) {
assertEquals("failed to execute MVEL code for task NULL:0.0.0", mteException.getMessage());
@@ -120,7 +121,7 @@ public class MvelTaskExecutorTest {
task.getTaskLogic().setLogic("executionId != -1");
try {
mte.prepare();
- mte.execute(-1, null, incomingParameters);
+ mte.execute(-1, new Properties(), incomingParameters);
fail("test should throw an exception here");
} catch (Exception mteException) {
assertEquals("execute-post: task logic execution failure on task \"NULL\" in model NULL:0.0.0",
@@ -129,7 +130,7 @@ public class MvelTaskExecutorTest {
try {
mte.prepare();
- Map<String, Object> returnMap = mte.execute(0, null, incomingParameters);
+ Map<String, Object> returnMap = mte.execute(0, new Properties(), incomingParameters);
assertEquals(0, returnMap.size());
mte.cleanUp();
} catch (Exception mteException) {
diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java
index 05591b075..153eeca03 100644
--- a/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java
@@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -103,7 +105,7 @@ public class MvelTaskSelectExecutorTest {
}
try {
- mtse.execute(-1, null, null);
+ mtse.execute(-1, new Properties(), null);
fail("test should throw an exception here");
} catch (Exception mtseException) {
assertEquals(java.lang.NullPointerException.class, mtseException.getClass());
@@ -112,7 +114,7 @@ public class MvelTaskSelectExecutorTest {
AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
EnEvent event = new EnEvent(axEvent);
try {
- mtse.execute(-1, null, event);
+ mtse.execute(-1, new Properties(), event);
fail("test should throw an exception here");
} catch (Exception mtseException) {
assertEquals("failed to execute MVEL code for state NULL:0.0.0:NULL:NULL",
@@ -122,7 +124,7 @@ public class MvelTaskSelectExecutorTest {
state.getTaskSelectionLogic().setLogic("executionId != -1");
try {
mtse.prepare();
- mtse.execute(-1, null, event);
+ mtse.execute(-1, new Properties(), event);
fail("test should throw an exception here");
} catch (Exception mtseException) {
assertEquals("execute-post: task selection logic failed on state \"NULL:0.0.0:NULL:NULL\"",
@@ -131,7 +133,7 @@ public class MvelTaskSelectExecutorTest {
try {
mtse.prepare();
- AxArtifactKey taskKey = mtse.execute(0, null, event);
+ AxArtifactKey taskKey = mtse.execute(0, new Properties(), event);
assertEquals("NULL:0.0.0", taskKey.getId());
mtse.cleanUp();
} catch (Exception mtseException) {