Add integration tests for executor properties 58/91158/5
authorliamfallon <liam.fallon@est.tech>
Wed, 10 Jul 2019 19:44:39 +0000 (19:44 +0000)
committerliamfallon <liam.fallon@est.tech>
Wed, 10 Jul 2019 19:44:39 +0000 (19:44 +0000)
Added integration test that sets properties in a dummy plugin and amends
them in tasks in a policy. Variosu tests added to check combinations of
where properties are set in plugins or in tasks or both.

Implementaiton changed to:
- Always pass in a Properies object, the properties object coming into
  the policy cannot be null because the task/TSL/SFL may wish to set it
- Fix a bug where the properties were not passed from the ApexEvent to
  the engine event in the ApexEventUnmarshaller class

Issue-ID: POLICY-1743
Change-Id: I6aa152b28d46cf3cc6fa56a1a95b76a8e55f5a49
Signed-off-by: liamfallon <liam.fallon@est.tech>
69 files changed:
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java
core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java
core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java
core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java
examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/ApexKafkaConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/main/java/org/onap/policy/apex/plugins/event/carrier/restserver/ApexRestServerConsumer.java
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutorTest.java
plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutorTest.java
plugins/plugins-executor/plugins-executor-java/src/test/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutorTest.java
plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptStateFinalizerExecutorTest.java
plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskExecutorTest.java
plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptTaskSelectExecutorTest.java
plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutorTest.java
plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutorTest.java
plugins/plugins-executor/plugins-executor-jruby/src/test/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutorTest.java
plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonStateFinalizerExecutorTest.java
plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskExecutorTest.java
plugins/plugins-executor/plugins-executor-jython/src/test/java/org/onap/policy/apex/plugins/executor/jython/JythonTaskSelectExecutorTest.java
plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutorTest.java
plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutorTest.java
plugins/plugins-executor/plugins-executor-mvel/src/test/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutorTest.java
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/ApexEvent.java
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/enevent/ApexEvent2EnEventConverter.java
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorConsumer.java
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/ApexFileEventConsumer.java
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
testsuites/integration/integration-uservice-test/pom.xml
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventProducer.java [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyCarrierTechnologyParameters.java [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/RunTestEvent.java [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/TestExecutionProperties.java [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesTestPolicyModel.apex [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_conf.json [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_in.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/addProperty_out_expected.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_conf.json [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_in.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/definedToEmpty_out_expected.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_conf.json [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_in.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToDefined_out_expected.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_conf.json [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_in.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/emptyToEmpty_out_expected.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_conf.json [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_in.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/readOnly_out_expected.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_conf.json [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_in.properties [new file with mode: 0644]
testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/removeProperty_out_expected.properties [new file with mode: 0644]

index 95ea6b5..9a5acbf 100644 (file)
@@ -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
index e3a64eb..698a1d8 100644 (file)
@@ -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());
index 15fee6e..ab81a84 100644 (file)
@@ -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());
index 097bc98..d99d6b0 100644 (file)
@@ -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());
index 5efd47e..e27c62f 100644 (file)
@@ -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;
-    }
 }
index 6fb55a3..b322cf4 100644 (file)
@@ -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;
-    }
 }
index 10d21a7..8d83e76 100644 (file)
@@ -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;
-    }
 }
index a94fe9e..6fb28bc 100644 (file)
@@ -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");
         }
index a4a0f21..eb2d111 100644 (file)
@@ -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());
+        }
     }
 }
index 2ee3089..8e907e1 100644 (file)
@@ -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());
+        }
     }
 }
index 1b9a5a5..f957e7e 100644 (file)
@@ -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());
index eb03572..d23e52f 100644 (file)
@@ -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);
index 8df8e61..787ac4e 100644 (file)
@@ -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);
index ed50168..49ca1e3 100644 (file)
@@ -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);
             }
