summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-executor/plugins-executor-jython
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-07-10 11:52:12 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-07-10 13:49:59 +0100
commit6bf1aa0b408e0e4201d9002ca5c13095b98e7e46 (patch)
treed626d687d8e797ac62f4e366866e807ba1321b90 /plugins/plugins-executor/plugins-executor-jython
parent678fa2fdf50d1d6b97ef3dea1bdaf6302d3839f4 (diff)
Adding executor integration tests
Change-Id: I292315164fbfb3650f6d21ede6edb264a7fd8ee3 Issue-ID: POLICY-865 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'plugins/plugins-executor/plugins-executor-jython')
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutor.java10
-rw-r--r--plugins/plugins-executor/plugins-executor-jython/src/main/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutor.java10
2 files changed, 12 insertions, 8 deletions
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(),