summaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-uservice-test/src
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2021-03-18 12:39:46 +0000
committerAjith Sreekumar <ajith.sreekumar@bell.ca>2021-03-23 14:16:21 +0000
commite5a1908b92c02c91ad3a703105e5ac212ab27f6b (patch)
tree8a0b4f77158fa96a826f647ff692f788201800ce /testsuites/integration/integration-uservice-test/src
parentd98383f3f9cabc97efdebc066b06df856c29cdcf (diff)
Fixing parallel event execution problem in APEX-PDP REST layer
Parallel event execution in APEX was resulting in incorrect dynamic REST url. This issue is fixed in this review. Change-Id: Id8a28c001a7fd7915df1f5909109bb369667ab40 Issue-ID: POLICY-3019 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca> (cherry picked from commit 369a94a9fd626b35d52c2e7ee5f19e6ff6e1b9d8)
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/adapt/restclient/TestExecutionPropertyRest.java40
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/executionproperties/DummyApexEventConsumer.java4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js7
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json58
4 files changed, 4 insertions, 105 deletions
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java
index 0cf7dc652..b3f27c52e 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java
@@ -239,46 +239,6 @@ public class TestExecutionPropertyRest {
}
/**
- * Test Http code filter set and tag Url are transformed correctly.
- */
- @Test
- public void testReplaceUrlTag() throws Exception {
- final Client client = ClientBuilder.newClient();
- // @formatter:off
- final String[] cliArgs = new String[] {
- "-c",
- "src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex",
- "-o",
- "target/ExecutionPropertiesRestTestPolicyModel.json",
- "-ac",
- "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json",
- "-t",
- "src/test/resources/tosca/ToscaTemplate.json",
- "-ot",
- "target/classes/APEXPolicy.json"
- };
- // @formatter:on
-
- new ApexCliToscaEditorMain(cliArgs);
-
- // @formatter:off
- final String[] args = {
- "-p",
- "target/classes/APEXPolicy.json"
- };
- // @formatter:on
- apexMain = new ApexMain(args);
-
- await().atMost(5, TimeUnit.SECONDS).until(() -> {
- Response response = client.target("http://localhost:32801/TestExecutionRest/apex/event/GetProperUrl")
- .request("application/json").get();
- return response.readEntity(String.class).contains("\"PostProperUrl\": 1");
- });
- assertTrue(apexMain.isAlive());
- LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outContent.toString() + "\nEnd-TagUrl");
- }
-
- /**
* Test Http code filter set and multi-tag Url are transformed correctly.
*/
@Test
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
index c4b93b002..1dc6f13a2 100644
--- 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
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -125,7 +125,7 @@ public class DummyApexEventConsumer implements ApexEventConsumer {
RunTestEvent event = new RunTestEvent();
event.setTestToRun(dummyConsumerProperties.getTestToRun());
try {
- eventReceiver.receiveEvent(executionProperties, event.toJson());
+ eventReceiver.receiveEvent(1, executionProperties, event.toJson());
} catch (Exception e) {
String message = "event processing for executor properties testing failed: " + e.getMessage();
LOGGER.warn(message, e);
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js
index b60e2acee..f4d979d1f 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,11 +23,7 @@ executor.logger.debug(executor.getSubject().getId());
executor.logger.debug("executionProperties: " + executor.getExecutionProperties());
-if (executor.getExecutionProperties().get("HTTP_CODE_STATUS") == "500")
- executor.outFields.put("testToRun", "CodeFilterSet");
-else
- executor.outFields.put("testToRun", "CodeFilterDefault");
-
+executor.outFields.put("testToRun", "CodeFilterSet");
executor.logger.debug("testToRun: " + executor.outFields.get("testToRun"));
true;
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json b/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json
deleted file mode 100644
index 22ab9e3bb..000000000
--- a/testsuites/integration/integration-uservice-test/src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "engineServiceParameters": {
- "name": "MyApexEngine",
- "version": "0.0.1",
- "id": 45,
- "instanceCount": 4,
- "deploymentPort": 12561,
- "engineParameters": {
- "executorParameters": {
- "JAVASCRIPT": {
- "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
- }
- }
- }
- },
- "eventInputParameters": {
- "GetCodeConsumer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTCLIENT",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
- "parameters": {
- "url": "http://localhost:32801/TestExecutionRest/apex/event/FetchHttpCode",
- "httpMethod": "GET",
- "httpHeaders" : [
- ],
- "httpCodeFilter" : "[1-5][0][0-5]"
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON",
- "parameters": {
- "testToRun": "FetchHttpCode"
- }
- },
- "eventName": "Event0200"
- }
- },
- "eventOutputParameters": {
- "FirstProducer": {
- "carrierTechnologyParameters": {
- "carrierTechnology": "RESTCLIENT",
- "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
- "parameters": {
- "url": "http://localhost:32801/TestExecutionRest/apex/event/{tagId}",
- "httpMethod": "PUT",
- "httpHeaders" : [
- ["Content-Type", "application/json"],
- ["Date", "Tue, 24 Jul 2019 14:57:12 GMT"]
- ]
- }
- },
- "eventProtocolParameters": {
- "eventProtocol": "JSON"
- },
- "eventName": "Event0201"
- }
- }
-}