diff options
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java')
2 files changed, 27 insertions, 7 deletions
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()); } } |