summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-executor/plugins-executor-jython/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-executor/plugins-executor-jython/src')
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java9
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java13
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java13
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutorTest.java6
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutorTest.java8
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutorTest.java6
6 files changed, 32 insertions, 23 deletions
diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java
index 3636d811a..c3c585664 100644
--- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutor.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.plugins.executor.jython;
import java.util.Map;
+import java.util.Properties;
+
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.executor.StateFinalizerExecutor;
import org.onap.policy.apex.core.engine.executor.exception.StateMachineException;
@@ -78,18 +80,19 @@ public class JythonStateFinalizerExecutor extends StateFinalizerExecutor {
*
* @param executionId the execution ID for the current APEX policy execution
* @param incomingFields the incoming fields for finalisation
+ * @param executionProperties properties for the current APEX policy execution
* @return The state output for the state
* @throws StateMachineException on an execution error
* @throws ContextException on context errors
*/
@Override
- public String execute(final long executionId, final Map<String, Object> incomingFields)
- throws StateMachineException, ContextException {
+ public String execute(final long executionId, final Properties executionProperties,
+ final Map<String, Object> incomingFields) throws StateMachineException, ContextException {
boolean returnValue = false;
// Do execution pre work
- executePre(executionId, incomingFields);
+ executePre(executionId, executionProperties, incomingFields);
try {
diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java
index 1280fb85d..974749032 100644
--- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.plugins.executor.jython;
import java.util.Map;
+import java.util.Properties;
+
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.executor.TaskExecutor;
import org.onap.policy.apex.core.engine.executor.exception.StateMachineException;
@@ -34,8 +36,8 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * The Class JythonTaskExecutor is the task executor for task logic written in Jython It is unlikely
- * that this is thread safe.
+ * The Class JythonTaskExecutor is the task executor for task logic written in Jython It is unlikely that this is thread
+ * safe.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -77,19 +79,20 @@ public class JythonTaskExecutor extends TaskExecutor {
* Executes the executor for the task in a sequential manner.
*
* @param executionId the execution ID for the current APEX policy execution
+ * @param executionProperties properties for the current APEX policy execution
* @param incomingFields the incoming fields
* @return The outgoing fields
* @throws StateMachineException on an execution error
* @throws ContextException on context errors
*/
@Override
- public Map<String, Object> execute(final long executionId, final Map<String, Object> incomingFields)
- throws StateMachineException, ContextException {
+ public Map<String, Object> execute(final long executionId, final Properties executionProperties,
+ final Map<String, Object> incomingFields) throws StateMachineException, ContextException {
boolean returnValue = false;
// Do execution pre work
- executePre(executionId, incomingFields);
+ executePre(executionId, executionProperties, incomingFields);
try {
diff --git a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java
index d6e6dd70b..f8ca21b1a 100644
--- a/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java
@@ -20,6 +20,8 @@
package org.onap.policy.apex.plugins.executor.jython;
+import java.util.Properties;
+
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.event.EnEvent;
import org.onap.policy.apex.core.engine.executor.TaskSelectExecutor;
@@ -35,8 +37,8 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * The Class JythonTaskSelectExecutor is the task selection executor for task selection logic
- * written in Jython It is unlikely that this is thread safe.
+ * The Class JythonTaskSelectExecutor is the task selection executor for task selection logic written in Jython It is
+ * unlikely that this is thread safe.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -82,19 +84,20 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor {
* Executes the executor for the task in a sequential manner.
*
* @param executionId the execution ID for the current APEX policy execution
+ * @param executionProperties properties for the current APEX policy execution
* @param incomingEvent the incoming event
* @return The outgoing event
* @throws StateMachineException on an execution error
* @throws ContextException on context errors
*/
@Override
- public AxArtifactKey execute(final long executionId, final EnEvent incomingEvent)
- throws StateMachineException, ContextException {
+ public AxArtifactKey execute(final long executionId, final Properties executionProperties,
+ final EnEvent incomingEvent) throws StateMachineException, ContextException {
boolean returnValue = false;
// Do execution pre work
- executePre(executionId, incomingEvent);
+ executePre(executionId, executionProperties, incomingEvent);
try {
// Check and execute the Jython logic
diff --git a/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutorTest.java b/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutorTest.java
index 76e35e8cc..213dddb9b 100644
--- a/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutorTest.java
@@ -130,7 +130,7 @@ public class JythonStateFinalizerExecutorTest {
stateFinalizerLogic.setLogic(scriptSource);
try {
jsfe.prepare();
- jsfe.execute(-1, null);
+ jsfe.execute(-1, null, null);
fail("test should throw an exception here");
} catch (Exception jtseException) {
assertEquals(
@@ -151,7 +151,7 @@ public class JythonStateFinalizerExecutorTest {
AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
EnEvent event = new EnEvent(axEvent);
try {
- jsfe.execute(0, event);
+ jsfe.execute(0, null, event);
} catch (Exception jtseException) {
jtseException.printStackTrace();
fail("test should not throw an exception here");
@@ -159,7 +159,7 @@ public class JythonStateFinalizerExecutorTest {
try {
jsfe.prepare();
- String stateOutput = jsfe.execute(0, event);
+ String stateOutput = jsfe.execute(0, null, event);
assertEquals("SelectedOutputIsMe", stateOutput);
jsfe.cleanUp();
} catch (Exception jtseException) {
diff --git a/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutorTest.java b/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutorTest.java
index aec7470fa..47e98f391 100644
--- a/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutorTest.java
@@ -103,7 +103,7 @@ public class JythonTaskExecutorTest {
}
try {
- jte.execute(-1, null);
+ jte.execute(-1, null, null);
fail("test should throw an exception here");
} catch (Exception jteException) {
assertEquals(java.lang.NullPointerException.class, jteException.getClass());
@@ -111,7 +111,7 @@ public class JythonTaskExecutorTest {
Map<String, Object> incomingParameters = new HashMap<>();
try {
- jte.execute(-1, incomingParameters);
+ jte.execute(-1, null, incomingParameters);
fail("test should throw an exception here");
} catch (Exception jteException) {
assertEquals("failed to execute Jython code for task NULL:0.0.0", jteException.getMessage());
@@ -124,7 +124,7 @@ public class JythonTaskExecutorTest {
try {
jte.prepare();
- Map<String, Object> returnMap = jte.execute(-1, incomingParameters);
+ Map<String, Object> returnMap = jte.execute(-1, null, incomingParameters);
assertEquals(0, returnMap.size());
jte.cleanUp();
fail("test should throw an exception here");
@@ -136,7 +136,7 @@ public class JythonTaskExecutorTest {
task.getTaskLogic().setLogic(scriptSource);
try {
jte.prepare();
- Map<String, Object> returnMap = jte.execute(0, incomingParameters);
+ Map<String, Object> returnMap = jte.execute(0, null, incomingParameters);
assertEquals(0, returnMap.size());
jte.cleanUp();
} catch (Exception jteException) {
diff --git a/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutorTest.java
index 7874b2315..119f4d035 100644
--- a/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutorTest.java
@@ -99,7 +99,7 @@ public class JythonTaskSelectExecutorTest {
state.getTaskSelectionLogic().setLogic(scriptSource);
try {
jtse.prepare();
- jtse.execute(-1, null);
+ jtse.execute(-1, null, null);
fail("test should throw an exception here");
} catch (Exception jtseException) {
assertEquals(java.lang.NullPointerException.class, jtseException.getClass());
@@ -109,7 +109,7 @@ public class JythonTaskSelectExecutorTest {
EnEvent event = new EnEvent(axEvent);
try {
jtse.prepare();
- jtse.execute(-1, event);
+ jtse.execute(-1, null, event);
fail("test should throw an exception here");
} catch (Exception jtseException) {
assertEquals("failed to execute Jython code for task selection logic in NULL:0.0.0:NULL:NULL",
@@ -120,7 +120,7 @@ public class JythonTaskSelectExecutorTest {
state.getTaskSelectionLogic().setLogic(scriptSource);
try {
jtse.prepare();
- jtse.execute(-1, event);
+ jtse.execute(-1, null, event);
jtse.cleanUp();
} catch (Exception jtseException) {
fail("test should not throw an exception here");