diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-01-24 17:00:09 +0530 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-01-24 17:00:09 +0530 |
commit | 1d602253b5a2a0dde15c672875515619460337bd (patch) | |
tree | d1dbdd3137c1c0b7c199b53c3366a82807100f4c /adapters/mso-catalog-db-adapter/src/test/java | |
parent | 402f8dc916e938a55dd54f721b3ce3928a7409a0 (diff) |
Fix AR receipe retrival
Fix AR receipe retrival.
Change-Id: I5675fef17c1ee6375dd6c68a311d5f0568438879
Issue-ID: SO-1422
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/test/java')
-rw-r--r-- | adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index 1f51afe143..5555a72b36 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -67,6 +67,8 @@ public class CatalogDBRestTest { private static final String ECOMP_MSO_CATALOG_V2_SERVICE_ALLOTTED_RESOURCES = "ecomp/mso/catalog/v2/serviceAllottedResources"; + private static final String ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE = "ecomp/mso/catalog/v2/resourceRecipe"; + private static final String ECOMP_MSO_CATALOG_V2_SERVICE_NETWORKS = "ecomp/mso/catalog/v2/serviceNetworks"; private static final String ECOMP_MSO_CATALOG_V2_SERVICE_VNFS = "ecomp/mso/catalog/v2/serviceVnfs"; @@ -96,6 +98,8 @@ public class CatalogDBRestTest { private final String expectedAllottedResponse = "{\r\n\"serviceAllottedResources\": [\r\n{\r\n\"modelInfo\": {\r\n\"modelName\": \"Tunnel_Xconn\",\r\n\"modelUuid\": \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\"modelInvariantUuid\": \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\"modelVersion\": \"1.0\",\r\n\"modelCustomizationUuid\": \"367a8ba9-057a-4506-b106-fbae818597c6\",\r\n\"modelInstanceName\": \"Sec_Tunnel_Xconn 11\"\r\n},\r\n\"toscaNodeType\": \"\",\r\n\"allottedResourceType\": \"\",\r\n\"allottedResourceRole\": null,\r\n\"providingServiceModelName\": null,\r\n\"providingServiceModelInvariantUuid\": null,\r\n\"providingServiceModelUuid\": null,\r\n\"nfFunction\": null,\r\n\"nfType\": null,\r\n\"nfRole\": null,\r\n\"nfNamingCode\": null\r\n}\r\n]\r\n}"; private final String serviceUUID = "5df8b6de-2083-11e7-93ae-92361f002671"; + + private final String arResourceUUID = "25e2d69b-3b22-47b8-b4c9-7b14fd4a80df"; private final String serviceInvariantUUID = "9647dfc4-2083-11e7-93ae-92361f002671"; @@ -650,6 +654,42 @@ public class CatalogDBRestTest { assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); JSONAssert.assertEquals(expectedAllottedResponse, response.getBody().toString(), false); } + + @Test + public void testResourceReceipe() throws JSONException { + String expectedResourceRecipe = "{\"orchestrationUri\":\"/mso/async/services/CreateSDNCNetworkResource\",\"action\":\"createInstance\",\"description\":\"sotnvpnattachmentvF\",\"id\":\"1\",\"recipeTimeout\":\"180\",\"paramXSD\":\"\"}"; + + HttpEntity<String> entity = new HttpEntity<String>(null, headers); + headers.set("Accept", MediaType.APPLICATION_JSON); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE)) + .queryParam("resourceModelUuid", arResourceUUID) + .queryParam("action", "createInstance"); + + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.GET, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); + JSONAssert.assertEquals(expectedResourceRecipe, response.getBody().toString(), false); + } + + @Test + public void testResourceReceipeNotMatched() throws JSONException { + + HttpEntity<String> entity = new HttpEntity<String>(null, headers); + headers.set("Accept", MediaType.APPLICATION_JSON); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_V2_RESOURCE_RECEIPE)) + .queryParam("resourceModelUuid", arResourceUUID) + .queryParam("action", "invalid_action"); + + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.GET, entity, String.class); + + assertEquals(Response.Status.NOT_FOUND.getStatusCode(),response.getStatusCode().value()); + } @Test public void testGetServiceAllottedResourcesByServiceModelInvariantUuid() throws JSONException { |