diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-26 09:54:15 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-26 09:56:36 -0500 |
commit | a39f8b79fdf35370c8ee83c4ee92549feaf63d3e (patch) | |
tree | 3c1a5f6f50578ec3e2111a817eb5cb9901e74258 /mso-api-handlers/mso-api-handler-infra/src/test | |
parent | 2fa42bd9e13394f0acd665c54d2bd8b2ec7a8265 (diff) |
check that a la carte is not null
Handle the case of absent aLaCarte and usePreload settings
Change-Id: Ic3413515218013870ddce97ec225edaa6b6e99c3
Issue-ID: SO-1571
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
2 files changed, 70 insertions, 0 deletions
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 3fc5a16d9d..2813ef7b70 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 @@ -55,6 +55,21 @@ public class RequestParametersValidationTest extends BaseTest{ } @Test + public void testVfModuleWithNoALaCarte() throws IOException, ValidationException { + String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json"))); + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class); + ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, + 6, false, sir.getRequestDetails().getRequestParameters()); + info.setRequestScope("vfModule"); + sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b"); + RequestParametersValidation validation = new RequestParametersValidation(); + validation.validate(info); + + assertFalse(info.getReqParameters().getUsePreload()); + } + + @Test public void testVfModuleWithTrueALaCarte() throws IOException, ValidationException { String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersIsALaCarte.json"))); ObjectMapper mapper = new ObjectMapper(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json new file mode 100644 index 0000000000..304065f930 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json @@ -0,0 +1,55 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "InframsoVsamp10a2..vSAMP10a_addon_2..module-1", + "modelVersionId": "dcd3d939-67cd-438c-a55f-48073811f83f", + "modelInvariantId": "b42d49f3-6429-4c2e-a73c-29bef87ca1b9", + "modelVersion": "1", + "modelCustomizationId": "3bec51f8-b410-40f5-b470-25d31f7210dc" + }, + "cloudConfiguration": { + "cloudOwner": "CloudOwner", + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "InfraMSO-vSAMP10a_6.0-VF-Module_1-1902-est01-GR_API-101", + "source": "VID", + "suppressRollback": false, + "requestorId": "bs7527" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "43075e6e-4d95-4bca-b9e5-712d0a14fbc2", + "modelInfo": { + "modelType": "service", + "modelName": "InfraMSO_vSAMP10a_Service", + "modelVersionId": "8f6fba78-8eab-4149-8be1-491ef7f63cf7", + "modelInvariantId": "653030db-85e2-4bd1-8c61-3764ebf5860a", + "modelVersion": "6.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "7c1ff5bc-fb41-48a7-b997-f9fdb3ab4a77", + "modelInfo": { + "modelType": "vnf", + "modelName": "InfraMSO_vSAMP10a-2", + "modelVersionId": "cb79c25f-b30d-4d95-afb5-97be4021f3db", + "modelInvariantId": "e93d3a7a-446d-486b-ae48-d474a9156064", + "modelVersion": "1.0", + "modelCustomizationId": "034226ae-879a-46b5-855c-d02babcb6cb6", + "modelCustomizationName": "InfraMSO_vSAMP10a-2 0" + } + } + } + ], + "requestParameters": { + "testApi": "GR_API", + "userParams": [] + } + } +} |