diff options
Diffstat (limited to 'plugins/plugins-executor')
30 files changed, 166 insertions, 130 deletions
diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java index ef0a8d178..ce242bafb 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.executor.java; import java.lang.reflect.Method; import java.util.Map; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.StateFinalizerExecutor; @@ -66,16 +67,17 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { * Executes the executor for the state finalizer logic 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 for finalisation * @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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the Java logic boolean returnValue = false; @@ -84,7 +86,7 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { // StateFinalizerExecutionContext executor) throws ApexException" // to invoke the // task logic in the Java class - final Method method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", (Class[]) + final Method method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", new Class[] { StateFinalizerExecutionContext.class }); returnValue = (boolean) method.invoke(stateFinalizerLogicObject, getExecutionContext()); } catch (final Exception e) { diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java index e9bf45305..1ceeba3b1 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.executor.java; import java.lang.reflect.Method; import java.util.Map; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.TaskExecutor; @@ -67,16 +68,17 @@ public class JavaTaskExecutor 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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the Java logic boolean returnValue = false; @@ -84,7 +86,7 @@ public class JavaTaskExecutor extends TaskExecutor { // Find and call the method with the signature "public boolean getEvent(final TaskExecutionContext executor) // throws ApexException" to invoke the // task logic in the Java class - final Method method = taskLogicObject.getClass().getDeclaredMethod("getEvent", (Class[]) + final Method method = taskLogicObject.getClass().getDeclaredMethod("getEvent", new Class[] { TaskExecutionContext.class }); returnValue = (boolean) method.invoke(taskLogicObject, getExecutionContext()); } catch (final Exception e) { diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java index 02794cdf6..17758b19e 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.plugins.executor.java; import java.lang.reflect.Method; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; @@ -58,10 +59,10 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { // Create the task logic object from the byte code of the class taskSelectionLogicObject = Class.forName(getSubject().getTaskSelectionLogic().getLogic()).newInstance(); } catch (final Exception e) { - LOGGER.error("instantiation error on Java class \"" + getSubject().getTaskSelectionLogic().getLogic() - + "\"", e); - throw new StateMachineException("instantiation error on Java class \"" - + getSubject().getTaskSelectionLogic().getLogic() + "\"", e); + LOGGER.error( + "instantiation error on Java class \"" + getSubject().getTaskSelectionLogic().getLogic() + "\"", e); + throw new StateMachineException( + "instantiation error on Java class \"" + getSubject().getTaskSelectionLogic().getLogic() + "\"", e); } } @@ -69,16 +70,17 @@ public class JavaTaskSelectExecutor 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 { // Do execution pre work - executePre(executionId, incomingEvent); + executePre(executionId, executionProperties, incomingEvent); // Check and execute the Java logic boolean returnValue = false; @@ -87,14 +89,14 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { // executor)" to invoke the task selection // logic in the Java class final Method method = taskSelectionLogicObject.getClass().getDeclaredMethod("getTask", - (Class[]) new Class[] { TaskSelectionExecutionContext.class }); + new Class[] { TaskSelectionExecutionContext.class }); returnValue = (boolean) method.invoke(taskSelectionLogicObject, getExecutionContext()); } catch (final Exception e) { - LOGGER.error("execute: task selection logic failed to run for state \"" + getSubject().getKey().getId() - + "\"", e); + LOGGER.error( + "execute: task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", + e); throw new StateMachineException( - "task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", - e); + "task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", e); } // Do the execution post work @@ -112,7 +114,7 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { @Override public void cleanUp() throws StateMachineException { LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," - + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," - + getSubject().getTaskSelectionLogic().getLogic()); + + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," + + getSubject().getTaskSelectionLogic().getLogic()); } } diff --git a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java index 6638e7183..f779a3005 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -120,7 +120,7 @@ public class JavaStateFinalizerExecutorTest { } try { - jsfe.execute(-1, null); + jsfe.execute(-1, null, null); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("state finalizer logic failed to run for state finalizer \"NULL:0.0.0:NULL:NULL\"", @@ -130,7 +130,7 @@ public class JavaStateFinalizerExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - jsfe.execute(-1, event); + jsfe.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("state finalizer logic failed to run for state finalizer \"NULL:0.0.0:NULL:NULL\"", @@ -140,7 +140,7 @@ public class JavaStateFinalizerExecutorTest { stateFinalizerLogic.setLogic("org.onap.policy.apex.plugins.executor.java.DummyJavaStateFinalizerLogic"); try { jsfe.prepare(); - jsfe.execute(-1, event); + jsfe.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("execute-post: state finalizer logic execution failure on state \"NULL:0.0.0:NULL:NULL\" " @@ -150,7 +150,7 @@ public class JavaStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null); 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-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java index f3ea1ce4d..fb5bc4f55 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -102,7 +102,7 @@ public class JavaTaskExecutorTest { } 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()); @@ -110,7 +110,7 @@ public class JavaTaskExecutorTest { 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("task logic failed to run for task \"NULL:0.0.0\"", jteException.getMessage()); @@ -119,7 +119,7 @@ public class JavaTaskExecutorTest { task.getTaskLogic().setLogic("org.onap.policy.apex.plugins.executor.java.DummyJavaTaskLogic"); try { jte.prepare(); - jte.execute(-1, incomingParameters); + jte.execute(-1, null, incomingParameters); fail("test should throw an exception here"); } catch (Exception jteException) { assertEquals("execute-post: task logic execution failure on task \"NULL\" in model NULL:0.0.0", @@ -128,7 +128,7 @@ public class JavaTaskExecutorTest { 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-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java index 64dfaea10..27eac53d3 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -102,7 +102,7 @@ public class JavaTaskSelectExecutorTest { } try { - 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()); @@ -111,7 +111,7 @@ public class JavaTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - jtse.execute(-1, event); + jtse.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("task selection logic failed to run for state \"NULL:0.0.0:NULL:NULL\"", @@ -122,7 +122,7 @@ public class JavaTaskSelectExecutorTest { .setLogic("org.onap.policy.apex.plugins.executor.java.DummyJavaTaskSelectionLogic"); try { jtse.prepare(); - jtse.execute(-1, event); + jtse.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("execute-post: task selection logic failed on state \"NULL:0.0.0:NULL:NULL\"", @@ -131,7 +131,7 @@ public class JavaTaskSelectExecutorTest { try { jtse.prepare(); - AxArtifactKey taskKey = jtse.execute(0, event); + AxArtifactKey taskKey = jtse.execute(0, null, event); assertEquals("NULL:0.0.0", taskKey.getId()); jtse.cleanUp(); } catch (Exception jtseException) { diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java index c906a9ca3..cd660c807 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutor.java @@ -22,6 +22,8 @@ package org.onap.policy.apex.plugins.executor.javascript; import java.util.Map; +import java.util.Properties; + import javax.script.Compilable; import javax.script.CompiledScript; import javax.script.ScriptEngine; @@ -34,8 +36,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * The Class JavascriptStateFinalizerExecutor is the state finalizer executor for state finalizer - * logic written in Javascript It is unlikely that this is thread safe. + * The Class JavascriptStateFinalizerExecutor is the state finalizer executor for state finalizer logic written in + * Javascript It is unlikely that this is thread safe. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -70,16 +72,17 @@ public class JavascriptStateFinalizerExecutor extends StateFinalizerExecutor { * Executes the executor for the state finalizer logic 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 for finalisation * @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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Set up the Javascript engine engine.put("executor", getExecutionContext()); diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java index 4b6ff0232..9769f42db 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutor.java @@ -22,6 +22,8 @@ package org.onap.policy.apex.plugins.executor.javascript; import java.util.Map; +import java.util.Properties; + import javax.script.Compilable; import javax.script.CompiledScript; import javax.script.ScriptEngine; @@ -34,8 +36,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * The Class JavascriptTaskExecutor is the task executor for task logic written in Javascript It is - * unlikely that this is thread safe. + * The Class JavascriptTaskExecutor is the task executor for task logic written in Javascript It is unlikely that this + * is thread safe. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -69,16 +71,17 @@ public class JavascriptTaskExecutor 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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Set up the Javascript engine engine.put("executor", getExecutionContext()); diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java index 305f3a2da..afc7d0183 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/main/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutor.java @@ -21,6 +21,8 @@ package org.onap.policy.apex.plugins.executor.javascript; +import java.util.Properties; + import javax.script.Compilable; import javax.script.CompiledScript; import javax.script.ScriptEngine; @@ -35,8 +37,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * The Class JavascriptTaskSelectExecutor is the task selection executor for task selection logic - * written in Javascript It is unlikely that this is thread safe. + * The Class JavascriptTaskSelectExecutor is the task selection executor for task selection logic written in Javascript + * It is unlikely that this is thread safe. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -76,16 +78,17 @@ public class JavascriptTaskSelectExecutor 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 { // Do execution pre work - executePre(executionId, incomingEvent); + executePre(executionId, executionProperties, incomingEvent); // Set up the Javascript engine engine.put("executor", getExecutionContext()); 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 4dd403e38..d42ad6cb9 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 @@ -117,7 +117,7 @@ public class JavascriptStateFinalizerExecutorTest { Map<String, Object> incomingParameters1 = new HashMap<>(); try { - jsfe.execute(-1, incomingParameters1); + jsfe.execute(-1, null, incomingParameters1); fail("test should throw an exception here"); } catch (Exception jteException) { assertEquals("state finalizer logic failed to run for state finalizer \"NULL:0.0.0:NULL:NULL\"", @@ -141,7 +141,7 @@ public class JavascriptStateFinalizerExecutorTest { + "var returnValue = new returnValueType(true);}"); try { jsfe.prepare(); - jsfe.execute(-1, event); + jsfe.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals( @@ -153,7 +153,7 @@ public class JavascriptStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null); 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-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutorTest.java b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutorTest.java index 50610b2e0..20e758fae 100644 --- a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutorTest.java @@ -95,7 +95,7 @@ public class JavascriptTaskExecutorTest { Map<String, Object> incomingParameters2 = new HashMap<>(); try { - jte.execute(-1, incomingParameters2); + jte.execute(-1, null, incomingParameters2); fail("test should throw an exception here"); } catch (Exception jteException) { assertEquals("task logic failed to run for task \"NULL:0.0.0\"", jteException.getMessage()); @@ -110,7 +110,7 @@ public class JavascriptTaskExecutorTest { } 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()); @@ -118,7 +118,7 @@ public class JavascriptTaskExecutorTest { 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("execute: task logic failed to set a return value for task \"NULL:0.0.0\"", @@ -129,7 +129,7 @@ public class JavascriptTaskExecutorTest { + "var returnValue = new returnValueType(false); "); try { jte.prepare(); - jte.execute(-1, incomingParameters); + jte.execute(-1, null, incomingParameters); fail("test should throw an exception here"); } catch (Exception jteException) { assertEquals("execute-post: task logic execution failure on task \"NULL\" in model NULL:0.0.0", @@ -140,7 +140,7 @@ public class JavascriptTaskExecutorTest { + "var returnValue = new returnValueType(true); "); 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-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 17c0be15f..8efbc6241 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 @@ -98,7 +98,7 @@ public class JavascriptTaskSelectExecutorTest { AxEvent axEvent1 = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event1 = new EnEvent(axEvent1); try { - jtse.execute(-1, event1); + jtse.execute(-1, null, event1); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals( @@ -115,7 +115,7 @@ public class JavascriptTaskSelectExecutorTest { } try { - 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()); @@ -124,7 +124,7 @@ public class JavascriptTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - jtse.execute(-1, event); + jtse.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals( @@ -136,7 +136,7 @@ public class JavascriptTaskSelectExecutorTest { + "var returnValue = new returnValueType(false); "); try { jtse.prepare(); - jtse.execute(-1, event); + jtse.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals("execute-post: task selection logic failed on state \"NULL:0.0.0:NULL:NULL\"", @@ -147,7 +147,7 @@ public class JavascriptTaskSelectExecutorTest { + "var returnValue = new returnValueType(true); "); try { jtse.prepare(); - AxArtifactKey taskKey = jtse.execute(0, event); + AxArtifactKey taskKey = jtse.execute(0, null, event); assertEquals("NULL:0.0.0", taskKey.getId()); jtse.cleanUp(); } catch (Exception jtseException) { diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java index 5c62cf8b0..d6e9f4d07 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.plugins.executor.jruby; import java.util.Map; +import java.util.Properties; import org.jruby.embed.EmbedEvalUnit; import org.jruby.embed.LocalContextScope; @@ -71,16 +72,17 @@ public class JrubyStateFinalizerExecutor extends StateFinalizerExecutor { * Executes the executor for the state finalizer logic 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 for finalisation * @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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the JRuby logic container.put("executor", getExecutionContext()); diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java index 8d2ccffe1..c805597e9 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.plugins.executor.jruby; import java.util.Map; +import java.util.Properties; import org.jruby.embed.EmbedEvalUnit; import org.jruby.embed.LocalContextScope; @@ -71,16 +72,17 @@ public class JrubyTaskExecutor 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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the JRuby logic container.put("executor", getExecutionContext()); diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java index 02ae0d8e4..274acbed1 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java @@ -20,6 +20,7 @@ package org.onap.policy.apex.plugins.executor.jruby; +import java.util.Properties; import java.util.Set; import java.util.TreeSet; @@ -72,16 +73,17 @@ public class JrubyTaskSelectExecutor 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 { // Do execution pre work - executePre(executionId, incomingEvent); + executePre(executionId, executionProperties, incomingEvent); // Check and execute the JRuby logic container.put("executor", getExecutionContext()); diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutorTest.java b/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutorTest.java index c49d502fa..635430fa1 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutorTest.java @@ -113,7 +113,7 @@ public class JrubyStateFinalizerExecutorTest { }
try {
- jsfe.execute(-1, null);
+ jsfe.execute(-1, null, null);
fail("test should throw an exception here");
} catch (Exception jtseException) {
assertEquals("execute-post: state finalizer logic execution failure on state \"NULL:0.0.0:NULL:NULL\" on "
@@ -130,7 +130,7 @@ public class JrubyStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null);
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-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutorTest.java b/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutorTest.java index 5fa9865c8..9f83459d8 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutorTest.java @@ -95,7 +95,7 @@ public class JrubyTaskExecutorTest { 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("execute-post: task logic execution failure on task \"NULL\" in model NULL:0.0.0",
@@ -108,7 +108,7 @@ public class JrubyTaskExecutorTest { 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-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutorTest.java b/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutorTest.java index 6320b59c6..683c43cb4 100644 --- a/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutorTest.java +++ b/plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutorTest.java @@ -99,7 +99,7 @@ public class JrubyTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
EnEvent event = new EnEvent(axEvent);
try {
- jtse.execute(-1, event);
+ jtse.execute(-1, null, event);
fail("test should throw an exception here");
} catch (Exception jtseException) {
assertEquals("execute-post: task selection logic failed on state \"NULL:0.0.0:NULL:NULL\"",
@@ -112,7 +112,7 @@ public class JrubyTaskSelectExecutorTest { try {
jtse.prepare();
- AxArtifactKey taskKey = jtse.execute(0, event);
+ AxArtifactKey taskKey = jtse.execute(0, null, event);
assertEquals("NULL:0.0.0", taskKey.getId());
jtse.cleanUp();
} catch (Exception jtseException) {
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"); diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java index 9b941a39a..ab62ca4bf 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java @@ -26,6 +26,7 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentNotNull import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import org.mvel2.MVEL; import org.onap.policy.apex.context.ContextException; @@ -70,16 +71,17 @@ public class MvelStateFinalizerExecutor extends StateFinalizerExecutor { * Executes the executor for the state finalizer logic 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 for finalisation * @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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the MVEL logic argumentNotNull(compiled, "MVEL state finalizer logic not compiled."); diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java index 69a53a26b..3fa753bec 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java @@ -26,6 +26,7 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentNotNull import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import org.mvel2.MVEL; import org.onap.policy.apex.context.ContextException; @@ -70,16 +71,17 @@ public class MvelTaskExecutor 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 { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the MVEL logic argumentNotNull(compiled, "MVEL task not compiled."); diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java index eefc50d0d..1ba79ceec 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java @@ -25,6 +25,7 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentNotNull import java.io.Serializable; import java.util.HashMap; +import java.util.Properties; import org.mvel2.MVEL; import org.onap.policy.apex.context.ContextException; @@ -71,16 +72,17 @@ public class MvelTaskSelectExecutor 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 { // Do execution pre work - executePre(executionId, incomingEvent); + executePre(executionId, executionProperties, incomingEvent); // Check and execute the MVEL logic argumentNotNull(compiled, "MVEL task not compiled."); 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 948dd31e2..5e66be30f 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 @@ -126,7 +126,7 @@ public class MvelStateFinalizerExecutorTest { } try { - msfe.execute(-1, null); + msfe.execute(-1, null, 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 +136,7 @@ public class MvelStateFinalizerExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - msfe.execute(-1, event); + msfe.execute(-1, null, 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 +146,7 @@ public class MvelStateFinalizerExecutorTest { stateFinalizerLogic.setLogic("executionId !=-1"); try { msfe.prepare(); - msfe.execute(-1, event); + msfe.execute(-1, null, event); fail("test should throw an exception here"); } catch (Exception msfeException) { assertEquals( @@ -161,7 +161,7 @@ public class MvelStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null); try { msfe.prepare(); - String stateOutput = msfe.execute(0, event); + String stateOutput = msfe.execute(0, null, 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 0759aac23..18bccd670 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 @@ -103,7 +103,7 @@ public class MvelTaskExecutorTest { } try { - mte.execute(-1, null); + mte.execute(-1, null, null); fail("test should throw an exception here"); } catch (Exception mteException) { assertEquals(java.lang.NullPointerException.class, mteException.getClass()); @@ -111,7 +111,7 @@ public class MvelTaskExecutorTest { Map<String, Object> incomingParameters = new HashMap<>(); try { - mte.execute(-1, incomingParameters); + mte.execute(-1, null, 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 +120,7 @@ public class MvelTaskExecutorTest { task.getTaskLogic().setLogic("executionId != -1"); try { mte.prepare(); - mte.execute(-1, incomingParameters); + mte.execute(-1, null, 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 +129,7 @@ public class MvelTaskExecutorTest { try { mte.prepare(); - Map<String, Object> returnMap = mte.execute(0, incomingParameters); + Map<String, Object> returnMap = mte.execute(0, null, 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 fd4857fa0..05591b075 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 @@ -103,7 +103,7 @@ public class MvelTaskSelectExecutorTest { } try { - mtse.execute(-1, null); + mtse.execute(-1, null, null); fail("test should throw an exception here"); } catch (Exception mtseException) { assertEquals(java.lang.NullPointerException.class, mtseException.getClass()); @@ -112,7 +112,7 @@ public class MvelTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - mtse.execute(-1, event); + mtse.execute(-1, null, 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 +122,7 @@ public class MvelTaskSelectExecutorTest { state.getTaskSelectionLogic().setLogic("executionId != -1"); try { mtse.prepare(); - mtse.execute(-1, event); + mtse.execute(-1, null, 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 +131,7 @@ public class MvelTaskSelectExecutorTest { try { mtse.prepare(); - AxArtifactKey taskKey = mtse.execute(0, event); + AxArtifactKey taskKey = mtse.execute(0, null, event); assertEquals("NULL:0.0.0", taskKey.getId()); mtse.cleanUp(); } catch (Exception mtseException) { |