diff options
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
3 files changed, 35 insertions, 1 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java index ade13e7b57..554c794e3e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java @@ -196,7 +196,7 @@ public class InstanceManagement { .setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()) .setRequestAction(action.toString()).setServiceInstanceId(serviceInstanceId).setVnfId(vnfId) .setServiceType(serviceInstanceType).setVnfType(vnfType) - .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action)) + .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action)) .setApiVersion(apiVersion).setALaCarte(aLaCarte).setRequestUri(requestUri).build(); } catch (IOException e) { ErrorLoggerInfo errorLoggerInfo = diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java index 5306888570..e4532cd8d7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java @@ -27,6 +27,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID; @@ -150,6 +151,18 @@ public class RequestHandlerUtilsTest extends BaseTest { } + @Test + public void test_mapJSONtoMSOStyleCustomWorkflowRequest() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + String testRequest = inputStream("/CustomWorkflowRequest.json"); + String resultString = + requestHandlerUtils.mapJSONtoMSOStyle(testRequest, null, true, Action.inPlaceSoftwareUpdate); + ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class); + assertEquals(sir.getRequestDetails().getCloudConfiguration().getTenantId(), "88a6ca3ee0394ade9403f075db23167e"); + assertNotEquals(sir.getRequestDetails().getRequestParameters().getUserParams().size(), 0); + } + @Test public void test_mapJSONtoMSOStyleUsePreload() throws IOException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json new file mode 100644 index 0000000000..6c59ec5f1f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json @@ -0,0 +1,21 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx", + "instanceName": "inPlaceSoftwareUpdateTest" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestParameters": { + "payload": "{\"request-parameters\":{\"host-ip-address\":\"10.10.10.10\"},\"configuration-parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}", + "userParams": [{ + "name": "vnf-id", + "value": "4603ad6d-dbfb-4899-a8bd-bc1dd0d74914" + } + ] + } + } +}
\ No newline at end of file |