From 6c98119d3f394b85683aa1625ca2c63d76235e36 Mon Sep 17 00:00:00 2001 From: Michal Kabaj Date: Wed, 12 Jun 2019 08:15:31 +0200 Subject: AaiController unit tests - unit tests for getPNFInstances Change-Id: I9d77ad0e15be23dc169721c6b73bea9fb1ecaf19 Issue-ID: VID-478 Signed-off-by: Michal Kabaj --- .../org/onap/vid/controller/AaiControllerTest.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'vid-app-common') diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java index 35e098c1b..301101399 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java @@ -199,5 +199,30 @@ public class AaiControllerTest { pnf.setPnfName("TestPnf"); return pnf; } + + public void getPNFInstances_shouldReturnOKResponseFromAAIService() throws Exception { + String globalCustomerId = "testCustomerId"; + String serviceType = "testServiceType"; + String modelVersionId = UUID.nameUUIDFromBytes("modelVersionId".getBytes()).toString(); + String modelInvariantId = UUID.nameUUIDFromBytes("modelInvariantId".getBytes()).toString(); + String cloudRegion = "testRegion"; + String equipVendor = "testVendor"; + String equipModel = "model123"; + String urlTemplate = "/aai_get_pnf_instances/{globalCustomerId}/{serviceType}/{modelVersionId}/{modelInvariantId}/{cloudRegion}/{equipVendor}/{equipModel}"; + String expectedResponseBody = "myResponse"; + AaiResponse aaiResponse = new AaiResponse<>(expectedResponseBody, "", HttpStatus.OK.value()); + + given(aaiService + .getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion, equipVendor, + equipModel)).willReturn(aaiResponse); + + mockMvc.perform( + get(urlTemplate, globalCustomerId, serviceType, modelVersionId, + modelInvariantId, cloudRegion, equipVendor, equipModel) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(expectedResponseBody)); + } } -- cgit 1.2.3-korg