diff options
69 files changed, 1424 insertions, 167 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java index 95ea6b5d2..9a5acbf3e 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java @@ -82,7 +82,7 @@ public class EnEvent extends HashMap<String, Object> { // Event related properties used during processing of this event @Getter @Setter - private Properties executionProperties; + private Properties executionProperties = new Properties(); // A string holding a message that indicates why processing of this event threw an exception @Getter diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java index e3a64eb30..698a1d837 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java @@ -26,6 +26,8 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentOfClass import java.util.Map; import java.util.Properties; +import lombok.NonNull; + import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.ExecutorParameters; import org.onap.policy.apex.core.engine.context.ApexInternalContext; @@ -115,7 +117,7 @@ public abstract class StateFinalizerExecutor * {@inheritDoc}. */ @Override - public final void executePre(final long executionId, final Properties executionProperties, + public final void executePre(final long executionId, @NonNull final Properties executionProperties, final Map<String, Object> newIncomingFields) throws StateMachineException, ContextException { LOGGER.debug("execute-pre:" + finalizerLogic.getLogicFlavour() + "," + getSubject().getId() + "," + finalizerLogic.getLogic()); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java index 15fee6efa..ab81a8490 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java @@ -30,6 +30,8 @@ import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; +import lombok.NonNull; + import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.ExecutorParameters; import org.onap.policy.apex.core.engine.context.ApexInternalContext; @@ -116,7 +118,7 @@ public abstract class TaskExecutor * {@inheritDoc}. */ @Override - public final void executePre(final long executionId, final Properties executionProperties, + public final void executePre(final long executionId, @NonNull final Properties executionProperties, final Map<String, Object> newIncomingFields) throws StateMachineException, ContextException { LOGGER.debug("execute-pre:" + getSubject().getTaskLogic().getLogicFlavour() + "," + getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogic()); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java index 097bc98b5..d99d6b005 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java @@ -25,6 +25,8 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentNotNull import java.util.Properties; +import lombok.NonNull; + import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.ExecutorParameters; import org.onap.policy.apex.core.engine.context.ApexInternalContext; @@ -108,7 +110,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact * {@inheritDoc}. */ @Override - public final void executePre(final long executionId, final Properties executionProperties, + public final void executePre(final long executionId, @NonNull final Properties executionProperties, final EnEvent newIncomingEvent) throws StateMachineException { LOGGER.debug("execute-pre:" + axState.getKey().getId() + "," + axState.getTaskSelectionLogic().getLogicFlavour() + "," + axState.getTaskSelectionLogic().getLogic()); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java index 5efd47e53..e27c62f9a 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java @@ -27,6 +27,9 @@ import java.util.Properties; import java.util.Set; import java.util.TreeMap; +import lombok.Getter; +import lombok.Setter; + import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.ContextRuntimeException; import org.onap.policy.apex.core.engine.context.ApexInternalContext; @@ -60,9 +63,6 @@ public class StateFinalizerExecutionContext { /** the execution ID for the current APEX policy execution instance. */ public final Long executionId; - /** the execution properties the current APEX policy execution instance. */ - public final Properties executionProperties; - /** * The list of state outputs for this state finalizer. The purpose of a state finalizer is to select a state output * for a state from this list of state output names. @@ -76,9 +76,6 @@ public class StateFinalizerExecutionContext { */ public final Map<String, Object> fields; - // A message specified in the logic - private String message; - /** * The state output that the state finalizer logic has selected for a state. The state finalizer logic sets this * field in its logic after executing and the Apex engine uses this state output for this state. @@ -95,6 +92,15 @@ public class StateFinalizerExecutionContext { // All available context albums private final Map<String, ContextAlbum> context; + // A message specified in the logic + @Getter + @Setter + private String message; + + // Execution properties for a policy execution + @Getter + private Properties executionProperties; + /** * Instantiates a new state finalizer execution context. * @@ -179,22 +185,4 @@ public class StateFinalizerExecutionContext { public void setSelectedStateOutputName(final String selectedStateOutputName) { this.selectedStateOutputName = selectedStateOutputName; } - - /** - * Gets the user message. - * - * @return the user message - */ - public String getMessage() { - return message; - } - - /** - * Sets the user message. - * - * @param message the message - */ - public void setMessage(final String message) { - this.message = message; - } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java index 6fb55a3e7..b322cf402 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java @@ -27,6 +27,9 @@ import java.util.Map; import java.util.Properties; import java.util.TreeMap; +import lombok.Getter; +import lombok.Setter; + import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.ContextRuntimeException; import org.onap.policy.apex.core.engine.context.ApexInternalContext; @@ -66,9 +69,6 @@ public class TaskExecutionContext { /** the execution ID for the current APEX policy execution instance. */ public final Long executionId; - /** the execution properties the current APEX policy execution instance. */ - public final Properties executionProperties; - /** * The incoming fields from the trigger event for the task. The task logic can access these fields when executing * its logic. @@ -95,8 +95,14 @@ public class TaskExecutionContext { private final List<AxConcept> usedArtifactStack; // A message specified in the logic + @Getter + @Setter private String message; + // Execution properties for a policy execution + @Getter + private Properties executionProperties; + /** * Instantiates a new task execution context. * @@ -163,22 +169,4 @@ public class TaskExecutionContext { + "\" on task \"" + subject.getId() + "\""); } } - - /** - * Get the user message. - * - * @return the user message - */ - public String getMessage() { - return message; - } - - /** - * Sets the user message. - * - * @param message the message - */ - public void setMessage(final String message) { - this.message = message; - } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java index 10d21a76f..8d83e7645 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java @@ -26,6 +26,9 @@ import java.util.Map; import java.util.Properties; import java.util.TreeMap; +import lombok.Getter; +import lombok.Setter; + import org.onap.policy.apex.context.ContextAlbum; import org.onap.policy.apex.context.ContextRuntimeException; import org.onap.policy.apex.core.engine.context.ApexInternalContext; @@ -66,9 +69,6 @@ public class TaskSelectionExecutionContext { /** the execution ID for the current APEX policy execution instance. */ public final Long executionId; - /** the execution properties the current APEX policy execution instance. */ - public final Properties executionProperties; - /** * The incoming fields from the trigger event for the state. The task selection logic can access * these fields to decide what task to select for the state. @@ -94,8 +94,14 @@ public class TaskSelectionExecutionContext { private final Map<String, ContextAlbum> context; // A message specified in the logic + @Getter + @Setter private String message; + // Execution properties for a policy execution + @Getter + private Properties executionProperties; + /** * Instantiates a new task selection execution context. * @@ -170,22 +176,4 @@ public class TaskSelectionExecutionContext { + "\" on state \"" + subject.getId() + "\""); } } - - /** - * Gets the user message. - * - * @return the user message - */ - public String getMessage() { - return message; - } - - /** - * Sets the user message. - * - * @param message the message - */ - public void setMessage(final String message) { - this.message = message; - } } diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java index a94fe9e80..6fb28bca8 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.util.Map; +import java.util.Properties; import org.junit.Before; import org.junit.Test; @@ -117,19 +118,25 @@ public class StateFinalizerExecutorTest { } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception ex) { assertEquals("task input fields \"[InField0]\" are missing for task \"Task0:0.0.1\"", ex.getMessage()); } try { executor.executePre(0, null, incomingEvent); + } catch (Exception ex) { + assertEquals("executionProperties is marked @NonNull but is null", ex.getMessage()); + } + + try { + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception e) { fail("test should not throw an exception"); } try { - executor.execute(0, null, incomingEvent); + executor.execute(0, new Properties(), incomingEvent); fail("test should throw an exception"); } catch (Exception ex) { assertEquals("execute() not implemented on abstract StateFinalizerExecutionContext class, " @@ -154,7 +161,7 @@ public class StateFinalizerExecutorTest { } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception ex) { fail("test should not throw an exception"); } @@ -168,7 +175,7 @@ public class StateFinalizerExecutorTest { } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception ex) { fail("test should not throw an exception"); } @@ -184,7 +191,7 @@ public class StateFinalizerExecutorTest { } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception ex) { fail("test should not throw an exception"); } diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java index a4a0f21ec..eb2d11177 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.fail; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Properties; import org.junit.Before; import org.junit.Test; @@ -158,24 +159,32 @@ public class TaskExecutorTest { Map<String, Object> incomingFields = new LinkedHashMap<>(); try { - executor.executePre(0, null, incomingFields); + executor.executePre(0, new Properties(), incomingFields); } catch (Exception ex) { assertEquals("task input fields \"[InField0]\" are missing for task \"Task0:0.0.1\"", ex.getMessage()); } incomingFields.put("InField0", "A Value"); try { - executor.executePre(0, null, incomingFields); + executor.executePre(0, new Properties(), incomingFields); } catch (Exception e) { fail("test should not throw an exception"); } try { - executor.execute(0, null, incomingFields); + executor.execute(0, new Properties(), incomingFields); + fail("test should throw an exception"); + } catch (Exception ex) { + assertEquals("execute() not implemented on abstract TaskExecutor class, only on its subclasses", + ex.getMessage()); + } + + try { + executor.execute(0, new Properties(), incomingFields); fail("test should throw an exception"); } catch (Exception ex) { assertEquals("execute() not implemented on abstract TaskExecutor class, only on its subclasses", - ex.getMessage()); + ex.getMessage()); } try { @@ -183,7 +192,7 @@ public class TaskExecutorTest { fail("test should throw an exception"); } catch (Exception ex) { assertEquals("execute-post: task logic execution failure on task \"Task0\" in model Context:0.0.1", - ex.getMessage()); + ex.getMessage()); } executor.getExecutionContext().setMessage("Execution message"); @@ -192,7 +201,7 @@ public class TaskExecutorTest { fail("test should throw an exception"); } catch (Exception ex) { assertEquals("execute-post: task logic execution failure on task \"Task0\" in model Context:0.0.1, " - + "user message: Execution message", ex.getMessage()); + + "user message: Execution message", ex.getMessage()); } try { @@ -216,7 +225,7 @@ public class TaskExecutorTest { fail("test should throw an exception"); } catch (Exception ex) { assertEquals("task output fields \"[BadExtraField]\" are unwanted for task \"Task0:0.0.1\"", - ex.getMessage()); + ex.getMessage()); } executor.getExecutionContext().outFields.remove("BadExtraField"); @@ -247,5 +256,12 @@ public class TaskExecutorTest { } catch (Exception ex) { fail("test should not throw an exception"); } + + try { + executor.executePre(0, null, incomingFields); + fail("test should throw an exception"); + } catch (Exception ex) { + assertEquals("executionProperties is marked @NonNull but is null", ex.getMessage()); + } } } diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java index 2ee308977..8e907e12a 100644 --- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java +++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java @@ -25,6 +25,7 @@ import static org.junit.Assert.fail; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Properties; import org.junit.Before; import org.junit.Test; @@ -127,19 +128,19 @@ public class TaskSelectExecutorTest { } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception ex) { assertEquals("task input fields \"[InField0]\" are missing for task \"Task0:0.0.1\"", ex.getMessage()); } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception e) { fail("test should not throw an exception"); } try { - executor.execute(0, null, incomingEvent); + executor.execute(0, new Properties(), incomingEvent); fail("test should throw an exception"); } catch (Exception ex) { assertEquals("execute() not implemented on class", ex.getMessage()); @@ -150,7 +151,7 @@ public class TaskSelectExecutorTest { fail("test should throw an exception"); } catch (Exception ex) { assertEquals("execute-post: task selection logic failed on state \"State0Parent:0.0.1:Parent:State0\"", - ex.getMessage()); + ex.getMessage()); } executor.getExecutionContext().setMessage("Execution message"); @@ -159,11 +160,11 @@ public class TaskSelectExecutorTest { fail("test should throw an exception"); } catch (Exception ex) { assertEquals("execute-post: task selection logic failed on state \"State0Parent:0.0.1:Parent:State0\", " - + "user message: Execution message", ex.getMessage()); + + "user message: Execution message", ex.getMessage()); } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception e) { fail("test should not throw an exception"); } @@ -176,7 +177,7 @@ public class TaskSelectExecutorTest { } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception e) { fail("test should not throw an exception"); } @@ -187,11 +188,11 @@ public class TaskSelectExecutorTest { fail("test should throw an exception"); } catch (Exception ex) { assertEquals("task \"IDontExist:0.0.0\" returned by task selection logic not defined " - + "on state \"State0Parent:0.0.1:Parent:State0\"", ex.getMessage()); + + "on state \"State0Parent:0.0.1:Parent:State0\"", ex.getMessage()); } try { - executor.executePre(0, null, incomingEvent); + executor.executePre(0, new Properties(), incomingEvent); } catch (Exception e) { fail("test should not throw an exception"); } @@ -204,5 +205,12 @@ public class TaskSelectExecutorTest { } catch (Exception e) { fail("test should not throw an exception"); } + + try { + executor.executePre(0, null, incomingEvent); + fail("test should throw an exception"); + } catch (Exception ex) { + assertEquals("executionProperties is marked @NonNull but is null", ex.getMessage()); + } } } diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java index 1b9a5a5c7..f957e7ec3 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java @@ -81,12 +81,12 @@ public class MfpUseCaseTest { @BeforeClass public static void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); @@ -98,7 +98,7 @@ public class MfpUseCaseTest { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + engineParameters = new EngineParameters(); engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); engineParameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters()); @@ -111,7 +111,7 @@ public class MfpUseCaseTest { @AfterClass public static void afterTest() { ParameterService.deregister(engineParameters); - + ParameterService.deregister(contextParameters.getDistributorParameters()); ParameterService.deregister(contextParameters.getLockManagerParameters()); ParameterService.deregister(contextParameters.getPersistorParameters()); 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) { diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java index b820ee3fd..7828960b4 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java @@ -124,7 +124,7 @@ public class ApexEvent extends HashMap<String, Object> implements Serializable { private long executionId = ApexEvent.getNextExecutionId(); // Event related properties used during processing of this event - private Properties executionProperties; + private Properties executionProperties = new Properties(); // A string holding a message that indicates why processing of this event threw an exception private String exceptionMessage; diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java index bd0753d02..14486614c 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.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========================================================= */ @@ -84,8 +84,8 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter { final ApexEvent apexEvent = new ApexEvent(axEvent.getKey().getName(), axEvent.getKey().getVersion(), axEvent.getNameSpace(), axEvent.getSource(), axEvent.getTarget()); - // Copy the ExecutionID from the EnEvent into the ApexEvent apexEvent.setExecutionId(enEvent.getExecutionId()); + apexEvent.setExecutionProperties(enEvent.getExecutionProperties()); // Copy he exception message to the Apex event if it is set if (enEvent.getExceptionMessage() != null) { @@ -126,8 +126,8 @@ public final class ApexEvent2EnEventConverter implements ApexEventConverter { // Set the data on the engine event enEvent.putAll(apexEvent); - // copy the ExecutionID from the ApexEvent into the EnEvent enEvent.setExecutionId(apexEvent.getExecutionId()); + enEvent.setExecutionProperties(apexEvent.getExecutionProperties()); return enEvent; } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java index da945209b..4581b179c 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.service.engine.event.impl.eventrequestor; import java.util.EnumMap; import java.util.Map; +import java.util.Properties; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; @@ -177,7 +178,7 @@ public class EventRequestorConsumer implements ApexEventConsumer, Runnable { } // Send the event into Apex - eventReceiver.receiveEvent(null, eventObject); + eventReceiver.receiveEvent(new Properties(), eventObject); eventsReceived++; } catch (final InterruptedException e) { diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/ApexFileEventConsumer.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/ApexFileEventConsumer.java index e99663c9e..7366528c7 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/ApexFileEventConsumer.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/ApexFileEventConsumer.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.EnumMap; import java.util.Map; +import java.util.Properties; import java.util.concurrent.atomic.AtomicLong; import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; @@ -195,7 +196,7 @@ public class ApexFileEventConsumer implements ApexEventConsumer, Runnable { // Process the event from the text block if there is one there if (textBlock.getText() != null) { - eventReceiver.receiveEvent(getNextExecutionId(), null, textBlock.getText()); + eventReceiver.receiveEvent(getNextExecutionId(), new Properties(), textBlock.getText()); } } while (!textBlock.isEndOfText()); diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java index f03b58ca2..8708e97e6 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java @@ -27,6 +27,8 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import lombok.NonNull; + import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; @@ -182,7 +184,8 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { * {@inheritDoc}. */ @Override - public void receiveEvent(final Properties executionProperties, final Object event) throws ApexEventException { + public void receiveEvent(@NonNull final Properties executionProperties, final Object event) + throws ApexEventException { receiveEvent(0, executionProperties, event, true); } @@ -190,7 +193,7 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable { * {@inheritDoc}. */ @Override - public void receiveEvent(final long executionId, final Properties executionProperties, final Object event) + public void receiveEvent(final long executionId, @NonNull final Properties executionProperties, final Object event) throws ApexEventException { receiveEvent(executionId, executionProperties, event, false); } diff --git a/testsuites/integration/integration-uservice-test/pom.xml b/testsuites/integration/integration-uservice-test/pom.xml index 135911754..cb2d658db 100644 --- a/testsuites/integration/integration-uservice-test/pom.xml +++ b/testsuites/integration/integration-uservice-test/pom.xml @@ -18,7 +18,8 @@ ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId> @@ -138,7 +139,7 @@ <artifactId>kafka_2.12</artifactId> <version>${version.kafka}</version> <scope>test</scope> - <exclusions> + <exclusions> <!-- The default Zookeeper version in Kafka has vulnerabilities --> <exclusion> <groupId>org.apache.zookeeper</groupId> @@ -183,6 +184,13 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <version>3.0.0</version> + <scope>test</scope> + </dependency> + + <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet-core</artifactId> <version>${version.jersey}</version> @@ -236,7 +244,7 @@ </build> <profiles> - <profile> + <profile> <id>only-eclipse</id> <activation> <property> diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java new file mode 100644 index 000000000..e5a88a365 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +package org.onap.policy.apex.testsuites.integration.uservice.executionproperties; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.EnumMap; +import java.util.Map; +import java.util.Properties; + +import org.onap.policy.apex.service.engine.event.ApexEventConsumer; +import org.onap.policy.apex.service.engine.event.ApexEventException; +import org.onap.policy.apex.service.engine.event.ApexEventReceiver; +import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; +import org.onap.policy.apex.service.engine.event.PeeredReference; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Dummy Apex event consumer for testing event properties. + * + * @author Liam Fallon (liam.fallon@est.tech) + */ +public class DummyApexEventConsumer implements ApexEventConsumer { + // Get a reference to the logger + private static final Logger LOGGER = LoggerFactory.getLogger(DummyApexEventConsumer.class); + + // The event receiver that will receive events from this consumer + private ApexEventReceiver eventReceiver; + + // The name for this consumer + private String name = null; + + // The peer references for this event handler + private Map<EventHandlerPeeredMode, PeeredReference> peerReferenceMap = new EnumMap<>(EventHandlerPeeredMode.class); + + private DummyCarrierTechnologyParameters dummyConsumerProperties = null; + + @Override + public void init(final String consumerName, final EventHandlerParameters consumerParameters, + final ApexEventReceiver incomingEventReceiver) throws ApexEventException { + this.eventReceiver = incomingEventReceiver; + this.name = consumerName; + + + // Check and get the properties + if (!(consumerParameters.getCarrierTechnologyParameters() instanceof DummyCarrierTechnologyParameters)) { + String message = "specified consumer properties of type \"" + + consumerParameters.getCarrierTechnologyParameters().getClass().getCanonicalName() + + "\" are not applicable to a dummy consumer"; + LOGGER.warn(message); + throw new ApexEventException(message); + } + + dummyConsumerProperties = + (DummyCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters(); + } + + @Override + public void start() { + new Thread(new RunTestEventSender()).start(); + } + + /** + * {@inheritDoc}. + */ + @Override + public String getName() { + return name; + } + + /** + * {@inheritDoc}. + */ + @Override + public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { + return peerReferenceMap.get(peeredMode); + } + + /** + * {@inheritDoc}. + */ + @Override + public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) { + peerReferenceMap.put(peeredMode, peeredReference); + } + + @Override + public void stop() {} + + private class RunTestEventSender implements Runnable { + @Override + public void run() { + Properties executionProperties = new Properties(); + try { + executionProperties.load(new FileInputStream(new File(dummyConsumerProperties.getPropertyFileName()))); + } catch (IOException e1) { + String message = "reading of executor properties for testing failed from file: " + + dummyConsumerProperties.getPropertyFileName(); + LOGGER.warn(message); + throw new ApexEventRuntimeException(message); + } + + RunTestEvent event = new RunTestEvent(); + event.setTestToRun(dummyConsumerProperties.getTestToRun()); + try { + eventReceiver.receiveEvent(executionProperties, event.toJson()); + } catch (Exception e) { + String message = "event processing for executor properties testing failed: " + e.getMessage(); + LOGGER.warn(message, e); + throw new ApexEventRuntimeException(message, e); + } + } + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java new file mode 100644 index 000000000..0c2ac32fa --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +package org.onap.policy.apex.testsuites.integration.uservice.executionproperties; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.EnumMap; +import java.util.Map; +import java.util.Properties; + +import org.onap.policy.apex.service.engine.event.ApexEventException; +import org.onap.policy.apex.service.engine.event.ApexEventProducer; +import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; +import org.onap.policy.apex.service.engine.event.PeeredReference; +import org.onap.policy.apex.service.engine.event.SynchronousEventCache; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; +import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; +import org.onap.policy.common.utils.coder.CoderException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Dummy Apex event producer for testing event properties. + * + * @author Liam Fallon (liam.fallon@est.tech) + */ +public class DummyApexEventProducer implements ApexEventProducer { + // Get a reference to the logger + private static final Logger LOGGER = LoggerFactory.getLogger(DummyApexEventProducer.class); + + // The parameters read from the parameter service + private DummyCarrierTechnologyParameters dummyProducerProperties; + + // The name for this producer + private String name = null; + + // The peer references for this event handler + private Map<EventHandlerPeeredMode, PeeredReference> peerReferenceMap = new EnumMap<>(EventHandlerPeeredMode.class); + + @Override + public void init(final String producerName, final EventHandlerParameters producerParameters) + throws ApexEventException { + this.name = producerName; + + // Check and get the Properties + if (!(producerParameters.getCarrierTechnologyParameters() instanceof DummyCarrierTechnologyParameters)) { + String message = "specified producer properties are not applicable to a dummy producer (" + this.name + ")"; + LOGGER.warn(message); + throw new ApexEventException(message); + } + dummyProducerProperties = + (DummyCarrierTechnologyParameters) producerParameters.getCarrierTechnologyParameters(); + + new File(dummyProducerProperties.getPropertyFileName()).delete(); + } + + /** + * {@inheritDoc}. + */ + @Override + public String getName() { + return name; + } + + /** + * {@inheritDoc}. + */ + @Override + public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { + return peerReferenceMap.get(peeredMode); + } + + /** + * {@inheritDoc}. + */ + @Override + public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) { + peerReferenceMap.put(peeredMode, peeredReference); + } + + /** + * {@inheritDoc}. + */ + @Override + public void sendEvent(final long executionId, final Properties executionProperties, final String eventName, + final Object eventAsJsonString) { + // Check if this is a synchronized event, if so we have received a reply + final SynchronousEventCache synchronousEventCache = + (SynchronousEventCache) peerReferenceMap.get(EventHandlerPeeredMode.SYNCHRONOUS); + if (synchronousEventCache != null) { + synchronousEventCache.removeCachedEventToApexIfExists(executionId); + } + + RunTestEvent testEvent = new RunTestEvent(); + try { + testEvent.fromJson((String) eventAsJsonString); + } catch (CoderException ce) { + String message = "could not decode event from JSON"; + LOGGER.warn(message, ce); + throw new ApexEventRuntimeException(message, ce); + } + if (!dummyProducerProperties.getTestToRun().equals(testEvent.getTestToRun())) { + String message = "tests in received test event and parameters do not match " + testEvent.getTestToRun() + + ":" + dummyProducerProperties.getTestToRun(); + LOGGER.warn(message); + throw new ApexEventRuntimeException(message); + } + + + try { + executionProperties.store(new FileOutputStream(new File(dummyProducerProperties.getPropertyFileName())), + ""); + } catch (IOException ioe) { + String message = "writing of executor properties for testing failed from file: " + + dummyProducerProperties.getPropertyFileName(); + LOGGER.warn(message, ioe); + throw new ApexEventRuntimeException(message, ioe); + } + } + + /** + * {@inheritDoc}. + */ + @Override + public void stop() {} +} diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java new file mode 100644 index 000000000..08d78daaf --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +package org.onap.policy.apex.testsuites.integration.uservice.executionproperties; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import org.apache.commons.lang3.StringUtils; +import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters; +import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationStatus; + +/** + * Dummy carrier technology parameters. + * + * <p>The parameters for this plugin are: + * <ol> + * <li>testToRun: The name of the test to run. + * </ol> + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class DummyCarrierTechnologyParameters extends CarrierTechnologyParameters { + + /** The label of this carrier technology. */ + public static final String DUMMY_CARRIER_TECHNOLOGY_LABEL = "DUMMY"; + + /** The producer plugin class for the dummy carrier technology. */ + public static final String DUMMY_EVENT_PRODUCER_PLUGIN_CLASS = DummyApexEventProducer.class.getName(); + + /** The consumer plugin class for the dummy carrier technology. */ + public static final String DUMMY_EVENT_CONSUMER_PLUGIN_CLASS = DummyApexEventConsumer.class.getName(); + + private String testToRun = null; + private String propertyFileName = null; + + /** + * Constructor to create a dummy carrier technology parameters instance and register the instance with the parameter + * service. + */ + public DummyCarrierTechnologyParameters() { + super(); + + // Set the carrier technology properties for the web socket carrier technology + this.setLabel(DUMMY_CARRIER_TECHNOLOGY_LABEL); + this.setEventProducerPluginClass(DUMMY_EVENT_PRODUCER_PLUGIN_CLASS); + this.setEventConsumerPluginClass(DUMMY_EVENT_CONSUMER_PLUGIN_CLASS); + + } + + /** + * {@inheritDoc}. + */ + @Override + public GroupValidationResult validate() { + final GroupValidationResult result = super.validate(); + + if (StringUtils.isEmpty(testToRun)) { + result.setResult("testToRun", ValidationStatus.INVALID, + "no test has been specified on the dummy carrier technology plugin"); + } + + if (StringUtils.isEmpty(propertyFileName)) { + result.setResult("propertyFileName", ValidationStatus.INVALID, + "no propertyFileName has been specified on the dummy carrier technology plugin"); + } + + return result; + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/RunTestEvent.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/RunTestEvent.java new file mode 100644 index 000000000..f740468ab --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/RunTestEvent.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +package org.onap.policy.apex.testsuites.integration.uservice.executionproperties; + +import lombok.Data; + +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.utils.coder.StandardCoder; + +/** + * Test event fgor execution properties. + * + * @author Liam Fallon (liam.fallon@est.tech) + */ +@Data +public class RunTestEvent { + private String testToRun; + private String propertyFileName; + + public String toJson() throws CoderException { + return new StandardCoder().encode(this); + } + + /** + * Set fields of this event from a JSON string. + * + * @param jsonString the JSON string + * @throws CoderException on JSON exceptions + */ + public void fromJson(final String jsonString) throws CoderException { + RunTestEvent jsonTestEvent = new StandardCoder().decode(jsonString, RunTestEvent.class); + this.testToRun = jsonTestEvent.testToRun; + this.propertyFileName = jsonTestEvent.propertyFileName; + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java new file mode 100644 index 000000000..9327748b8 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java @@ -0,0 +1,140 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +package org.onap.policy.apex.testsuites.integration.uservice.executionproperties; + +import static org.awaitility.Awaitility.await; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileInputStream; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain; +import org.onap.policy.apex.service.engine.main.ApexMain; + +/** + * This class runs integration tests for execution properties. + */ +public class TestExecutionProperties { + /** + * Compile the policy. + */ + @BeforeClass + public static void compilePolicy() { + // @formatter:off + final String[] cliArgs = { + "-c", + "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesTestPolicyModel.apex", + "-l", + "target/ExecutionPropertiesTestPolicyModel.log", + "-o", + "target/ExecutionPropertiesTestPolicyModel.json" + }; + // @formatter:on + + new ApexCommandLineEditorMain(cliArgs); + } + + /** + * Clear relative file root environment variable. + */ + @Before + public void clearRelativeFileRoot() { + System.clearProperty("APEX_RELATIVE_FILE_ROOT"); + } + + /** + * Test read only execution properties are returned from policy. + */ + @Test + public void testReadOnly() throws Exception { + testExecutionProperties("readOnly"); + } + + /** + * Test where execution properties set in task. + */ + @Test + public void testEmptyToDefined() throws Exception { + testExecutionProperties("emptyToDefined"); + } + + /** + * Test where execution properties cleared in task. + */ + @Test + public void testDefinedToEmpty() throws Exception { + testExecutionProperties("definedToEmpty"); + } + + /** + * Test where an execution properties added in task. + */ + @Test + public void testAddProperty() throws Exception { + testExecutionProperties("addProperty"); + } + + /** + * Test empty properties are transferred correctly. + */ + @Test + public void testEmptyToEmpty() throws Exception { + testExecutionProperties("emptyToEmpty"); + } + + private void testExecutionProperties(final String testName) throws Exception { + File compiledPolicyFile = new File("target/ExecutionPropertiesTestPolicyModel.json"); + assertTrue(compiledPolicyFile.exists()); + + new File("target/" + testName + "_out.properties").delete(); + + // @formatter:off + final String[] args = { + "-rfr", + "target", + "-c", + "src/test/resources/testdata/executionproperties/" + testName + "_conf.json" + }; + // @formatter:on + final ApexMain apexMain = new ApexMain(args); + + // TODO: Set back to 10 seconds + await().atMost(10000, TimeUnit.SECONDS) + .until(() -> new File("target/" + testName + "_out.properties").exists()); + + apexMain.shutdown(); + + Properties expectedProperties = new Properties(); + expectedProperties.load(new FileInputStream( + new File("src/test/resources/testdata/executionproperties/" + testName + "_out_expected.properties"))); + + Properties actualProperties = new Properties(); + actualProperties.load(new FileInputStream(new File("target/" + testName + "_out.properties"))); + + assertEquals(expectedProperties, actualProperties); + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js new file mode 100644 index 000000000..af0db4e3e --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); + +var executionProperties = new java.util.Properties(); + +executor.getExecutionProperties().setProperty("goodbye", "mars"); + +executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); + +var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js new file mode 100644 index 000000000..dce37cc3e --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); + +var executionProperties = new java.util.Properties(); + +executor.getExecutionProperties().clear(); + +executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); + +var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js new file mode 100644 index 000000000..090b7a00c --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); + +var executionProperties = new java.util.Properties(); + +executor.getExecutionProperties().setProperty("hello", "world"); + +executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); + +var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js new file mode 100644 index 000000000..62af4e97b --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +executor.logger.info("executionProperties:" + executor.getExecutionProperties()); + +var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js new file mode 100644 index 000000000..62af4e97b --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +executor.logger.info("executionProperties:" + executor.getExecutionProperties()); + +var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js new file mode 100644 index 000000000..f08b718e4 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); + +var executionProperties = new java.util.Properties(); + +executor.getExecutionProperties().remove("hello"); + +executor.logger.info("executionProperties out:" + executor.getExecutionProperties()); + +var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js new file mode 100644 index 000000000..b527fc1f1 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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========================================================= + */ + +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var returnValue = executor.isTrue; + +executor.logger.info("executionProperties:" + executor.getExecutionProperties()); + +switch (executor.inFields.get("testToRun")) { + case "ReadOnly": + executor.subject.getTaskKey("ReadOnlyTask").copyTo(executor.selectedTask); + break; + + case "EmptyToEmpty": + executor.subject.getTaskKey("EmptyToEmptyTask").copyTo(executor.selectedTask); + break; + + case "EmptyToDefined": + executor.subject.getTaskKey("EmptyToDefinedTask").copyTo(executor.selectedTask); + break; + + case "DefinedToEmpty": + executor.subject.getTaskKey("DefinedToEmptyTask").copyTo(executor.selectedTask); + break; + + case "RemoveProperty": + executor.subject.getTaskKey("RemovePropertyTask").copyTo(executor.selectedTask); + break; + + case "AddProperty": + executor.subject.getTaskKey("AddPropertyTask").copyTo(executor.selectedTask); + break; + + default: + executor.subject.getTaskKey("ReadOnlyTask").copyTo(executor.selectedTask); +} + +executor.logger.info("Selected Task:" + executor.selectedTask); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesTestPolicyModel.apex b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesTestPolicyModel.apex new file mode 100644 index 000000000..83af487e5 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesTestPolicyModel.apex @@ -0,0 +1,99 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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========================================================= +#------------------------------------------------------------------------------- + +model create name=ExecutionPropertiesTestPolicyModel + +schema create name=SimpleStringType flavour=Java schema=java.lang.String +schema create name=SimpleIntegerType flavour=Java schema=java.lang.Integer + +event create name=RunTestEvent nameSpace=org.onap.policy.apex.domains.test source=JUNIT target=apex +event parameter create name=RunTestEvent parName=testToRun schemaName=SimpleStringType + +task create name=ReadOnlyTask + +task inputfield create name=ReadOnlyTask fieldName=testToRun schemaName=SimpleStringType +task outputfield create name=ReadOnlyTask fieldName=testToRun schemaName=SimpleStringType + +task logic create name=ReadOnlyTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js" +LE + +task create name=EmptyToEmptyTask + +task inputfield create name=EmptyToEmptyTask fieldName=testToRun schemaName=SimpleStringType +task outputfield create name=EmptyToEmptyTask fieldName=testToRun schemaName=SimpleStringType + +task logic create name=EmptyToEmptyTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js" +LE + +task create name=EmptyToDefinedTask + +task inputfield create name=EmptyToDefinedTask fieldName=testToRun schemaName=SimpleStringType +task outputfield create name=EmptyToDefinedTask fieldName=testToRun schemaName=SimpleStringType + +task logic create name=EmptyToDefinedTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js" +LE + +task create name=DefinedToEmptyTask + +task inputfield create name=DefinedToEmptyTask fieldName=testToRun schemaName=SimpleStringType +task outputfield create name=DefinedToEmptyTask fieldName=testToRun schemaName=SimpleStringType + +task logic create name=DefinedToEmptyTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js" +LE + +task create name=AddPropertyTask + +task inputfield create name=AddPropertyTask fieldName=testToRun schemaName=SimpleStringType +task outputfield create name=AddPropertyTask fieldName=testToRun schemaName=SimpleStringType + +task logic create name=AddPropertyTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/test/resources/policies/executionproperties/logic/AddPropertyTask.js" +LE + +task create name=RemovePropertyTask + +task inputfield create name=RemovePropertyTask fieldName=testToRun schemaName=SimpleStringType +task outputfield create name=RemovePropertyTask fieldName=testToRun schemaName=SimpleStringType + +task logic create name=RemovePropertyTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js" +LE + +policy create name=ExecutionPropertiesTestPolicy template=freestyle firstState=RunTestState + +policy state create name=ExecutionPropertiesTestPolicy stateName=RunTestState triggerName=RunTestEvent defaultTaskName=ReadOnlyTask +policy state output create name=ExecutionPropertiesTestPolicy stateName=RunTestState outputName=TestFinalOutput eventName=RunTestEvent +policy state taskref create name=ExecutionPropertiesTestPolicy stateName=RunTestState taskName=ReadOnlyTask outputType=DIRECT outputName=TestFinalOutput +policy state taskref create name=ExecutionPropertiesTestPolicy stateName=RunTestState taskName=EmptyToEmptyTask outputType=DIRECT outputName=TestFinalOutput +policy state taskref create name=ExecutionPropertiesTestPolicy stateName=RunTestState taskName=EmptyToDefinedTask outputType=DIRECT outputName=TestFinalOutput +policy state taskref create name=ExecutionPropertiesTestPolicy stateName=RunTestState taskName=DefinedToEmptyTask outputType=DIRECT outputName=TestFinalOutput +policy state taskref create name=ExecutionPropertiesTestPolicy stateName=RunTestState taskName=AddPropertyTask outputType=DIRECT outputName=TestFinalOutput +policy state taskref create name=ExecutionPropertiesTestPolicy stateName=RunTestState taskName=RemovePropertyTask outputType=DIRECT outputName=TestFinalOutput + +policy state selecttasklogic create name=ExecutionPropertiesTestPolicy stateName=RunTestState logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js" +LE + +validate + diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_conf.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_conf.json new file mode 100644 index 000000000..22d1c5b27 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_conf.json @@ -0,0 +1,48 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "ExecutionPropertiesTestPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "AddProperty", + "propertyFileName": "src/test/resources/testdata/executionproperties/addProperty_in.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "RunTestEvent" + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "AddProperty", + "propertyFileName": "target/addProperty_out.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_in.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_in.properties new file mode 100644 index 000000000..80abd320c --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_in.properties @@ -0,0 +1 @@ +hello=world
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_out_expected.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_out_expected.properties new file mode 100644 index 000000000..a5680d37b --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_out_expected.properties @@ -0,0 +1,2 @@ +hello=world +goodbye=mars
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_conf.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_conf.json new file mode 100644 index 000000000..ec96b5cc4 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_conf.json @@ -0,0 +1,48 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "ExecutionPropertiesTestPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "DefinedToEmpty", + "propertyFileName": "src/test/resources/testdata/executionproperties/definedToEmpty_in.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "RunTestEvent" + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "DefinedToEmpty", + "propertyFileName": "target/definedToEmpty_out.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_in.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_in.properties new file mode 100644 index 000000000..80abd320c --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_in.properties @@ -0,0 +1 @@ +hello=world
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_out_expected.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_out_expected.properties new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_out_expected.properties diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_conf.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_conf.json new file mode 100644 index 000000000..a2ad6037a --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_conf.json @@ -0,0 +1,48 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "ExecutionPropertiesTestPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "EmptyToDefined", + "propertyFileName": "src/test/resources/testdata/executionproperties/emptyToDefined_in.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "RunTestEvent" + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "EmptyToDefined", + "propertyFileName": "target/emptyToDefined_out.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_in.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_in.properties new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_in.properties diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_out_expected.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_out_expected.properties new file mode 100644 index 000000000..80abd320c --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_out_expected.properties @@ -0,0 +1 @@ +hello=world
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_conf.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_conf.json new file mode 100644 index 000000000..e5d6d8373 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_conf.json @@ -0,0 +1,48 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "ExecutionPropertiesTestPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "EmptyToEmpty", + "propertyFileName": "src/test/resources/testdata/executionproperties/emptyToEmpty_in.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "RunTestEvent" + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "EmptyToEmpty", + "propertyFileName": "target/emptyToEmpty_out.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_in.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_in.properties new file mode 100644 index 000000000..fe3a0735d --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_in.properties @@ -0,0 +1 @@ +NULL
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_out_expected.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_out_expected.properties new file mode 100644 index 000000000..fe3a0735d --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_out_expected.properties @@ -0,0 +1 @@ +NULL
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_conf.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_conf.json new file mode 100644 index 000000000..723d04450 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_conf.json @@ -0,0 +1,48 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "ExecutionPropertiesTestPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "ReadOnly", + "propertyFileName": "src/test/resources/testdata/executionproperties/readOnly_in.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "RunTestEvent" + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "ReadOnly", + "propertyFileName": "target/readOnly_out.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_in.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_in.properties new file mode 100644 index 000000000..80abd320c --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_in.properties @@ -0,0 +1 @@ +hello=world
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_out_expected.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_out_expected.properties new file mode 100644 index 000000000..80abd320c --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_out_expected.properties @@ -0,0 +1 @@ +hello=world
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_conf.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_conf.json new file mode 100644 index 000000000..fb4db38fc --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_conf.json @@ -0,0 +1,48 @@ +{ + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "policyModelFileName": "ExecutionPropertiesTestPolicyModel.json", + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + } + } + }, + "eventInputParameters": { + "FirstConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "RemoveProperty", + "propertyFileName": "src/test/resources/testdata/executionproperties/removeProperty_in.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "RunTestEvent" + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "DUMMY", + "parameterClassName": "org.onap.policy.apex.testsuites.integration.uservice.executionproperties.DummyCarrierTechnologyParameters", + "parameters": { + "testToRun": "RemoveProperty", + "propertyFileName": "target/removeProperty_out.properties" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + } +} diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_in.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_in.properties new file mode 100644 index 000000000..a5680d37b --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_in.properties @@ -0,0 +1,2 @@ +hello=world +goodbye=mars
\ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_out_expected.properties b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_out_expected.properties new file mode 100644 index 000000000..9f7fe9821 --- /dev/null +++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_out_expected.properties @@ -0,0 +1 @@ +goodbye=mars
\ No newline at end of file |