diff options
author | 2018-03-07 18:17:22 -0800 | |
---|---|---|
committer | 2018-03-08 09:17:48 -0800 | |
commit | 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e (patch) | |
tree | 0d943226962ae31c0bf2fd0696e91c6bb41d099c /mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java | |
parent | dee036198ee09d71bfdd50247c1d23a7f472df87 (diff) |
Reduce log noise/warnings format to conventions
Reduce build log warnings by formatting tests
to ONAP code conventions (removing tabs etc.)
Issue-ID: SO-368
Change-Id: I48c6d359b83617aebeb79db4e30c1d72d31f7eec
Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java | 512 |
1 files changed, 255 insertions, 257 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java index c4a1c1fffc..58e17ff273 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java @@ -41,261 +41,259 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe public class MsoRequestTest { - - @Test - public void testParseOrchestration() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - ObjectMapper mapper = new ObjectMapper(); - String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}"; - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parseOrchestration(sir); - assertEquals(msoRequest.getRequestInfo().getSource(),"VID"); - assertEquals(msoRequest.getRequestInfo().getRequestorId(),"zz9999"); - - } - - @Test(expected = ValidationException.class) - public void testParseOrchestrationFailure() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - ObjectMapper mapper = new ObjectMapper(); - String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\"}}}"; - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parseOrchestration(sir); - - } - - @Test - public void testParseV3VnfCreate() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3VnfCreate.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3"); - assertEquals(msoRequest.getRequestInfo().getSource(),"VID"); - assertFalse(msoRequest.getALaCarteFlag()); - assertEquals(msoRequest.getReqVersion(),3); - boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet(); - assertFalse(testIsALaCarteSet); - - } - - @Test(expected = ValidationException.class) - public void testParseV3VolumeGroupFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3VolumeGroupBad.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3"); - - } - - @Test - public void testParseV3UpdateNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3UpdateNetwork.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3"); - - } - - @Test(expected = ValidationException.class) - public void testParseV3UpdateNetworkFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3UpdateNetworkBad.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3"); - - } - - @Test - public void testParseV3DeleteNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteNetwork.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); - } - - @Test - public void testParseV3ServiceInstanceDelete() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON1, requestJSON2; - try { - requestJSON1 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstance.json")); - requestJSON2 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceALaCarte.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON1, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); - boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet(); - assertTrue(testIsALaCarteSet); - assertFalse(msoRequest.getALaCarteFlag()); - sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class); - msoRequest = new MsoRequest ("12345"); - msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); - testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet(); - assertTrue(testIsALaCarteSet); - assertTrue(msoRequest.getALaCarteFlag()); - - } - - @Test(expected = ValidationException.class) - public void testParseV3ServiceInstanceCreateFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON2; - try { - requestJSON2 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceALaCarte.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3"); - - } - - @Test(expected = ValidationException.class) - public void testParseV3ServiceInstanceDeleteMacroFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{ - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceBad.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); - - } - - @Test - public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException { - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModule.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); - - - - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleNoCustomizationId.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - - mapper = new ObjectMapper(); - instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); - } - - @Test(expected = ValidationException.class) - public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException { - String requestJSON; - try { - requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleMissingModelCustomizationId.json")); - - } catch (IOException e) { - fail ("Exception caught"); - e.printStackTrace (); - return; - } - - ObjectMapper mapper = new ObjectMapper(); - HashMap<String, String> instanceIdMap = new HashMap<>(); - instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); - ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - MsoRequest msoRequest = new MsoRequest ("1234"); - msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); - } + @Test + public void testParseOrchestration() throws JsonParseException, JsonMappingException, IOException, ValidationException { + ObjectMapper mapper = new ObjectMapper(); + String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}"; + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parseOrchestration(sir); + assertEquals(msoRequest.getRequestInfo().getSource(), "VID"); + assertEquals(msoRequest.getRequestInfo().getRequestorId(), "zz9999"); + + } + + @Test(expected = ValidationException.class) + public void testParseOrchestrationFailure() throws JsonParseException, JsonMappingException, IOException, ValidationException { + ObjectMapper mapper = new ObjectMapper(); + String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\"}}}"; + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parseOrchestration(sir); + + } + + @Test + public void testParseV3VnfCreate() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3VnfCreate.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3"); + assertEquals(msoRequest.getRequestInfo().getSource(), "VID"); + assertFalse(msoRequest.getALaCarteFlag()); + assertEquals(msoRequest.getReqVersion(), 3); + boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet(); + assertFalse(testIsALaCarteSet); + + } + + @Test(expected = ValidationException.class) + public void testParseV3VolumeGroupFail() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3VolumeGroupBad.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3"); + + } + + @Test + public void testParseV3UpdateNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3UpdateNetwork.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3"); + + } + + @Test(expected = ValidationException.class) + public void testParseV3UpdateNetworkFail() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3UpdateNetworkBad.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3"); + + } + + @Test + public void testParseV3DeleteNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteNetwork.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); + } + + @Test + public void testParseV3ServiceInstanceDelete() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON1, requestJSON2; + try { + requestJSON1 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstance.json")); + requestJSON2 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceALaCarte.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON1, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); + boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet(); + assertTrue(testIsALaCarteSet); + assertFalse(msoRequest.getALaCarteFlag()); + sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class); + msoRequest = new MsoRequest("12345"); + msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); + testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet(); + assertTrue(testIsALaCarteSet); + assertTrue(msoRequest.getALaCarteFlag()); + + } + + @Test(expected = ValidationException.class) + public void testParseV3ServiceInstanceCreateFail() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON2; + try { + requestJSON2 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceALaCarte.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3"); + + } + + @Test(expected = ValidationException.class) + public void testParseV3ServiceInstanceDeleteMacroFail() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceBad.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3"); + + } + + @Test + public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModule.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); + + + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModuleNoCustomizationId.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + + mapper = new ObjectMapper(); + instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); + } + + @Test(expected = ValidationException.class) + public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException { + String requestJSON; + try { + requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModuleMissingModelCustomizationId.json")); + + } catch (IOException e) { + fail("Exception caught"); + e.printStackTrace(); + return; + } + + ObjectMapper mapper = new ObjectMapper(); + HashMap<String, String> instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); + ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + MsoRequest msoRequest = new MsoRequest("1234"); + msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4"); + } } |