summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kabaj <michal.kabaj@nokia.com>2019-06-12 08:15:31 +0200
committerMichal Kabaj <michal.kabaj@nokia.com>2019-06-12 08:15:31 +0200
commit6c98119d3f394b85683aa1625ca2c63d76235e36 (patch)
tree2706500638e8cc681a2a5a9238836ce921624c3e
parentf0ab6c540529dadd0318bb2eb9c012d0c3dcea16 (diff)
AaiController unit tests
- unit tests for getPNFInstances Change-Id: I9d77ad0e15be23dc169721c6b73bea9fb1ecaf19 Issue-ID: VID-478 Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java25
1 files changed, 25 insertions, 0 deletions
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<String> 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));
+ }
}