aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-uservice-test/src
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/integration/integration-uservice-test/src')
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/RestClientEndpointForTaskParameters.java105
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java177
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js37
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js36
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/TaskParametersTestPolicyModel.apex65
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_invalidTaskIds.json88
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_noTaskIds.json86
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_validTaskIds.json88
8 files changed, 682 insertions, 0 deletions
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/RestClientEndpointForTaskParameters.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/RestClientEndpointForTaskParameters.java
new file mode 100644
index 000000000..f0b670008
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/RestClientEndpointForTaskParameters.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 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.taskparameters;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+/**
+ * The Class RestClientEndpointForTaskParameters.
+ */
+@Path("/apex")
+public class RestClientEndpointForTaskParameters {
+
+ private static String closedLoopId;
+ private static String serviceId;
+
+ /**
+ * Get event that triggers policy for testing TaskParameters.
+ *
+ * @return the response
+ */
+ @Path("/event/GetEvent")
+ @GET
+ public Response getEvent() {
+ return Response.status(200).entity("{\"event\": \"CLTriggerEvent\"}").build();
+ }
+
+ /**
+ * Fetch information of service using serviceId.
+ *
+ * @param servicId the service id
+ *
+ * @return the response
+ */
+ @Path("/service/getInfoForServiceId/{servicId}")
+ @POST
+ public Response getInfoForServiceId(@PathParam("servicId") String servicId) {
+ serviceId = servicId;
+ return Response.status(200)
+ .entity("{\"name\": \"ServiceInfoEvent\", \"serviceDetails\": \"serviceDetailsFullBody\"}").build();
+ }
+
+ /**
+ * Closed loop action using closedLoopId.
+ *
+ * @param closedLpId the closedLoopId
+ *
+ * @return the response
+ */
+ @Path("/action/doActionForCL/{closedLpId}")
+ @POST
+ public Response doActionForCL(@PathParam("closedLpId") String closedLpId) {
+ closedLoopId = closedLpId;
+ return Response.status(200).entity("{\"name\": \"CLOutputEvent\", \"status\": \"ClosedLoop Success\"}").build();
+ }
+
+ /**
+ * Get details that are set as part of the policy execution.
+ *
+ * @return the response
+ */
+ @Path("/event/getDetails")
+ @GET
+ public Response getDetails() {
+ if (null == serviceId || null == closedLoopId) {
+ return Response.status(500).entity("Error: Flow incomplete").build();
+ }
+ return Response.status(200).entity("{\"closedLoopId\": " + closedLoopId + ",\"serviceId\": " + serviceId + "}")
+ .build();
+ }
+
+ /**
+ * Clear details that are set as part of the policy execution.
+ *
+ * @return the response
+ */
+ @Path("/event/clearDetails")
+ @GET
+ public Response clearDetails() {
+ closedLoopId = null;
+ serviceId = null;
+ return Response.status(200).entity("Details cleared.").build();
+ }
+}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java
new file mode 100644
index 000000000..da93f919d
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/taskparameters/TestTaskParameters.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 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.taskparameters;
+
+import static org.awaitility.Awaitility.await;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.TimeUnit;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.Response;
+import org.junit.AfterClass;
+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.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.service.engine.main.ApexMain;
+import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
+import org.onap.policy.common.gson.GsonMessageBodyHandler;
+import org.onap.policy.common.utils.network.NetworkUtil;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
+
+/**
+ * This class runs integration tests for taskParameters.
+ * Task parameters are read from the ApexConfig, and they can be accessed in task logic.
+ * In this case, the taskParameters are used to set values in executionProperties.
+ * URL dynamically populated using executionProperties is hit and values get updated in
+ * {@link RestClientEndpointForTaskParameters} which acts as a temporary server for requests.
+ */
+public class TestTaskParameters {
+
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestTaskParameters.class);
+
+ private static HttpServletServer server;
+ private static final int PORT = 32801;
+ private static final String HOST = "localhost";
+
+ /**
+ * Compile the policy.
+ */
+ @BeforeClass
+ public static void compilePolicy() {
+ // @formatter:off
+ final String[] cliArgs = {
+ "-c",
+ "src/test/resources/policies/taskparameters/TaskParametersTestPolicyModel.apex",
+ "-l",
+ "target/TaskParametersTestPolicyModel.log",
+ "-o",
+ "target/TaskParametersTestPolicyModel.json"
+ };
+ // @formatter:on
+
+ new ApexCommandLineEditorMain(cliArgs);
+ }
+
+ /**
+ * Sets up a server for testing.
+ *
+ * @throws Exception the exception
+ */
+ @BeforeClass
+ public static void setUp() throws Exception {
+ if (NetworkUtil.isTcpPortOpen(HOST, PORT, 3, 50L)) {
+ throw new IllegalStateException("port " + PORT + " is still in use");
+ }
+
+ server = HttpServletServerFactoryInstance.getServerFactory().build("TestTaskParameters", false, null, PORT,
+ "/TestTaskParametersRest", false, false);
+
+ server.addServletClass(null, RestClientEndpointForTaskParameters.class.getName());
+ server.setSerializationProvider(GsonMessageBodyHandler.class.getName());
+
+ server.start();
+
+ if (!NetworkUtil.isTcpPortOpen(HOST, PORT, 60, 500L)) {
+ throw new IllegalStateException("port " + PORT + " is still not in use");
+ }
+
+ }
+
+ /**
+ * Tear down.
+ *
+ * @throws Exception the exception
+ */
+ @AfterClass
+ public static void tearDown() throws Exception {
+ if (server != null) {
+ server.stop();
+ }
+ }
+
+ /**
+ * Clear relative file root environment variable.
+ */
+ @Before
+ public void clearRelativeFileRoot() {
+ System.clearProperty("APEX_RELATIVE_FILE_ROOT");
+ }
+
+ /**
+ * Test taskParameters with no taskIds.
+ * When taskIds are not provided, all taskParameters provided in config will be updated to all tasks.
+ */
+ @Test
+ public void testTaskParameters_with_noTaskIds() throws Exception {
+ String responseEntity = testTaskParameters(
+ "src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_noTaskIds.json");
+ assertTrue(responseEntity.contains("{\"closedLoopId\": closedLoopId123,\"serviceId\": serviceId123}"));
+ }
+
+ /**
+ * Test taskParameters with valid taskIds.
+ * When valid taskIds are provided, the the taskParameter will be updated in that particular task alone.
+ */
+ @Test
+ public void testTaskParameters_with_validTaskIds() throws Exception {
+ String responseEntity = testTaskParameters(
+ "src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_validTaskIds.json");
+ assertTrue(responseEntity.contains("{\"closedLoopId\": closedLoopIdxyz,\"serviceId\": serviceIdxyz}"));
+ }
+
+ /**
+ * Test taskParameters with invalid taskIds.
+ * When invalid taskIds are provided, or when a taskParameter assigned to a particular taskId is tried to be
+ * accessed in a taskLogic of a different task, such taskParameters won't be accessible in the task
+ */
+ @Test
+ public void testTaskParameters_with_invalidTaskIds() throws Exception {
+ String responseEntity = testTaskParameters(
+ "src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_invalidTaskIds.json");
+ assertTrue(responseEntity.contains("{\"closedLoopId\": INVALID - closedLoopId not available in TaskParameters,"
+ + "\"serviceId\": INVALID - serviceId not available in TaskParameters}"));
+ }
+
+ private String testTaskParameters(String apexConfigPath) throws ApexException {
+ final Client client = ClientBuilder.newClient();
+ final String[] args = {apexConfigPath};
+ // clear the details set in server
+ client.target("http://" + HOST + ":" + PORT + "/TestTaskParametersRest/apex/event/clearDetails")
+ .request("application/json").get();
+ final ApexMain apexMain = new ApexMain(args);
+
+ String getDetailsUrl = "http://" + HOST + ":" + PORT + "/TestTaskParametersRest/apex/event/getDetails";
+ // wait for success response code to be received, until a timeout
+ await().atMost(2000, TimeUnit.MILLISECONDS)
+ .until(() -> 200 == client.target(getDetailsUrl).request("application/json").get().getStatus());
+ apexMain.shutdown();
+ Response response = client.target(getDetailsUrl).request("application/json").get();
+ String responseEntity = response.readEntity(String.class);
+
+ LOGGER.info("testTaskParameters-OUTSTRING=\n {}", responseEntity);
+ return responseEntity;
+ }
+}
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js
new file mode 100644
index 000000000..a4ab0360f
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js
@@ -0,0 +1,37 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 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(executor.parameters);
+
+executor.logger.info("executionProperties in: {}", executor.getExecutionProperties());
+
+executor.getExecutionProperties().setProperty("tagId", "doActionForCL");
+var closedLoopId = executor.parameters.get("closedLoopId")
+if (null == closedLoopId) {
+ closedLoopId = "INVALID - closedLoopId not available in TaskParameters"
+}
+executor.getExecutionProperties().setProperty("value", closedLoopId);
+
+executor.logger.info("executionProperties out: {}", executor.getExecutionProperties());
+
+var returnValue = executor.isTrue; \ No newline at end of file
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js
new file mode 100644
index 000000000..6d56616d8
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js
@@ -0,0 +1,36 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 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(executor.parameters);
+
+executor.logger.info("executionProperties in: {}", executor.getExecutionProperties());
+
+executor.getExecutionProperties().setProperty("tagId", "getInfoForServiceId");
+var svcId = executor.parameters.get("serviceId")
+if (null == svcId) {
+ svcId = "INVALID - serviceId not available in TaskParameters"
+}
+executor.getExecutionProperties().setProperty("value", svcId);
+
+executor.logger.info("executionProperties out: {}", executor.getExecutionProperties());
+var returnValue = executor.isTrue; \ No newline at end of file
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/TaskParametersTestPolicyModel.apex b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/TaskParametersTestPolicyModel.apex
new file mode 100644
index 000000000..551a46bfd
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/TaskParametersTestPolicyModel.apex
@@ -0,0 +1,65 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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=TaskParametersTestPolicyModel
+
+schema create name=SimpleStringType flavour=Java schema=java.lang.String
+
+event create name=CLTriggerEvent nameSpace=org.onap.policy.apex.domains.test source=Junit target=APEX
+event parameter create name=CLTriggerEvent parName=event schemaName=SimpleStringType
+
+event create name=ServiceInfoEvent nameSpace=org.onap.policy.apex.domains.test source=Decide target=OutSide
+event parameter create name=ServiceInfoEvent parName=serviceDetails schemaName=SimpleStringType
+
+event create name=CLOutputEvent nameSpace=org.onap.policy.apex.domains.test source=Decide target=OutSide
+event parameter create name=CLOutputEvent parName=status schemaName=SimpleStringType
+
+task create name=SetServiceIdForTest version=1.0.0
+
+task inputfield create name=SetServiceIdForTest fieldName=event schemaName=SimpleStringType
+task outputfield create name=SetServiceIdForTest fieldName=serviceDetails schemaName=SimpleStringType
+
+task logic create name=SetServiceIdForTest logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/test/resources/policies/taskparameters/SetServiceIdForTest.js"
+LE
+
+task create name=SetControlLoopNameForTest version=1.0.0
+
+task inputfield create name=SetControlLoopNameForTest fieldName=serviceDetails schemaName=SimpleStringType
+task outputfield create name=SetControlLoopNameForTest fieldName=status schemaName=SimpleStringType
+
+task logic create name=SetControlLoopNameForTest logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js"
+LE
+
+
+policy create name=Policy1 template=freestyle firstState=Junit
+
+policy state create name=Policy1 stateName=Junit triggerName=CLTriggerEvent defaultTaskName=SetServiceIdForTest
+policy state output create name=Policy1 stateName=Junit outputName=ServiceInfo eventName=ServiceInfoEvent nextState=NULL
+policy state taskref create name=Policy1 stateName=Junit taskLocalName=SetServiceInfo taskName=SetServiceIdForTest outputType=DIRECT outputName=ServiceInfo
+
+policy create name=Policy2 template=freestyle firstState=Decide
+
+policy state create name=Policy2 stateName=Decide triggerName=ServiceInfoEvent defaultTaskName=SetControlLoopNameForTest
+policy state output create name=Policy2 stateName=Decide outputName=CLOut eventName=CLOutputEvent nextState=NULL
+policy state taskref create name=Policy2 stateName=Decide taskLocalName=SetControlLoopName taskName=SetControlLoopNameForTest outputType=DIRECT outputName=CLOut
+validate
+
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_invalidTaskIds.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_invalidTaskIds.json
new file mode 100644
index 000000000..0714f4b37
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_invalidTaskIds.json
@@ -0,0 +1,88 @@
+{
+ "engineServiceParameters": {
+ "name": "MyApexEngine",
+ "version": "0.0.1",
+ "id": 45,
+ "instanceCount": 1,
+ "deploymentPort": 12561,
+ "policyModelFileName": "target/TaskParametersTestPolicyModel.json",
+ "engineParameters": {
+ "executorParameters": {
+ "JAVASCRIPT": {
+ "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+ }
+ },
+ "taskParameters": [
+ {
+ "key": "serviceId",
+ "value": "serviceId123",
+ "taskId": "InvalidTaskId:1.0.0"
+ },
+ {
+ "key": "closedLoopId",
+ "value": "closedLoopId123",
+ "taskId": "InvalidTaskIdForCLOutTask"
+ }
+ ]
+ } },
+ "eventInputParameters": {
+ "GetCodeConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/event/GetEvent",
+ "httpMethod": "GET"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventName": "CLTriggerEvent"
+ },
+ "FirstConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTREQUESTOR",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/service/{tagId}/{value}",
+ "httpMethod": "POST"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "ServiceInfoEvent",
+ "requestorMode": true,
+ "requestorPeer": "FirstProducer"
+ }
+ },
+ "eventOutputParameters": {
+ "FirstProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTREQUESTOR",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "ServiceInfoEvent",
+ "requestorMode": true,
+ "requestorPeer": "FirstConsumer"
+ },
+ "SecondProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/action/{tagId}/{value}",
+ "httpMethod": "POST"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "CLOutputEvent"
+ }
+ }
+}
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_noTaskIds.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_noTaskIds.json
new file mode 100644
index 000000000..217d6bda2
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_noTaskIds.json
@@ -0,0 +1,86 @@
+{
+ "engineServiceParameters": {
+ "name": "MyApexEngine",
+ "version": "0.0.1",
+ "id": 45,
+ "instanceCount": 1,
+ "deploymentPort": 12561,
+ "policyModelFileName": "target/TaskParametersTestPolicyModel.json",
+ "engineParameters": {
+ "executorParameters": {
+ "JAVASCRIPT": {
+ "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+ }
+ },
+ "taskParameters": [
+ {
+ "key": "serviceId",
+ "value": "serviceId123"
+ },
+ {
+ "key": "closedLoopId",
+ "value": "closedLoopId123"
+ }
+ ]
+ } },
+ "eventInputParameters": {
+ "GetCodeConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/event/GetEvent",
+ "httpMethod": "GET"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventName": "CLTriggerEvent"
+ },
+ "FirstConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTREQUESTOR",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/service/{tagId}/{value}",
+ "httpMethod": "POST"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "ServiceInfoEvent",
+ "requestorMode": true,
+ "requestorPeer": "FirstProducer"
+ }
+ },
+ "eventOutputParameters": {
+ "FirstProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTREQUESTOR",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "ServiceInfoEvent",
+ "requestorMode": true,
+ "requestorPeer": "FirstConsumer"
+ },
+ "SecondProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/action/{tagId}/{value}",
+ "httpMethod": "POST"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "CLOutputEvent"
+ }
+ }
+}
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_validTaskIds.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_validTaskIds.json
new file mode 100644
index 000000000..0029374f9
--- /dev/null
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/taskparameters/TaskParameterTestConfig_with_validTaskIds.json
@@ -0,0 +1,88 @@
+{
+ "engineServiceParameters": {
+ "name": "MyApexEngine",
+ "version": "0.0.1",
+ "id": 45,
+ "instanceCount": 1,
+ "deploymentPort": 12561,
+ "policyModelFileName": "target/TaskParametersTestPolicyModel.json",
+ "engineParameters": {
+ "executorParameters": {
+ "JAVASCRIPT": {
+ "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+ }
+ },
+ "taskParameters": [
+ {
+ "key": "serviceId",
+ "value": "serviceIdxyz",
+ "taskId": "SetServiceIdForTest:1.0.0"
+ },
+ {
+ "key": "closedLoopId",
+ "value": "closedLoopIdxyz",
+ "taskId": "SetControlLoopNameForTest:1.0.0"
+ }
+ ]
+ } },
+ "eventInputParameters": {
+ "GetCodeConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/event/GetEvent",
+ "httpMethod": "GET"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventName": "CLTriggerEvent"
+ },
+ "FirstConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTREQUESTOR",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/service/{tagId}/{value}",
+ "httpMethod": "POST"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "ServiceInfoEvent",
+ "requestorMode": true,
+ "requestorPeer": "FirstProducer"
+ }
+ },
+ "eventOutputParameters": {
+ "FirstProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTREQUESTOR",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters"
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "ServiceInfoEvent",
+ "requestorMode": true,
+ "requestorPeer": "FirstConsumer"
+ },
+ "SecondProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTCLIENT",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
+ "parameters": {
+ "url": "http://localhost:32801/TestTaskParametersRest/apex/action/{tagId}/{value}",
+ "httpMethod": "POST"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "eventNameFilter": "CLOutputEvent"
+ }
+ }
+}