From b46f3f3d4d2c80ded0f6f78a9a463bf5ec6353a3 Mon Sep 17 00:00:00 2001 From: Elena Kuleshov Date: Tue, 30 Jul 2019 05:40:39 -0400 Subject: Use generic req mapping for CM requests Do not pass specially preprocessed ServiceRequestParameter to msoToJson mapping for Instance Management requests. Issue-ID: SO-2168 Signed-off-by: Kuleshov, Elena Change-Id: Ic6bdd624bd03c7c03213248781dc5e554331feed --- .../onap/so/apihandlerinfra/RequestHandlerUtilsTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java') 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 { -- cgit 1.2.3-korg