From afd33b8c79d2efd61aaead30a5c83130808903d5 Mon Sep 17 00:00:00 2001 From: Arthur Martella Date: Wed, 28 Mar 2018 17:45:55 -0400 Subject: MSO API Handler Infra test repair Repairing a number of tests in ServiceInstancesTest. Change-Id: Ic74015fb092433a0aa26d22ea726321d1c98efe3 Issue-ID: SO-489 Signed-off-by: Arthur Martella --- .../openecomp/mso/apihandlerinfra/ServiceInstances.java | 2 +- .../mso/apihandlerinfra/ServiceInstanceTest.java | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java index dba562e927..fc8e8d9d6a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java @@ -985,7 +985,7 @@ public class ServiceInstances { } //if an aLaCarte flag was sent in the request, throw an error if the recipe was not found RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters(); - if(reqParam!=null && reqParam.isaLaCarte() && recipe==null){ + if(reqParam!=null && reqParam.isaLaCarte()!=null && reqParam.isaLaCarte() && recipe==null){ return null; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java index d8996a98b6..28cb51aa70 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java @@ -99,7 +99,6 @@ public class ServiceInstanceTest { "Locked instance - This service (testService) already has a request being worked with a status of null (RequestId - null). The existing request must finish or be cleaned up before proceeding.")); } - @Ignore // 1802 merge @Test public void createServiceInstanceTestDBException(){ new MockUp() { @@ -134,7 +133,7 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}"; Response resp = instance.createServiceInstance(requestJson, "v2"); String respBody = resp.getEntity().toString(); - assertTrue(respBody.contains("Exception while creating record in DB null")); + assertTrue(respBody.contains("Exception while creating record in DB") && respBody.contains("NullPointerException")); } @Ignore // 1802 merge @@ -179,10 +178,9 @@ public class ServiceInstanceTest { + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}"; Response resp = instance.createServiceInstance(requestJson, "v2"); String respBody = resp.getEntity().toString(); - assertTrue(respBody.contains("Failed calling bpmn properties")); + assertTrue(respBody.contains("Failed calling bpmn properties")); // was: Request Failed due to BPEL error } - @Ignore // 1802 merge @Test(expected = Exception.class) public void createServiceInstanceTest200Http(){ new MockUp() { @@ -253,7 +251,6 @@ public class ServiceInstanceTest { String respBody = resp.getEntity().toString(); } - @Ignore // 1802 merge @Test public void createServiceInstanceTest500Http(){ new MockUp() { @@ -396,7 +393,6 @@ public class ServiceInstanceTest { assertTrue(respBody.contains("No valid modelVersionId is specified")); } - @Ignore // 1802 merge @Test public void createServiceInstanceTestNullHttpResp(){ new MockUp() { @@ -592,7 +588,7 @@ public class ServiceInstanceTest { +"\"networkInstanceId\":\"1882937\"," +"\"volumeGroupInstanceId\":\"1882935\"," +"\"vfModuleInstanceId\":\"1882934\"," - + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\"}}}"; + + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\":\"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\"}}}"; Response resp = instance.createServiceInstance(requestJson, "v2"); String respBody = resp.getEntity().toString(); assertTrue(respBody.contains("Error parsing request.") && respBody.contains("No valid modelName is specified")); @@ -607,7 +603,7 @@ public class ServiceInstanceTest { +"\"networkInstanceId\":\"1882937\"," +"\"volumeGroupInstanceId\":\"1882935\"," +"\"vfModuleInstanceId\":\"1882934\"," - + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": true},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}"; + + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": true,\"subscriptionServiceType\":\"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}"; Response resp = instance.createServiceInstance(requestJson, "v2"); String respBody = resp.getEntity().toString(); assertTrue(respBody.contains("Error parsing request.") && respBody.contains("AutoBuildVfModule is not valid in the v2 version")); @@ -689,7 +685,6 @@ public class ServiceInstanceTest { assertTrue(respStr.contains("Error parsing request.") && respStr.contains("No valid serviceInstanceId matching the serviceInstanceId in request URI is specified")); } - @Ignore // 1802 merge @Test public void activateServiceInstanceTestNormal(){ ServiceInstances instance = new ServiceInstances(); @@ -743,7 +738,6 @@ public class ServiceInstanceTest { assertTrue(respStr.contains("Error parsing request.") && respStr.contains("No valid serviceInstanceId matching the serviceInstanceId in request URI is specified")); } - @Ignore // 1802 merge @Test public void deactivateServiceInstanceTestNormal(){ ServiceInstances instance = new ServiceInstances(); @@ -797,7 +791,6 @@ public class ServiceInstanceTest { assertTrue(respStr.contains("Error parsing request.") && respStr.contains("No valid modelVersionId is specified")); } - @Ignore // 1802 merge @Test public void deleteServiceInstanceTestNormal(){ ServiceInstances instance = new ServiceInstances(); @@ -961,7 +954,6 @@ public class ServiceInstanceTest { } /*** Replace Vnf Instance Test Cases ***/ - @Ignore @Test public void replaceVNFInstanceTestNormal(){ ServiceInstances instance = new ServiceInstances(); @@ -996,7 +988,6 @@ public class ServiceInstanceTest { /*** Update Vnf Instance Test Cases ***/ - @Ignore @Test public void deleteVNFInstanceTestNormal(){ ServiceInstances instance = new ServiceInstances(); -- cgit 1.2.3-korg