summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java/org
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-11-06 15:49:11 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-06 15:49:11 +0000
commitb896b3cb7c7141f6a01066bfccd653324a7e3bbc (patch)
tree41573626424438f088c5edc741f32c93cb071f29 /bpmn/so-bpmn-tasks/src/test/java/org
parent2c9a77e893d414b8af81668dc9945691f4466528 (diff)
parentce37ae979311ed4e55150426d477db262773beb0 (diff)
Merge "Removed slashes and added catch block" into casablanca
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
index dabdc6811c..8577de2537 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
@@ -79,9 +79,9 @@ public class ConfigurationScaleOutTest extends BaseTaskTest {
controllerSelectionReference.setActionCategory("testAction");
controllerSelectionReference.setVnfType("testVnfType");
String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientGetResponse.json")));
- String expectedPayload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\","
- + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\""
- + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}";
+ String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
+ + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
+ + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString());
@@ -101,9 +101,9 @@ public class ConfigurationScaleOutTest extends BaseTaskTest {
Action action = Action.ConfigScaleOut;
String vnfId = genericVnf.getVnfId();
String controllerType = "testType";
- String payload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\","
- + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\""
- + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}";
+ String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
+ + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
+ + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":\"AZ-MN02\"}}";
HashMap<String, String> payloadInfo = new HashMap<String, String>();
payloadInfo.put("vnfName", "testVnfName");
payloadInfo.put("vfModuleId", "testVfModuleId");
@@ -121,5 +121,29 @@ public class ConfigurationScaleOutTest extends BaseTaskTest {
configurationScaleOut.callAppcClient(execution);
verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
}
+ @Test
+ public void setParamsForConfigurationScaleOutBadPathTest() throws Exception {
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory("testAction");
+ controllerSelectionReference.setVnfType("testVnfType");
+ String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientResponseIncorrectPath.json")));
+ String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\","
+ + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\""
+ + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":null}}";
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
+
+ doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString());
+
+ configurationScaleOut.setParamsForConfigurationScaleOut(execution);
+
+ assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
+ assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
+ assertEquals("ConfigScaleOut", execution.getVariable("action"));
+ assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
+ assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
+ assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId"));
+ assertEquals(expectedPayload, execution.getVariable("payload"));
+ }
}