From 6bf1aa0b408e0e4201d9002ca5c13095b98e7e46 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Tue, 10 Jul 2018 11:52:12 +0100 Subject: Adding executor integration tests Change-Id: I292315164fbfb3650f6d21ede6edb264a7fd8ee3 Issue-ID: POLICY-865 Signed-off-by: waqas.ikram --- .../apex/plugins/executor/jython/JythonTaskExecutor.java | 10 ++++++---- .../apex/plugins/executor/jython/JythonTaskSelectExecutor.java | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'plugins/plugins-executor/plugins-executor-jython') 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 b0dd9c5c9..71dce5801 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 @@ -26,6 +26,7 @@ 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; import org.python.core.CompileMode; +import org.python.core.CompilerFlags; import org.python.core.Py; import org.python.core.PyCode; import org.python.core.PyException; @@ -34,8 +35,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) */ @@ -61,8 +62,9 @@ public class JythonTaskExecutor extends TaskExecutor { super.prepare(); try { synchronized (Py.class) { - compiled = Py.compile_flags(getSubject().getTaskLogic().getLogic(), - "<" + getSubject().getKey().toString() + ">", CompileMode.exec, null); + final String logic = getSubject().getTaskLogic().getLogic(); + final String filename = "<" + getSubject().getKey().toString() + ">"; + compiled = Py.compile_flags(logic, filename, CompileMode.exec, new CompilerFlags()); } } catch (final PyException e) { LOGGER.warn("failed to compile Jython code for task " + getSubject().getKey().getID(), e); 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 4fd48f2e7..d28001d87 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 @@ -26,6 +26,7 @@ import org.onap.policy.apex.core.engine.executor.TaskSelectExecutor; import org.onap.policy.apex.core.engine.executor.exception.StateMachineException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.python.core.CompileMode; +import org.python.core.CompilerFlags; import org.python.core.Py; import org.python.core.PyCode; import org.python.core.PyException; @@ -34,8 +35,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) */ @@ -60,8 +61,9 @@ public class JythonTaskSelectExecutor extends TaskSelectExecutor { super.prepare(); try { synchronized (Py.class) { - compiled = Py.compile_flags(getSubject().getTaskSelectionLogic().getLogic(), - "<" + getSubject().getKey().toString() + ">", CompileMode.exec, null); + final String logic = getSubject().getTaskSelectionLogic().getLogic(); + final String filename = "<" + getSubject().getKey().toString() + ">"; + compiled = Py.compile_flags(logic, filename, CompileMode.exec, new CompilerFlags()); } } catch (final PyException e) { LOGGER.warn("failed to compile Jython code for task selection logic in " + getSubject().getKey().getID(), -- cgit 1.2.3-korg