From b9ea64ef7fa6c35a15e14a080789af6dafc6c0fb Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Sat, 8 Sep 2018 10:27:49 -0400 Subject: fixed null pointer on northbound Removed ID from sample request JSON Added null check to fix null query value parameter error Change-Id: I1bf427b7864560bbbd577972763be439edad6ec0 Issue-ID: SO-943 Signed-off-by: Benjamin, Max (mb388a) --- .../onap/so/apihandlerinfra/ServiceInstances.java | 4 +- .../so/apihandlerinfra/ServiceInstancesTest.java | 2 +- .../ServiceInstanceTest/NetworkInstance.json | 59 ++++++---------------- 3 files changed, 20 insertions(+), 45 deletions(-) (limited to 'mso-api-handlers') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index 672ab13868..60b07fdeab 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -1511,7 +1511,9 @@ public class ServiceInstances { } }else{ //ok for version < 3 and action delete - recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString()); + if(modelName != null){ + recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString()); + } } if(recipe == null){ diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index e9e50148ff..e4ec850c4e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -1633,7 +1633,7 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + - "modelName=GR-API-DEFAULT&action=deleteInstance")) + "modelName=VNF-API-DEFAULT&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json index 993310d48f..a37fe050eb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json @@ -1,45 +1,18 @@ { - "requestDetails": { - "cloudConfiguration": { - "lcpCloudRegionId": "mtn6", - "tenantId": "19123c2924c648eb8e42a3c1f14b7682" - }, - "modelInfo": { - "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21", - "modelName": "TestNetworkType", - "modelType": "network", - "modelVersion": "2.0", - "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb", - "modelCustomizationId": "3bdbb104-476c-483e-9f8b-c095b3d308ac" - }, - "requestInfo": { - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "requestorId": "xxxxxx", - "source": "VID", - "suppressRollback": false, - "instanceName": "tested" - }, - "requestParameters": { - "aLaCarte" : true, - "autoBuildVfModules": false, - "subscriptionServiceType": "MSO-dev-service-type", - "userParams": [ - { - "name": "aic_zone", - "value": "mtn6" - } - ] - }, - "subscriberInfo": { - "globalSubscriberId": "MSO_1610_dev", - "subscriberName": "MSO_1610_dev" - }, - "project": { - "projectName": "projectName" - }, - "owningEntity": { - "owningEntityId": "oeId", - "owningEntityName": "oeName" - } - } + "requestDetails":{ + "modelInfo":{ + "modelType":"network" + }, + "requestInfo":{ + "source":"VID", + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "testApi":"VNF_API" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"cloudRegionId", + "tenantId":"821553e85fd2461ab205bcd45cc3eeda" + } + } } \ No newline at end of file -- cgit 1.2.3-korg