aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java469
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java491
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java2
7 files changed, 980 insertions, 13 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index 4490d78648..f9150fabf0 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -240,6 +240,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
index f3273cf144..f6abcc35b1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ManualTasks.java
@@ -143,6 +143,7 @@ public class ManualTasks {
msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", requestUrl, null);
} catch (Exception e) {
+ msoLogger.debug ("Exception:", e);
msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", requestUrl, null);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
index eab232d4d5..5328780b21 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java
@@ -149,7 +149,7 @@ public class MsoRequest {
RequestError re = new RequestError();
- if(exceptionType.name().equals("PolicyException")){
+ if("PolicyException".equals(exceptionType.name())){
PolicyException pe = new PolicyException();
pe.setMessageId(messageId);
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 e32f1535d4..66a14db610 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
@@ -73,10 +73,10 @@ import com.wordnik.swagger.annotations.ApiOperation;
@Api(value="/serviceInstances",description="API Requests for Service Instances")
public class ServiceInstances {
- private HashMap<String, String> instanceIdMap = new HashMap<String,String>();
+ private HashMap<String, String> instanceIdMap = new HashMap<>();
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
- public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+ public static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
@POST
@Path("/{version:[vV][3-5]}")
@@ -404,7 +404,7 @@ public class ServiceInstances {
String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name();
try {
- if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance))){
+ if(!(instanceName==null && "service".equals(requestScope) && (action == Action.createInstance || action == Action.activateInstance))){
dup = (RequestsDatabase.getInstance()).checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
}
} catch (Exception e) {
@@ -423,7 +423,7 @@ public class ServiceInstances {
if (dup != null) {
// Found the duplicate record. Return the appropriate error.
- String instance = null;
+ String instance;
if(instanceName != null){
instance = instanceName;
}else{
@@ -533,7 +533,7 @@ public class ServiceInstances {
String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion ();
// Get VF Module-specific base module indicator
- VfModule vfm = null;
+ VfModule vfm;
String modelVersionId = msoRequest.getModelInfo().getModelVersionId();
@@ -627,7 +627,7 @@ public class ServiceInstances {
// Capture audit event
msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
- System.out.println("URL : " + requestClient.getUrl ());
+ msoLogger.debug ("URL : " + requestClient.getUrl ());
response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (),
serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId,
@@ -684,7 +684,7 @@ public class ServiceInstances {
msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody);
return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build ();
} else {
- List<String> variables = new ArrayList<String>();
+ List<String> variables = new ArrayList<>();
variables.add(bpelStatus + "");
String camundaJSONResponseBody = respHandler.getResponseBody ();
if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) {
@@ -754,7 +754,7 @@ public class ServiceInstances {
// TODO need to make this a configurable property
String defaultServiceModelName = msoRequest.getRequestInfo().getSource() + "_DEFAULT";
- Service serviceRecord = null;
+ Service serviceRecord;
ModelInfo modelInfo = msoRequest.getModelInfo();
if(msoRequest.getALaCarteFlag()){
serviceRecord = db.getServiceByModelName(defaultServiceModelName);
@@ -840,7 +840,7 @@ public class ServiceInstances {
// 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to look it up in our catalog to construct vnf-type value to pass to BPMN.
VnfResource vnfResource = null;
- VnfResourceCustomization vrc = null;
+ VnfResourceCustomization vrc;
// Validation for vnfResource
if(modelCustomizationId!=null) {
@@ -893,7 +893,7 @@ public class ServiceInstances {
if(!msoRequest.getALaCarteFlag()) {
VfModuleCustomization vfmc = null;
- VnfResourceCustomization vnfrc = null;
+ VnfResourceCustomization vnfrc;
VfModule vfModule = null;
if( modelInfo.getModelCustomizationId() != null) {
@@ -971,7 +971,7 @@ public class ServiceInstances {
ModelInfo modelInfo = msoRequest.getModelInfo();
String modelName = modelInfo.getModelName();
- Recipe recipe = null;
+ Recipe recipe;
if(msoRequest.getALaCarteFlag()){
recipe = db.getNetworkRecipe(defaultNetworkType, action.name());
}else{
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
new file mode 100644
index 0000000000..f656d896fe
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java
@@ -0,0 +1,469 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.apihandlerinfra;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.junit.Test;
+import org.openecomp.mso.apihandler.common.CamundaClient;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class E2EServiceInstancesTest {
+
+
+ @Test
+ public void createE2EServiceInstanceTestSuccess(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 0;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,202, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ assertTrue(resp.getStatus() == 202);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPException(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 0;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 0;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBPELResponse(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails){
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("bpelResponse is null") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBPMNNullREsponse(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action){
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Failed calling bpmn null") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBpmn(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String modelName) {
+ Service svc = new Service();
+ return svc;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID(String modelUUID, String action) {
+ ServiceRecipe rec = new ServiceRecipe();
+ return rec;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Failed calling bpmn properties is null") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullReceipe(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullDBResponse(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return null;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestInvalidRequest(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ List<InfraActiveRequests> activeReqlist = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("39493992");
+
+ activeReqlist.add(req);
+ return activeReqlist;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("The existing request must finish or be cleaned up before proceeding.") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestEmptyDBQuery(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return Collections.EMPTY_LIST;
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestDBQueryFail(){
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestForEmptyRequest(){
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "";
+ Response resp = instance.createE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
+ }
+
+ @Test
+ public void deleteE2EServiceInstanceTestNormal(){
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
+ Response resp = instance.deleteE2EServiceInstance(request, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+}
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
new file mode 100644
index 0000000000..ee789a60ca
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
@@ -0,0 +1,491 @@
+package org.openecomp.mso.apihandlerinfra;
+
+
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.junit.Test;
+
+import javax.ws.rs.core.Response;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class ServiceInstanceTest {
+
+ /*** Create Service Instance Test Cases ***/
+
+ @Test
+ public void createServiceInstanceInvalidModelInfo(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNormalNullDBFatch(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ private List<InfraActiveRequests> executeInfraQuery (List <Criterion> criteria, Order order) {
+ return Collections.EMPTY_LIST;
+ }
+ };
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"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.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
+ }
+
+
+ @Test
+ public void createServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"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, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullInstanceName(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"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.indexOf("Error parsing request. No valid instanceName is specified") != -1);
+ }
+
+
+ @Test
+ public void createServiceInstanceNullModelInfo(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid model-info is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceInvalidModelInvariantId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"1234\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullModelVersion(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ }
+
+
+ @Test
+ public void createServiceInstanceNullModelType(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"},\"requestParameters\": { \"autoBuildVfModules\": false},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceInvalidModelType(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"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\":\"testmodel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Mapping of request to JSON object failed.") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullModelName(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"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\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid modelName is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceInvalidVersionForAutoBuildVfModules(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"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\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. AutoBuildVfModule is not valid in the v2 version") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullRequestParameter(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"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\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceNullSubscriptionType(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"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\",\"modelName\":\"serviceModel\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.indexOf("Error parsing request. No valid subscriptionServiceType is specified") != -1);
+ }
+
+ @Test
+ public void createServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.createServiceInstance(requestJson, "v2");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ /*** Activate Service Instance Test Cases ***/
+
+ @Test
+ public void activateServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ @Test
+ public void activateServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"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.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ }
+
+ @Test
+ public void activateServiceInstanceInvalidServiceInstanceId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ }
+
+ @Test
+ public void activateServiceInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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.activateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Deactivate Service Instance Test Cases ***/
+
+ @Test
+ public void deactivateServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ @Test
+ public void deactivateServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"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.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId in relatedInstance is specified") != -1);
+ }
+
+ @Test
+ public void deactivateServiceInstanceInvalidServiceInstanceId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified") != -1);
+ }
+
+ @Test
+ public void deactivateServiceInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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.deactivateServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Delete Service Instance Test Cases ***/
+
+ @Test
+ public void deleteServiceInstanceAnbormalInvalidJson(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"name\":\"test\"}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed") != -1);
+ }
+
+ @Test
+ public void deleteServiceInstanceInvalidModelVersionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\"}}}],\"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.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ }
+
+ @Test
+ public void deleteServiceInstanceInvalidServiceInstanceId(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d37\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid modelVersionId is specified") != -1);
+ }
+
+ @Test
+ public void deleteServiceInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.deleteServiceInstance(requestJson, "v5","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Create Vnf Instance Test Cases ***/
+
+ @Test
+ public void createVNFInstanceTestInvalidCloudConfiguration(){
+ ServiceInstances instance = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid cloudConfiguration is specified") != -1);
+ }
+
+ @Test
+ public void createVNFInstanceTestInvalidIcpCloudRegionId(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid lcpCloudRegionId is specified") != -1);
+ }
+
+ @Test
+ public void createVNFInstanceTestInvalidTenantId(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("Error parsing request. No valid tenantId is specified") != -1);
+ }
+
+ @Test
+ public void createVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Replace Vnf Instance Test Cases ***/
+ @Test
+ public void replaceVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.replaceVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Update Vnf Instance Test Cases ***/
+
+ @Test
+ public void updateVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.updateVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+
+ /*** Update Vnf Instance Test Cases ***/
+
+ @Test
+ public void deleteVNFInstanceTestNormal(){
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\","
+ +"\"vnfInstanceId\":\"1882938\","
+ +"\"networkInstanceId\":\"1882937\","
+ +"\"volumeGroupInstanceId\":\"1882935\","
+ +"\"vfModuleInstanceId\":\"1882934\","
+ + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"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\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ Response resp = instance.deleteVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34","557ea944-c83e-43cf-9ed7-3a354abd6d93");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.indexOf("SVC2000") != -1);
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index 8db4548bad..254ae3bf39 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -332,7 +332,7 @@ public class RequestsDatabase {
}
}
catch (Exception e){
- msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage());
+ msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e);
return null;
}
}