From da10fa6c82bafad3f2b01f4a52fbdc5f7b5d2e04 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 13 Mar 2019 15:52:08 -0400 Subject: Pass the revised value of usePreload to JSON Pass the possibly revised value of usePreload to JSON going to BPMN. Change-Id: Idc46a8786bc7bbdbf860b59998785c1c885689e4 Issue-ID: SO-1652 Signed-off-by: Benjamin, Max (mb388a) --- .../onap/so/apihandlerinfra/ServiceInstancesTest.java | 18 ++++++++++++++++++ .../validation/RequestParametersValidationTest.java | 16 +++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/test') diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 23974ef1fa..d6c794ef2e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -194,6 +194,24 @@ public class ServiceInstancesTest extends BaseTest{ assertEquals("10",modelInfo.getModelUuid()); } + + + @Test + public void test_mapJSONtoMSOStyleUsePreload() throws IOException{ + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + String testRequest= inputStream("/ServiceInstanceDefault.json"); + ServiceInstancesRequest sir = new ServiceInstancesRequest(); + RequestDetails rd = new RequestDetails(); + RequestParameters rp = new RequestParameters(); + rp.setUsePreload(true); + rd.setRequestParameters(rp); + sir.setRequestDetails(rd); + String resultString = servInstances.mapJSONtoMSOStyle(testRequest, sir, false, null); + ServiceInstancesRequest sir1 = mapper.readValue(resultString, ServiceInstancesRequest.class); + assertTrue(sir1.getRequestDetails().getRequestParameters().getUsePreload()); + } + @Test public void createServiceInstanceVIDDefault() throws IOException{ TestAppender.events.clear(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java index 8d456e3f68..bd9b95dc12 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java @@ -50,7 +50,7 @@ public class RequestParametersValidationTest extends BaseTest{ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b"); RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); - + assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload()); assertFalse(info.getReqParameters().getUsePreload()); } @@ -66,7 +66,8 @@ public class RequestParametersValidationTest extends BaseTest{ RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); - assertTrue(info.getReqParameters().getUsePreload()); + assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload()); + assertTrue(info.getReqParameters().getUsePreload()); } @Test @@ -82,6 +83,7 @@ public class RequestParametersValidationTest extends BaseTest{ RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); + assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload()); assertTrue(info.getReqParameters().getUsePreload()); } @@ -97,7 +99,7 @@ public class RequestParametersValidationTest extends BaseTest{ sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b"); RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); - + assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload()); assertTrue(info.getReqParameters().getUsePreload()); } @@ -113,7 +115,7 @@ public class RequestParametersValidationTest extends BaseTest{ info.setRequestScope("service"); RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); - + assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload()); assertFalse(info.getReqParameters().getUsePreload()); } @@ -129,7 +131,7 @@ public class RequestParametersValidationTest extends BaseTest{ info.setRequestScope("service"); RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); - + assertFalse(sir.getRequestDetails().getRequestParameters().getUsePreload()); assertFalse(info.getReqParameters().getUsePreload()); } @@ -145,7 +147,7 @@ public class RequestParametersValidationTest extends BaseTest{ info.setRequestScope("service"); RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); - + assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload()); assertTrue(info.getReqParameters().getUsePreload()); } @@ -161,7 +163,7 @@ public class RequestParametersValidationTest extends BaseTest{ info.setRequestScope("service"); RequestParametersValidation validation = new RequestParametersValidation(); validation.validate(info); - + assertTrue(sir.getRequestDetails().getRequestParameters().getUsePreload()); assertTrue(info.getReqParameters().getUsePreload()); } } -- cgit 1.2.3-korg