index 7764402..cd74e18 100644 (file)
@@ -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++;
index 9cb7f76..a8c5086 100644 (file)
@@ -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);
index 87a8871..3cf4480 100644 (file)
@@ -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()
index f779a30..db716e3 100644 (file)
@@ -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) {
index fb5bc4f..72ff6bb 100644 (file)
@@ -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) {
index 27eac53..88b9fec 100644 (file)
@@ -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) {
index d42ad6c..724c70b 100644 (file)
@@ -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) {
index 20e758f..fed2939 100644 (file)
@@ -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) {
index 8efbc62..9a70502 100644 (file)
@@ -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) {
index 635430f..af34e43 100644 (file)
@@ -25,6 +25,8 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;\r
 \r
 import java.lang.reflect.Field;\r
+import java.util.Properties;\r
+\r
 import org.junit.After;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
@@ -113,7 +115,7 @@ public class JrubyStateFinalizerExecutorTest {
         }\r
 \r
         try {\r
-            jsfe.execute(-1, null, null);\r
+            jsfe.execute(-1, new Properties(), null);\r
             fail("test should throw an exception here");\r
         } catch (Exception jtseException) {\r
             assertEquals("execute-post: state finalizer logic execution failure on state \"NULL:0.0.0:NULL:NULL\" on "\r
@@ -130,7 +132,7 @@ public class JrubyStateFinalizerExecutorTest {
         state.getStateOutputs().put("SelectedOutputIsMe", null);\r
         try {\r
             jsfe.prepare();\r
-            String stateOutput = jsfe.execute(0, null, event);\r
+            String stateOutput = jsfe.execute(0, new Properties(), event);\r
             assertEquals("SelectedOutputIsMe", stateOutput);\r
             jsfe.cleanUp();\r
         } catch (Exception jtseException) {\r
index 9f83459..8b58c38 100644 (file)
@@ -27,6 +27,8 @@ import static org.junit.Assert.fail;
 import java.lang.reflect.Field;\r
 import java.util.HashMap;\r
 import java.util.Map;\r
+import java.util.Properties;\r
+\r
 import org.junit.After;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
@@ -95,7 +97,7 @@ public class JrubyTaskExecutorTest {
 \r
         Map<String, Object> incomingParameters = new HashMap<>();\r
         try {\r
-            jte.execute(-1, null, incomingParameters);\r
+            jte.execute(-1, new Properties(), incomingParameters);\r
             fail("test should throw an exception here");\r
         } catch (Exception jteException) {\r
             assertEquals("execute-post: task logic execution failure on task \"NULL\" in model NULL:0.0.0",\r
@@ -108,7 +110,7 @@ public class JrubyTaskExecutorTest {
 \r
         try {\r
             jte.prepare();\r
-            Map<String, Object> returnMap = jte.execute(0, null, incomingParameters);\r
+            Map<String, Object> returnMap = jte.execute(0, new Properties(), incomingParameters);\r
             assertEquals(0, returnMap.size());\r
             jte.cleanUp();\r
         } catch (Exception jteException) {\r
index 683c43c..def5e1a 100644 (file)
@@ -25,6 +25,8 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;\r
 \r
 import java.lang.reflect.Field;\r
+import java.util.Properties;\r
+\r
 import org.junit.After;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
@@ -99,7 +101,7 @@ public class JrubyTaskSelectExecutorTest {
         AxEvent axEvent = new AxEvent(new AxArtifactKey("Event", "0.0.1"));\r
         EnEvent event = new EnEvent(axEvent);\r
         try {\r
-            jtse.execute(-1, null, event);\r
+            jtse.execute(-1, new Properties(), event);\r
             fail("test should throw an exception here");\r
         } catch (Exception jtseException) {\r
             assertEquals("execute-post: task selection logic failed on state \"NULL:0.0.0:NULL:NULL\"",\r
@@ -112,7 +114,7 @@ public class JrubyTaskSelectExecutorTest {
 \r
         try {\r
             jtse.prepare();\r
-            AxArtifactKey taskKey = jtse.execute(0, null, event);\r
+            AxArtifactKey taskKey = jtse.execute(0, new Properties(), event);\r
             assertEquals("NULL:0.0.0", taskKey.getId());\r
             jtse.cleanUp();\r
         } catch (Exception jtseException) {\r
index 213dddb..69ced72 100644 (file)
@@ -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) {
index 47e98f3..ee116aa 100644 (file)
@@ -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) {
index 119f4d0..fb7735a 100644 (file)
@@ -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");
index 5e66be3..52d9a9a 100644 (file)
@@ -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);
index 18bccd6..d4f84da 100644 (file)
@@ -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) {
index 05591b0..153eeca 100644 (file)
@@ -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) {
index b820ee3..7828960 100644 (file)
@@ -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;
index bd0753d..1448661 100644 (file)
@@ -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;
     }
index da94520..4581b17 100644 (file)
@@ -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) {
index e99663c..7366528 100644 (file)
@@ -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());
index f03b58c..8708e97 100644 (file)
@@ -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);
     }
index 1359117..cb2d658 100644 (file)
@@ -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>
             <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>
             <version>${version.jersey}</version>
             <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>
     </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 (file)
index 0000000..e5a88a3
--- /dev/null
@@ -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 (file)
index 0000000..0c2ac32
--- /dev/null
@@ -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 (file)
index 0000000..08d78da
--- /dev/null
@@ -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 (file)
index 0000000..f740468
--- /dev/null
@@ -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 (file)
index 0000000..9327748
--- /dev/null
@@ -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 (file)
index 0000000..af0db4e
--- /dev/null
@@ -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 (file)
index 0000000..dce37cc
--- /dev/null
@@ -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 (file)
index 0000000..090b7a0
--- /dev/null
@@ -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 (file)
index 0000000..62af4e9
--- /dev/null
@@ -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 (file)
index 0000000..62af4e9
--- /dev/null
@@ -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 (file)
index 0000000..f08b718
--- /dev/null
@@ -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 (file)
index 0000000..b527fc1
--- /dev/null
@@ -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 (file)
index 0000000..83af487
--- /dev/null
@@ -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 (file)
index 0000000..22d1c5b
--- /dev/null
@@ -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 (file)
index 0000000..80abd32
--- /dev/null
@@ -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 (file)
index 0000000..a5680d3
--- /dev/null
@@ -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 (file)
index 0000000..ec96b5c
--- /dev/null
@@ -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 (file)
index 0000000..80abd32
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..a2ad603
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
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 (file)
index 0000000..80abd32
--- /dev/null
@@ -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 (file)
index 0000000..e5d6d83
--- /dev/null
@@ -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 (file)
index 0000000..fe3a073
--- /dev/null
@@ -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 (file)
index 0000000..fe3a073
--- /dev/null
@@ -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 (file)
index 0000000..723d044
--- /dev/null
@@ -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 (file)
index 0000000..80abd32
--- /dev/null
@@ -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 (file)
index 0000000..80abd32
--- /dev/null
@@ -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 (file)
index 0000000..fb4db38
--- /dev/null
@@ -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 (file)
index 0000000..a5680d3
--- /dev/null
@@ -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 (file)
index 0000000..9f7fe98
--- /dev/null
@@ -0,0 +1 @@
+goodbye=mars
\ No newline at end of file