diff options
author | liamfallon <liam.fallon@est.tech> | 2019-07-10 19:44:39 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-07-10 19:44:39 +0000 |
commit | adf67497761295115dc75b525500d687518fc4fd (patch) | |
tree | c5c5b5e737ac08256e9f782b5dccbd3ddc08d3c3 /plugins | |
parent | 5c384fb2888029c2babb859c30318749e1ce828c (diff) |
Add integration tests for executor properties
Added integration test that sets properties in a dummy plugin and amends
them in tasks in a policy. Variosu tests added to check combinations of
where properties are set in plugins or in tasks or both.
Implementaiton changed to:
- Always pass in a Properies object, the properties object coming into
the policy cannot be null because the task/TSL/SFL may wish to set it
- Fix a bug where the properties were not passed from the ApexEvent to
the engine event in the ApexEventUnmarshaller class
Issue-ID: POLICY-1743
Change-Id: I6aa152b28d46cf3cc6fa56a1a95b76a8e55f5a49
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'plugins')
21 files changed, 92 insertions, 59 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java index eb0357220..d23e52f5e 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java @@ -23,6 +23,7 @@ package org.onap.policy.apex.plugins.event.carrier.jms; import java.util.EnumMap; import java.util.Map; +import java.util.Properties; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -232,7 +233,7 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn jmsMessage.getJMSType()); } - eventReceiver.receiveEvent(null, jmsMessage); + eventReceiver.receiveEvent(new Properties(), jmsMessage); } catch (final Exception e) { final String errorMessage = "failed to receive message from JMS"; LOGGER.warn(errorMessage, e); diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java index 8df8e6117..787ac4ef5 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.kafka; import java.util.EnumMap; import java.util.Map; +import java.util.Properties; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; @@ -151,7 +152,7 @@ public class ApexKafkaConsumer implements ApexEventConsumer, Runnable { kafkaConsumer.poll(kafkaConsumerProperties.getConsumerPollDuration().toMillis()); for (final ConsumerRecord<String, String> record : records) { traceIfTraceEnabled(record); - eventReceiver.receiveEvent(null, record.value()); + eventReceiver.receiveEvent(new Properties(), record.value()); } } catch (final Exception e) { LOGGER.warn("error receiving events on thread {}", consumerThread.getName(), e); diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java index ed501687b..49ca1e309 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.restclient; import java.util.EnumMap; import java.util.Map; +import java.util.Properties; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @@ -207,7 +208,7 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable { } // Send the event into Apex - eventReceiver.receiveEvent(null, eventJsonString); + eventReceiver.receiveEvent(new Properties(), eventJsonString); } catch (final Exception e) { LOGGER.warn("error receiving events on thread {}", consumerThread.getName(), e); } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java index 776440232..cd74e183a 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java @@ -27,6 +27,7 @@ import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Properties; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; @@ -353,7 +354,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { } // Send the event into Apex - eventReceiver.receiveEvent(request.getExecutionId(), null, eventJsonString); + eventReceiver.receiveEvent(request.getExecutionId(), new Properties(), eventJsonString); synchronized (eventsReceivedLock) { eventsReceived++; diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java index 9cb7f765c..a8c508659 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java @@ -23,6 +23,7 @@ package org.onap.policy.apex.plugins.event.carrier.restserver; import java.net.URI; import java.util.EnumMap; import java.util.Map; +import java.util.Properties; import java.util.concurrent.atomic.AtomicLong; import javax.ws.rs.core.Response; @@ -195,7 +196,7 @@ public class ApexRestServerConsumer implements ApexEventConsumer, Runnable { try { // Send the event into Apex - eventReceiver.receiveEvent(executionId, null, event); + eventReceiver.receiveEvent(executionId, new Properties(), event); } catch (final Exception e) { final String errorMessage = "error receiving events on event consumer " + name + ", " + e.getMessage(); LOGGER.warn(errorMessage, e); diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java index 87a88714e..3cf44806a 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.event.carrier.websocket; import java.util.EnumMap; import java.util.Map; +import java.util.Properties; import org.onap.policy.apex.core.infrastructure.messaging.MessagingException; import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient; @@ -165,7 +166,7 @@ public class ApexWebSocketConsumer implements ApexEventConsumer, WsStringMessage @Override public void receiveString(final String eventString) { try { - eventReceiver.receiveEvent(null, eventString); + eventReceiver.receiveEvent(new Properties(), eventString); eventsRead++; } catch (final Exception e) { final String errorMessage = "Error sending event " + name + '_' + eventsRead + ", " + e.getMessage() 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 f779a3005..db716e3c7 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 @@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -120,7 +122,7 @@ public class JavaStateFinalizerExecutorTest { } try { - jsfe.execute(-1, null, null); + jsfe.execute(-1, new Properties(), 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 +132,7 @@ public class JavaStateFinalizerExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - jsfe.execute(-1, null, event); + jsfe.execute(-1, new Properties(), 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 +142,7 @@ public class JavaStateFinalizerExecutorTest { stateFinalizerLogic.setLogic("org.onap.policy.apex.plugins.executor.java.DummyJavaStateFinalizerLogic"); try { jsfe.prepare(); - jsfe.execute(-1, null, event); + jsfe.execute(-1, new Properties(), 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 +152,7 @@ public class JavaStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null); try { jsfe.prepare(); - String stateOutput = jsfe.execute(0, null, event); + String stateOutput = jsfe.execute(0, new Properties(), 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 fb5bc4f55..72ff6bba1 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 @@ -26,6 +26,7 @@ import static org.junit.Assert.fail; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import org.junit.After; import org.junit.Before; @@ -102,7 +103,7 @@ public class JavaTaskExecutorTest { } try { - jte.execute(-1, null, null); + jte.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception jteException) { assertEquals(java.lang.NullPointerException.class, jteException.getClass()); @@ -110,7 +111,7 @@ public class JavaTaskExecutorTest { Map<String, Object> incomingParameters = new HashMap<>(); try { - jte.execute(-1, null, incomingParameters); + jte.execute(-1, new Properties(), 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 +120,7 @@ public class JavaTaskExecutorTest { task.getTaskLogic().setLogic("org.onap.policy.apex.plugins.executor.java.DummyJavaTaskLogic"); try { jte.prepare(); - jte.execute(-1, null, incomingParameters); + jte.execute(-1, new Properties(), 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 +129,7 @@ public class JavaTaskExecutorTest { try { jte.prepare(); - Map<String, Object> returnMap = jte.execute(0, null, incomingParameters); + Map<String, Object> returnMap = jte.execute(0, new Properties(), 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 27eac53d3..88b9fece3 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 @@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -102,7 +104,7 @@ public class JavaTaskSelectExecutorTest { } try { - jtse.execute(-1, null, null); + jtse.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals(java.lang.NullPointerException.class, jtseException.getClass()); @@ -111,7 +113,7 @@ public class JavaTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - jtse.execute(-1, null, event); + jtse.execute(-1, new Properties(), 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 +124,7 @@ public class JavaTaskSelectExecutorTest { .setLogic("org.onap.policy.apex.plugins.executor.java.DummyJavaTaskSelectionLogic"); try { jtse.prepare(); - jtse.execute(-1, null, event); + jtse.execute(-1, new Properties(), 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 +133,7 @@ public class JavaTaskSelectExecutorTest { try { jtse.prepare(); - AxArtifactKey taskKey = jtse.execute(0, null, event); + AxArtifactKey taskKey = jtse.execute(0, new Properties(), event); assertEquals("NULL:0.0.0", taskKey.getId()); jtse.cleanUp(); } catch (Exception jtseException) { 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 d42ad6cb9..724c70bd2 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 @@ -26,6 +26,8 @@ import static org.junit.Assert.fail; import java.util.HashMap; import java.util.Map; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -117,7 +119,7 @@ public class JavascriptStateFinalizerExecutorTest { Map<String, Object> incomingParameters1 = new HashMap<>(); try { - jsfe.execute(-1, null, incomingParameters1); + jsfe.execute(-1, new Properties(), 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 +143,7 @@ public class JavascriptStateFinalizerExecutorTest { + "var returnValue = new returnValueType(true);}"); try { jsfe.prepare(); - jsfe.execute(-1, null, event); + jsfe.execute(-1, new Properties(), event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals( @@ -153,7 +155,7 @@ public class JavascriptStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null); try { jsfe.prepare(); - String stateOutput = jsfe.execute(0, null, event); + String stateOutput = jsfe.execute(0, new Properties(), 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 20e758fae..fed293921 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 @@ -26,6 +26,8 @@ import static org.junit.Assert.fail; import java.util.HashMap; import java.util.Map; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -95,7 +97,7 @@ public class JavascriptTaskExecutorTest { Map<String, Object> incomingParameters2 = new HashMap<>(); try { - jte.execute(-1, null, incomingParameters2); + jte.execute(-1, new Properties(), 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 +112,7 @@ public class JavascriptTaskExecutorTest { } try { - jte.execute(-1, null, null); + jte.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception jteException) { assertEquals(java.lang.NullPointerException.class, jteException.getClass()); @@ -118,7 +120,7 @@ public class JavascriptTaskExecutorTest { Map<String, Object> incomingParameters = new HashMap<>(); try { - jte.execute(-1, null, incomingParameters); + jte.execute(-1, new Properties(), 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 +131,7 @@ public class JavascriptTaskExecutorTest { + "var returnValue = new returnValueType(false); "); try { jte.prepare(); - jte.execute(-1, null, incomingParameters); + jte.execute(-1, new Properties(), 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 +142,7 @@ public class JavascriptTaskExecutorTest { + "var returnValue = new returnValueType(true); "); try { jte.prepare(); - Map<String, Object> returnMap = jte.execute(0, null, incomingParameters); + Map<String, Object> returnMap = jte.execute(0, new Properties(), 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 8efbc6241..9a705020c 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 @@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -98,7 +100,7 @@ public class JavascriptTaskSelectExecutorTest { AxEvent axEvent1 = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event1 = new EnEvent(axEvent1); try { - jtse.execute(-1, null, event1); + jtse.execute(-1, new Properties(), event1); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals( @@ -115,7 +117,7 @@ public class JavascriptTaskSelectExecutorTest { } try { - jtse.execute(-1, null, null); + jtse.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals(java.lang.NullPointerException.class, jtseException.getClass()); @@ -124,7 +126,7 @@ public class JavascriptTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - jtse.execute(-1, null, event); + jtse.execute(-1, new Properties(), event); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals( @@ -136,7 +138,7 @@ public class JavascriptTaskSelectExecutorTest { + "var returnValue = new returnValueType(false); "); try { jtse.prepare(); - jtse.execute(-1, null, event); + jtse.execute(-1, new Properties(), 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 +149,7 @@ public class JavascriptTaskSelectExecutorTest { + "var returnValue = new returnValueType(true); "); try { jtse.prepare(); - AxArtifactKey taskKey = jtse.execute(0, null, event); + AxArtifactKey taskKey = jtse.execute(0, new Properties(), event); assertEquals("NULL:0.0.0", taskKey.getId()); jtse.cleanUp(); } catch (Exception jtseException) { 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 635430fa1..af34e434d 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 @@ -25,6 +25,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail;
import java.lang.reflect.Field;
+import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -113,7 +115,7 @@ public class JrubyStateFinalizerExecutorTest { }
try {
- jsfe.execute(-1, null, null);
+ jsfe.execute(-1, new Properties(), 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 +132,7 @@ public class JrubyStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null);
try {
jsfe.prepare();
- String stateOutput = jsfe.execute(0, null, event);
+ String stateOutput = jsfe.execute(0, new Properties(), 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 9f83459d8..8b58c38d8 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 @@ -27,6 +27,8 @@ import static org.junit.Assert.fail; import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -95,7 +97,7 @@ public class JrubyTaskExecutorTest { Map<String, Object> incomingParameters = new HashMap<>();
try {
- jte.execute(-1, null, incomingParameters);
+ jte.execute(-1, new Properties(), 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 +110,7 @@ public class JrubyTaskExecutorTest { try {
jte.prepare();
- Map<String, Object> returnMap = jte.execute(0, null, incomingParameters);
+ Map<String, Object> returnMap = jte.execute(0, new Properties(), 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 683c43cb4..def5e1a7f 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 @@ -25,6 +25,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail;
import java.lang.reflect.Field;
+import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -99,7 +101,7 @@ public class JrubyTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));
EnEvent event = new EnEvent(axEvent);
try {
- jtse.execute(-1, null, event);
+ jtse.execute(-1, new Properties(), 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 +114,7 @@ public class JrubyTaskSelectExecutorTest { try {
jtse.prepare();
- AxArtifactKey taskKey = jtse.execute(0, null, event);
+ AxArtifactKey taskKey = jtse.execute(0, new Properties(), event);
assertEquals("NULL:0.0.0", taskKey.getId());
jtse.cleanUp();
} catch (Exception jtseException) {
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 213dddb9b..69ced72ad 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 @@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.util.Map; +import java.util.Properties; import java.util.TreeMap; import org.junit.After; import org.junit.Before; @@ -130,7 +131,7 @@ public class JythonStateFinalizerExecutorTest { stateFinalizerLogic.setLogic(scriptSource); try { jsfe.prepare(); - jsfe.execute(-1, null, null); + jsfe.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals( @@ -151,7 +152,7 @@ public class JythonStateFinalizerExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - jsfe.execute(0, null, event); + jsfe.execute(0, new Properties(), event); } catch (Exception jtseException) { jtseException.printStackTrace(); fail("test should not throw an exception here"); @@ -159,7 +160,7 @@ public class JythonStateFinalizerExecutorTest { try { jsfe.prepare(); - String stateOutput = jsfe.execute(0, null, event); + String stateOutput = jsfe.execute(0, new Properties(), 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 47e98f391..ee116aa37 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 @@ -26,6 +26,8 @@ import static org.junit.Assert.fail; import java.util.HashMap; import java.util.Map; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -103,7 +105,7 @@ public class JythonTaskExecutorTest { } try { - jte.execute(-1, null, null); + jte.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception jteException) { assertEquals(java.lang.NullPointerException.class, jteException.getClass()); @@ -111,7 +113,7 @@ public class JythonTaskExecutorTest { Map<String, Object> incomingParameters = new HashMap<>(); try { - jte.execute(-1, null, incomingParameters); + jte.execute(-1, new Properties(), 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 +126,7 @@ public class JythonTaskExecutorTest { try { jte.prepare(); - Map<String, Object> returnMap = jte.execute(-1, null, incomingParameters); + Map<String, Object> returnMap = jte.execute(-1, new Properties(), incomingParameters); assertEquals(0, returnMap.size()); jte.cleanUp(); fail("test should throw an exception here"); @@ -136,7 +138,7 @@ public class JythonTaskExecutorTest { task.getTaskLogic().setLogic(scriptSource); try { jte.prepare(); - Map<String, Object> returnMap = jte.execute(0, null, incomingParameters); + Map<String, Object> returnMap = jte.execute(0, new Properties(), 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 119f4d035..fb7735a46 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 @@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -99,7 +101,7 @@ public class JythonTaskSelectExecutorTest { state.getTaskSelectionLogic().setLogic(scriptSource); try { jtse.prepare(); - jtse.execute(-1, null, null); + jtse.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception jtseException) { assertEquals(java.lang.NullPointerException.class, jtseException.getClass()); @@ -109,7 +111,7 @@ public class JythonTaskSelectExecutorTest { EnEvent event = new EnEvent(axEvent); try { jtse.prepare(); - jtse.execute(-1, null, event); + jtse.execute(-1, new Properties(), 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 +122,7 @@ public class JythonTaskSelectExecutorTest { state.getTaskSelectionLogic().setLogic(scriptSource); try { jtse.prepare(); - jtse.execute(-1, null, event); + jtse.execute(-1, new Properties(), event); jtse.cleanUp(); } catch (Exception jtseException) { fail("test should not throw an exception here"); 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 5e66be30f..52d9a9a0a 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 @@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -126,7 +128,7 @@ public class MvelStateFinalizerExecutorTest { } try { - msfe.execute(-1, null, null); + msfe.execute(-1, new Properties(), 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 +138,7 @@ public class MvelStateFinalizerExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - msfe.execute(-1, null, event); + msfe.execute(-1, new Properties(), 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 +148,7 @@ public class MvelStateFinalizerExecutorTest { stateFinalizerLogic.setLogic("executionId !=-1"); try { msfe.prepare(); - msfe.execute(-1, null, event); + msfe.execute(-1, new Properties(), event); fail("test should throw an exception here"); } catch (Exception msfeException) { assertEquals( @@ -161,7 +163,7 @@ public class MvelStateFinalizerExecutorTest { state.getStateOutputs().put("SelectedOutputIsMe", null); try { msfe.prepare(); - String stateOutput = msfe.execute(0, null, event); + String stateOutput = msfe.execute(0, new Properties(), 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 18bccd670..d4f84da7a 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 @@ -26,6 +26,7 @@ import static org.junit.Assert.fail; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import org.junit.After; import org.junit.Before; @@ -103,7 +104,7 @@ public class MvelTaskExecutorTest { } try { - mte.execute(-1, null, null); + mte.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception mteException) { assertEquals(java.lang.NullPointerException.class, mteException.getClass()); @@ -111,7 +112,7 @@ public class MvelTaskExecutorTest { Map<String, Object> incomingParameters = new HashMap<>(); try { - mte.execute(-1, null, incomingParameters); + mte.execute(-1, new Properties(), 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 +121,7 @@ public class MvelTaskExecutorTest { task.getTaskLogic().setLogic("executionId != -1"); try { mte.prepare(); - mte.execute(-1, null, incomingParameters); + mte.execute(-1, new Properties(), 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 +130,7 @@ public class MvelTaskExecutorTest { try { mte.prepare(); - Map<String, Object> returnMap = mte.execute(0, null, incomingParameters); + Map<String, Object> returnMap = mte.execute(0, new Properties(), 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 05591b075..153eeca03 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 @@ -24,6 +24,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import java.util.Properties; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -103,7 +105,7 @@ public class MvelTaskSelectExecutorTest { } try { - mtse.execute(-1, null, null); + mtse.execute(-1, new Properties(), null); fail("test should throw an exception here"); } catch (Exception mtseException) { assertEquals(java.lang.NullPointerException.class, mtseException.getClass()); @@ -112,7 +114,7 @@ public class MvelTaskSelectExecutorTest { AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1")); EnEvent event = new EnEvent(axEvent); try { - mtse.execute(-1, null, event); + mtse.execute(-1, new Properties(), 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 +124,7 @@ public class MvelTaskSelectExecutorTest { state.getTaskSelectionLogic().setLogic("executionId != -1"); try { mtse.prepare(); - mtse.execute(-1, null, event); + mtse.execute(-1, new Properties(), 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 +133,7 @@ public class MvelTaskSelectExecutorTest { try { mtse.prepare(); - AxArtifactKey taskKey = mtse.execute(0, null, event); + AxArtifactKey taskKey = mtse.execute(0, new Properties(), event); assertEquals("NULL:0.0.0", taskKey.getId()); mtse.cleanUp(); } catch (Exception mtseException) { |