From ce9d82d2c0e863597d84cc8909955e398405f45a Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 26 Jun 2019 15:40:41 +0000 Subject: Add passthrough properties for APEX engine APEX event receiver and sender plugins sometimes need to exchange information with tasks, especially in the case of REST communication. This change enables passthrough of Properties from the event carrier technology plugins to APEX task, task selection, and state finalizer logics. Apologies for the size of the review but this change involves passinng the properties through all the APEX components, hence the large number of small changes. Issue-ID: POLICY-1742 Change-Id: I219fd69550f06702ef64adbb165fe7baac422e96 Signed-off-by: liamfallon --- .../javascript/JavascriptStateFinalizerExecutorTest.java | 6 +++--- .../executor/javascript/JavascriptTaskExecutorTest.java | 10 +++++----- .../executor/javascript/JavascriptTaskSelectExecutorTest.java | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/plugins-executor/plugins-executor-javascript/src/test/java') 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 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 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 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 returnMap = jte.execute(0, incomingParameters); + Map 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) { -- cgit 1.2.3-korg