summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieu Geerebaert <matthieu.geerebaert@orange.com>2018-04-23 14:14:32 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-23 14:14:32 +0000
commit71e7ffef63a2e998541a4ba68f832ec5c7dfcb5f (patch)
treed57e2f4b20a43f23fb798a516b6b54ec758b04d6
parent4b6f47675f737facceac44d61db9f418925cbb43 (diff)
parent3e79da4249c0c76ddf25af5c0447fa41f2eceeed (diff)
Merge "fix NPE on NBI serviceInventory"
-rw-r--r--src/test/java/org/onap/nbi/apis/ApiTest.java13
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java22
-rw-r--r--src/test/resources/mappings/aai_get_service-subscriptionWithoutList.json19
3 files changed, 54 insertions, 0 deletions
diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java
index c65f60b..563760e 100644
--- a/src/test/java/org/onap/nbi/apis/ApiTest.java
+++ b/src/test/java/org/onap/nbi/apis/ApiTest.java
@@ -180,6 +180,19 @@ public class ApiTest {
}
+ @Test
+ public void testServiceResourceGetInventoryWithoutRelationShipList() throws Exception {
+
+ String serviceName = "vFW";
+ String serviceId = "e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList";
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ params.add("serviceSpecification.name", serviceName);
+ params.add("relatedParty.id", "6490");
+ ResponseEntity<Object> resource = serviceInventoryResource.getServiceInventory(serviceId, params);
+ ServiceInventoryAssertions.assertServiceInventoryGetWithoutList(resource);
+
+ }
+
@Test
public void testServiceResourceGetInventoryWithServiceSpecId() throws Exception {
diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java
index 56a6180..f68b82f 100644
--- a/src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java
@@ -54,6 +54,28 @@ public class ServiceInventoryAssertions {
}
+ public static void assertServiceInventoryGetWithoutList(ResponseEntity<Object> resource) {
+ assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.OK);
+ LinkedHashMap service = (LinkedHashMap) resource.getBody();
+ assertThat(service.get("id")).isEqualTo("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
+ assertThat(service.get("name")).isEqualTo("NewFreeRadius-service-instance-01");
+ assertThat(service.get("hasStarted")).isEqualTo("yes");
+ assertThat(service.get("type")).isEqualTo("service-instance");
+ assertThat(service.get("@type")).isEqualTo("serviceONAP");
+ LinkedHashMap relatedParty = (LinkedHashMap) service.get("relatedParty");
+ assertThat(relatedParty.get("role")).isEqualTo("ONAPcustomer");
+ assertThat(relatedParty.get("id")).isEqualTo("6490");
+ LinkedHashMap serviceSpecification = (LinkedHashMap) service.get("serviceSpecification");
+ assertThat(serviceSpecification.get("id")).isEqualTo("98d95267-5e0f-4531-abf8-f14b90031dc5");
+ assertThat(serviceSpecification.get("invariantUUID")).isEqualTo("709d157b-52fb-4250-976e-7133dff5c347");
+ assertThat(serviceSpecification.get("@type")).isEqualTo("ONAPservice");
+
+ assertThat(((ArrayList) service.get("supportingResource")).size()).isEqualTo(0);
+
+ }
+
+
+
public static void assertServiceInventoryFind(ResponseEntity<Object> resource) {
assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.OK);
ArrayList body = (ArrayList) resource.getBody();
diff --git a/src/test/resources/mappings/aai_get_service-subscriptionWithoutList.json b/src/test/resources/mappings/aai_get_service-subscriptionWithoutList.json
new file mode 100644
index 0000000..2765c77
--- /dev/null
+++ b/src/test/resources/mappings/aai_get_service-subscriptionWithoutList.json
@@ -0,0 +1,19 @@
+{
+ "request": {
+ "method": "GET",
+ "url": "/aai/v11/business/customers/customer/6490/service-subscriptions/service-subscription/vFW/service-instances/service-instance/e4688e5f-61a0-4f8b-ae02-a2fbde623bcbWithoutList"
+ },
+ "response": {
+ "status": 200,
+ "jsonBody": {
+ "service-instance-id": "e4688e5f-61a0-4f8b-ae02-a2fbde623bcb",
+ "service-instance-name": "NewFreeRadius-service-instance-01",
+ "model-invariant-id": "709d157b-52fb-4250-976e-7133dff5c347",
+ "model-version-id": "98d95267-5e0f-4531-abf8-f14b90031dc5",
+ "resource-version": "1518508381261"
+ },
+ "headers": {
+ "Content-Type": "application/json"
+ }
+ }
+} \ No newline at end of file