Adding UT for SO 05/17405/1
authorseshukm <seshu.kumar.m@huawei.com>
Fri, 6 Oct 2017 05:40:59 +0000 (11:10 +0530)
committerseshukm <seshu.kumar.m@huawei.com>
Fri, 6 Oct 2017 05:40:59 +0000 (11:10 +0530)
IssueId: SO-191

Change-Id: Ic9fb77341842fd48efc81341c3a42c26d101b60d
Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java [new file with mode: 0644]
asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java

diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java
new file mode 100644 (file)
index 0000000..f231c75
--- /dev/null
@@ -0,0 +1,213 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapter_utils.tests;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import org.junit.Test;\r
+import org.openecomp.mso.entity.MsoRequest;\r
+import org.openecomp.mso.openstack.beans.HeatStatus;\r
+import org.openecomp.mso.openstack.beans.MsoTenant;\r
+import org.openecomp.mso.openstack.beans.NetworkInfo;\r
+import org.openecomp.mso.openstack.beans.NetworkRollback;\r
+import org.openecomp.mso.openstack.beans.NetworkStatus;\r
+import org.openecomp.mso.openstack.beans.Pool;\r
+import org.openecomp.mso.openstack.beans.StackInfo;\r
+import org.openecomp.mso.openstack.beans.Subnet;\r
+import org.openecomp.mso.openstack.beans.VnfRollback;\r
+\r
+import com.woorea.openstack.heat.model.Stack;\r
+\r
+public class AdapterBeansTest {\r
+       @Test\r
+       public final void msoTenantTest() {\r
+               MsoTenant tenant = new MsoTenant();\r
+               tenant.setTenantId("1");\r
+               assertTrue(tenant.getTenantId().equalsIgnoreCase("1"));\r
+               tenant.setTenantName("TenantName");\r
+               assertTrue(tenant.getTenantName().equalsIgnoreCase("TenantName"));\r
+               Map<String, String> hm = new HashMap<>();\r
+               hm.put("Key1", "value1");\r
+               tenant.setMetadata(hm);\r
+               assertTrue(tenant.getMetadata() != null);\r
+               new MsoTenant("1", "TenantName", hm);\r
+               // assertTrue(tenant.toString() != null);\r
+       }\r
+\r
+       @Test\r
+       public final void networkInfoTest() {\r
+               NetworkInfo networkInfo = new NetworkInfo();\r
+               networkInfo.setName("name");\r
+               assertTrue(networkInfo.getName().equalsIgnoreCase("name"));\r
+               networkInfo.setId("1");\r
+               assertTrue(networkInfo.getId().equalsIgnoreCase("1"));\r
+               networkInfo.setStatus(NetworkStatus.ACTIVE);\r
+               assertTrue(networkInfo.getStatus().equals(NetworkStatus.ACTIVE));\r
+               networkInfo.setProvider("provider");\r
+               networkInfo.getProvider().equalsIgnoreCase("provider");\r
+               List<Integer> al = new ArrayList<>();\r
+               al.add(1);\r
+               al.add(2);\r
+               networkInfo.setVlans(al);\r
+               assertTrue(networkInfo.getVlans() != null);\r
+               networkInfo.setShared("shared");\r
+               assertTrue(networkInfo.getShared().equalsIgnoreCase("shared"));\r
+               List<String> als = new ArrayList<>();\r
+               als.add("1");\r
+               als.add("2");\r
+               networkInfo.setSubnets(als);\r
+               assertTrue(networkInfo.getSubnets() != null);\r
+               new NetworkInfo("string", NetworkStatus.ACTIVE);\r
+               assertTrue(networkInfo.toString() != null);\r
+       }\r
+\r
+       @Test\r
+       public final void networkRollbackTest() {\r
+               NetworkRollback networkRollback = new NetworkRollback();\r
+               networkRollback.setCloudId("cloudId");\r
+               assertTrue(networkRollback.getCloudId().equalsIgnoreCase("cloudId"));\r
+               networkRollback.setModelCustomizationUuid("modelCustomizationUuid");\r
+               assertTrue(networkRollback.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid"));\r
+               MsoRequest msoRequest = new MsoRequest();\r
+               networkRollback.setMsoRequest(msoRequest);\r
+               networkRollback.getMsoRequest();\r
+               // assertTrue(networkRollback.getMsoRequest() == null);\r
+               networkRollback.setNetworkCreated(Boolean.TRUE);\r
+               assertTrue(networkRollback.getNetworkCreated());\r
+               networkRollback.setNetworkId("networkId");\r
+               assertTrue(networkRollback.getNetworkId().equalsIgnoreCase("networkId"));\r
+               networkRollback.setNetworkName("networkName");\r
+               assertTrue(networkRollback.getNetworkName().equalsIgnoreCase("networkName"));\r
+               networkRollback.setNetworkStackId("networkStackId");\r
+               assertTrue(networkRollback.getNetworkStackId().equalsIgnoreCase("networkStackId"));\r
+               networkRollback.setNetworkType("networkType");\r
+               assertTrue(networkRollback.getNetworkType().equalsIgnoreCase("networkType"));\r
+               networkRollback.setNeutronNetworkId("neutronNetworkId");\r
+               assertTrue(networkRollback.getNeutronNetworkId().equalsIgnoreCase("neutronNetworkId"));\r
+               networkRollback.setPhysicalNetwork("physicalNetwork");\r
+               assertTrue(networkRollback.getPhysicalNetwork().equalsIgnoreCase("physicalNetwork"));\r
+               networkRollback.setTenantId("tenantId");\r
+               assertTrue(networkRollback.getTenantId().equalsIgnoreCase("tenantId"));\r
+               List<Integer> al = new ArrayList<>();\r
+               al.add(1);\r
+               al.add(2);\r
+               networkRollback.setVlans(al);\r
+               assertTrue(networkRollback.getVlans() != null);\r
+               assertTrue(networkRollback.toString() != null);\r
+       }\r
+\r
+       @Test\r
+       public final void poolTest() {\r
+               Pool p = new Pool();\r
+               p.setStart("start");\r
+               p.getStart();\r
+               p.setEnd("end");\r
+               p.getEnd();\r
+               p.toString();\r
+       }\r
+\r
+       @Test\r
+       public final void stackInfoTest() {\r
+               StackInfo stackInfo = new StackInfo();\r
+               new StackInfo(new Stack());\r
+               new StackInfo("name", HeatStatus.CREATED, "statusmessage", new HashMap<>());\r
+               new StackInfo("name", HeatStatus.CREATED);\r
+               stackInfo.setCanonicalName("Canonicalname");\r
+               stackInfo.getCanonicalName();\r
+               stackInfo.setName("name");\r
+               stackInfo.getName();\r
+               stackInfo.setOutputs(new HashMap<>());\r
+               stackInfo.getOutputs();\r
+               stackInfo.setParameters(new HashMap<>());\r
+               stackInfo.getParameters();\r
+               stackInfo.setStatus(HeatStatus.CREATED);\r
+               stackInfo.getStatus();\r
+               stackInfo.setStatusMessage("statusMessage");\r
+               stackInfo.getStatusMessage();\r
+       }\r
+\r
+       @Test\r
+       public final void subnetTest() {\r
+               Subnet subnet = new Subnet();\r
+               subnet.setAllocationPools(new ArrayList<>());\r
+               subnet.getAllocationPools();\r
+               subnet.setCidr("cidr");\r
+               subnet.getCidr();\r
+               subnet.setDnsNameServers(new ArrayList<>());\r
+               subnet.getDnsNameServers();\r
+               subnet.setEnableDHCP(true);\r
+               subnet.getEnableDHCP();\r
+               subnet.setGatewayIp("gatewayIp");\r
+               subnet.getGatewayIp();\r
+               subnet.setHostRoutes(new ArrayList<>());\r
+               subnet.getHostRoutes();\r
+               subnet.setIpVersion("ipVersion");\r
+               subnet.getIpVersion();\r
+               subnet.setNeutronId("neutronId");\r
+               subnet.getNeutronId();\r
+               subnet.setSubnetId("subnetId");\r
+               subnet.getSubnetId();\r
+               subnet.setSubnetName("subnetName");\r
+               subnet.getSubnetName();\r
+               subnet.toString();\r
+       }\r
+\r
+       @Test\r
+       public final void vnfRollbackTest() {\r
+               VnfRollback vnfRollback = new VnfRollback();\r
+               new VnfRollback("vnfId", "tenantId", "cloudSiteId", true, true, new MsoRequest(), "volumeGroupName",\r
+                               "volumeGroupId", "requestType", "modelCustomizationUuid");\r
+               vnfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId");\r
+               vnfRollback.getBaseGroupHeatStackId();\r
+               vnfRollback.setCloudSiteId("cloudId");\r
+               vnfRollback.getCloudSiteId();\r
+               vnfRollback.setIsBase(false);\r
+               vnfRollback.isBase();\r
+               vnfRollback.setModelCustomizationUuid("modelCustomizationUuid");\r
+               vnfRollback.getModelCustomizationUuid();\r
+               vnfRollback.setMsoRequest(new MsoRequest());\r
+               vnfRollback.getMsoRequest();\r
+               vnfRollback.setRequestType("requestType");\r
+               vnfRollback.getRequestType();\r
+               vnfRollback.setTenantCreated(true);\r
+               vnfRollback.getTenantCreated();\r
+               vnfRollback.setTenantId("tenantId");\r
+               vnfRollback.getTenantId();\r
+               vnfRollback.setVfModuleStackId("vfModuleStackId");\r
+               vnfRollback.getVfModuleStackId();\r
+               vnfRollback.setVnfCreated(true);\r
+               vnfRollback.getVnfCreated();\r
+               vnfRollback.setVnfId("vnfId");\r
+               vnfRollback.getVnfId();\r
+               vnfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId");\r
+               vnfRollback.getVolumeGroupHeatStackId();\r
+               vnfRollback.setVolumeGroupId("volumeGroupId");\r
+               vnfRollback.getVolumeGroupId();\r
+               vnfRollback.setVolumeGroupName("volumeGroupName");\r
+               vnfRollback.getVolumeGroupName();\r
+               vnfRollback.toString();\r
+       }\r
+}\r
diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/tests/ASDCNotificationLoggingTest.java
new file mode 100644 (file)
index 0000000..1d65501
--- /dev/null
@@ -0,0 +1,174 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.asdc.util.tests;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.junit.Test;\r
+import org.openecomp.mso.asdc.installer.IVfModuleData;\r
+import org.openecomp.mso.asdc.installer.VfModuleMetaData;\r
+import org.openecomp.mso.asdc.util.ASDCNotificationLogging;\r
+import org.openecomp.sdc.api.notification.IArtifactInfo;\r
+import org.openecomp.sdc.api.notification.INotificationData;\r
+import org.openecomp.sdc.api.notification.IResourceInstance;\r
+\r
+public class ASDCNotificationLoggingTest {\r
+       @Test\r
+       public void dumpASDCNotificationTestForNull() throws Exception {\r
+               INotificationData asdcNotification = iNotificationDataObject();\r
+\r
+               String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);\r
+\r
+               assertTrue(!result.equalsIgnoreCase("NULL"));\r
+       }\r
+\r
+       private INotificationData iNotificationDataObject() {\r
+               INotificationData iNotification = new INotificationData() {\r
+\r
+                       @Override\r
+                       public String getServiceVersion() {\r
+                               return "DistributionID";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getServiceUUID() {\r
+                               return "12343254";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getServiceName() {\r
+                               return "servername";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getServiceInvariantUUID() {\r
+                               return "ServiceInvariantUUID";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getServiceDescription() {\r
+                               return "Description";\r
+                       }\r
+\r
+                       @Override\r
+                       public List<IArtifactInfo> getServiceArtifacts() {\r
+                               return new ArrayList();\r
+                       }\r
+\r
+                       @Override\r
+                       public List<IResourceInstance> getResources() {\r
+                               return new ArrayList();\r
+                       }\r
+\r
+                       @Override\r
+                       public String getDistributionID() {\r
+                               return "23434";\r
+                       }\r
+\r
+                       @Override\r
+                       public IArtifactInfo getArtifactMetadataByUUID(String arg0) {\r
+                               return null;\r
+                       }\r
+               };\r
+               return iNotification;\r
+       }\r
+\r
+       @Test\r
+       public void dumpASDCNotificationTest() throws Exception {\r
+               INotificationData asdcNotification = iNotificationDataObject();\r
+               String result = ASDCNotificationLogging.dumpASDCNotification(asdcNotification);\r
+\r
+               assertTrue(!result.equalsIgnoreCase("NULL"));\r
+       }\r
+\r
+       @Test\r
+       public void dumpVfModuleMetaDataListTest() {\r
+               INotificationData asdcNotification = iNotificationDataObject();\r
+               List<IVfModuleData> list = new ArrayList<>();\r
+               list.add(new VfModuleMetaData());\r
+               String result = null;\r
+               try {\r
+                       result = ASDCNotificationLogging.dumpVfModuleMetaDataList(list);\r
+               } catch (Exception e) {\r
+               }\r
+\r
+               assertTrue(result == null);\r
+\r
+       }\r
+\r
+       public IArtifactInfo getIArtifactInfo() {\r
+               return new IArtifactInfo() {\r
+\r
+                       @Override\r
+                       public List<IArtifactInfo> getRelatedArtifacts() {\r
+                               return null;\r
+                       }\r
+\r
+                       @Override\r
+                       public IArtifactInfo getGeneratedArtifact() {\r
+                               return null;\r
+                       }\r
+\r
+                       @Override\r
+                       public String getArtifactVersion() {\r
+                               return "version";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getArtifactUUID() {\r
+                               return "123";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getArtifactURL() {\r
+                               return "url";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getArtifactType() {\r
+                               return "type";\r
+                       }\r
+\r
+                       @Override\r
+                       public Integer getArtifactTimeout() {\r
+                               return 12;\r
+                       }\r
+\r
+                       @Override\r
+                       public String getArtifactName() {\r
+                               return "name";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getArtifactDescription() {\r
+                               return "desc";\r
+                       }\r
+\r
+                       @Override\r
+                       public String getArtifactChecksum() {\r
+                               return "true";\r
+                       }\r
+               };\r
+       }\r
+}\r
index d1d8544..08abf57 100644 (file)
 package org.openecomp.mso.apihandlerinfra;\r
 \r
 \r
+import org.apache.http.HttpResponse;\r
+import org.apache.http.ProtocolVersion;\r
+import org.apache.http.entity.BasicHttpEntity;\r
+import org.apache.http.message.BasicHttpResponse;\r
 import org.hibernate.criterion.Criterion;\r
 import org.hibernate.criterion.Order;\r
 import org.junit.Test;\r
@@ -31,9 +35,19 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;\r
 import static org.junit.Assert.fail;\r
 \r
+import java.io.ByteArrayInputStream;\r
+import java.io.InputStream;\r
 import java.util.Collections;\r
+import java.util.HashMap;\r
 import java.util.List;\r
 \r
+import org.openecomp.mso.apihandler.common.CamundaClient;\r
+import org.openecomp.mso.apihandler.common.RequestClient;\r
+import org.openecomp.mso.apihandler.common.RequestClientFactory;\r
+import org.openecomp.mso.db.catalog.CatalogDatabase;\r
+import org.openecomp.mso.db.catalog.beans.Service;\r
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;\r
+import org.openecomp.mso.properties.MsoJavaProperties;\r
 import org.openecomp.mso.requestsdb.InfraActiveRequests;\r
 import org.openecomp.mso.requestsdb.RequestsDatabase;\r
 \r
@@ -53,6 +67,383 @@ public class ServiceInstanceTest {
                assertTrue(respBody.indexOf("Error parsing request.  No valid model-info is specified") != -1);\r
        }\r
        \r
+       @Test\r
+       public void createServiceInstanceNormalDuplicate(){\r
+               new MockUp<RequestsDatabase>() {\r
+            @Mock\r
+            public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+                return new InfraActiveRequests();\r
+            }\r
+        };\r
+               ServiceInstances instance = new ServiceInstances();\r
+               String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
+                               +"\"vnfInstanceId\":\"1882938\","\r
+                               +"\"networkInstanceId\":\"1882937\","\r
+                               +"\"volumeGroupInstanceId\":\"1882935\","\r
+                               +"\"vfModuleInstanceId\":\"1882934\","\r
+                               + "\"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\"}}}";\r
+               Response resp = instance.createServiceInstance(requestJson, "v2");\r
+               String respBody = resp.getEntity().toString();\r
+               assertTrue(respBody.indexOf("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.") != -1);\r
+       }\r
+       \r
+       @Test\r
+       public void createServiceInstanceTestDBException(){\r
+               new MockUp<RequestsDatabase>() {\r
+            @Mock\r
+            public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+                return null;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public Service getServiceByModelName (String defaultServiceModelName) {\r
+               Service serviceRecord = new Service();\r
+               serviceRecord.setModelUUID("2883992993");\r
+               return serviceRecord;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+               ServiceRecipe recipe =new ServiceRecipe();\r
+               recipe.setOrchestrationUri("/test/mso");\r
+               recipe.setRecipeTimeout(1000);\r
+               return recipe;\r
+            }\r
+        };\r
+               ServiceInstances instance = new ServiceInstances();\r
+               String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
+                               +"\"vnfInstanceId\":\"1882938\","\r
+                               +"\"networkInstanceId\":\"1882937\","\r
+                               +"\"volumeGroupInstanceId\":\"1882935\","\r
+                               +"\"vfModuleInstanceId\":\"1882934\","\r
+                               + "\"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\"}}}";\r
+               Response resp = instance.createServiceInstance(requestJson, "v2");\r
+               String respBody = resp.getEntity().toString();\r
+               assertTrue(respBody.indexOf("Exception while creating record in DB null") != -1);\r
+       }\r
+       \r
+       @Test\r
+       public void createServiceInstanceTestBpmnFail(){\r
+               new MockUp<RequestsDatabase>() {\r
+            @Mock\r
+            public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+                return null;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public Service getServiceByModelName (String defaultServiceModelName) {\r
+               Service serviceRecord = new Service();\r
+               serviceRecord.setModelUUID("2883992993");\r
+               return serviceRecord;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+               ServiceRecipe recipe =new ServiceRecipe();\r
+               recipe.setOrchestrationUri("/test/mso");\r
+               recipe.setRecipeTimeout(1000);\r
+               return recipe;\r
+            }\r
+        };\r
+        \r
+        new MockUp<MsoRequest>() {\r
+            @Mock\r
+            public void createRequestRecord (Status status, Action action) {\r
+               return;\r
+            }\r
+        };\r
+               ServiceInstances instance = new ServiceInstances();\r
+               String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
+                               +"\"vnfInstanceId\":\"1882938\","\r
+                               +"\"networkInstanceId\":\"1882937\","\r
+                               +"\"volumeGroupInstanceId\":\"1882935\","\r
+                               +"\"vfModuleInstanceId\":\"1882934\","\r
+                               + "\"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\"}}}";\r
+               Response resp = instance.createServiceInstance(requestJson, "v2");\r
+               String respBody = resp.getEntity().toString();\r
+               assertTrue(respBody.indexOf("Failed calling bpmn properties") != -1);\r
+       }\r
+       \r
+       @Test(expected = Exception.class)\r
+       public void createServiceInstanceTest200Http(){\r
+               new MockUp<RequestsDatabase>() {\r
+            @Mock\r
+            public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+                return null;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public Service getServiceByModelName (String defaultServiceModelName) {\r
+               Service serviceRecord = new Service();\r
+               serviceRecord.setModelUUID("2883992993");\r
+               return serviceRecord;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+               ServiceRecipe recipe =new ServiceRecipe();\r
+               recipe.setOrchestrationUri("/test/mso");\r
+               recipe.setRecipeTimeout(1000);\r
+               return recipe;\r
+            }\r
+        };\r
+        \r
+        new MockUp<MsoRequest>() {\r
+            @Mock\r
+            public void createRequestRecord (Status status, Action action) {\r
+               return;\r
+            }\r
+        };\r
+        \r
+        new MockUp<RequestClientFactory>() {\r
+            @Mock\r
+            public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{\r
+               RequestClient client = new CamundaClient();\r
+               client.setUrl("/test/url");\r
+               return client;\r
+            }\r
+        };\r
+        \r
+        new MockUp<CamundaClient>() {\r
+            @Mock\r
+            public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
+                               String vnfId, String vfModuleId, String volumeGroupId, String networkId,\r
+                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
+                               String requestDetails){ \r
+               ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
+               HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
+               BasicHttpEntity entity = new BasicHttpEntity();\r
+               String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
+               InputStream instream = new ByteArrayInputStream(body.getBytes());\r
+               entity.setContent(instream);\r
+               resp.setEntity(entity);\r
+               return resp;\r
+            }\r
+        };\r
+               ServiceInstances instance = new ServiceInstances();\r
+               String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
+                               +"\"vnfInstanceId\":\"1882938\","\r
+                               +"\"networkInstanceId\":\"1882937\","\r
+                               +"\"volumeGroupInstanceId\":\"1882935\","\r
+                               +"\"vfModuleInstanceId\":\"1882934\","\r
+                               + "\"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\"}}}";\r
+               Response resp = instance.createServiceInstance(requestJson, "v2");\r
+               String respBody = resp.getEntity().toString();\r
+       }\r
+       \r
+       @Test\r
+       public void createServiceInstanceTest500Http(){\r
+               new MockUp<RequestsDatabase>() {\r
+            @Mock\r
+            public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+                return null;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public Service getServiceByModelName (String defaultServiceModelName) {\r
+               Service serviceRecord = new Service();\r
+               serviceRecord.setModelUUID("2883992993");\r
+               return serviceRecord;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+               ServiceRecipe recipe =new ServiceRecipe();\r
+               recipe.setOrchestrationUri("/test/mso");\r
+               recipe.setRecipeTimeout(1000);\r
+               return recipe;\r
+            }\r
+        };\r
+        \r
+        new MockUp<MsoRequest>() {\r
+            @Mock\r
+            public void createRequestRecord (Status status, Action action) {\r
+               return;\r
+            }\r
+        };\r
+        \r
+        new MockUp<RequestClientFactory>() {\r
+            @Mock\r
+            public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{\r
+               RequestClient client = new CamundaClient();\r
+               client.setUrl("/test/url");\r
+               return client;\r
+            }\r
+        };\r
+        \r
+        new MockUp<CamundaClient>() {\r
+            @Mock\r
+            public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
+                               String vnfId, String vfModuleId, String volumeGroupId, String networkId,\r
+                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
+                               String requestDetails){ \r
+               ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
+               HttpResponse resp = new BasicHttpResponse(pv,500, "test response");\r
+               BasicHttpEntity entity = new BasicHttpEntity();\r
+               String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
+               InputStream instream = new ByteArrayInputStream(body.getBytes());\r
+               entity.setContent(instream);\r
+               resp.setEntity(entity);\r
+               return resp;\r
+            }\r
+        };\r
+               ServiceInstances instance = new ServiceInstances();\r
+               String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
+                               +"\"vnfInstanceId\":\"1882938\","\r
+                               +"\"networkInstanceId\":\"1882937\","\r
+                               +"\"volumeGroupInstanceId\":\"1882935\","\r
+                               +"\"vfModuleInstanceId\":\"1882934\","\r
+                               + "\"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\"}}}";\r
+               Response resp = instance.createServiceInstance(requestJson, "v2");\r
+               String respBody = resp.getEntity().toString();\r
+               assertTrue(respBody.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);\r
+       }\r
+       \r
+       @Test\r
+       public void createServiceInstanceTestVnfModelType(){\r
+               new MockUp<RequestsDatabase>() {\r
+            @Mock\r
+            public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+                return null;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public Service getServiceByModelName (String defaultServiceModelName) {\r
+               Service serviceRecord = new Service();\r
+               serviceRecord.setModelUUID("2883992993");\r
+               return serviceRecord;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+               ServiceRecipe recipe =new ServiceRecipe();\r
+               recipe.setOrchestrationUri("/test/mso");\r
+               recipe.setRecipeTimeout(1000);\r
+               return recipe;\r
+            }\r
+        };\r
+        \r
+        new MockUp<MsoRequest>() {\r
+            @Mock\r
+            public void createRequestRecord (Status status, Action action) {\r
+               return;\r
+            }\r
+        };\r
+        \r
+        new MockUp<RequestClientFactory>() {\r
+            @Mock\r
+            public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{\r
+               RequestClient client = new CamundaClient();\r
+               client.setUrl("/test/url");\r
+               return client;\r
+            }\r
+        };\r
+        \r
+        new MockUp<CamundaClient>() {\r
+            @Mock\r
+            public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
+                               String vnfId, String vfModuleId, String volumeGroupId, String networkId,\r
+                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
+                               String requestDetails){ \r
+               ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
+               HttpResponse resp = new BasicHttpResponse(pv,500, "test response");\r
+               BasicHttpEntity entity = new BasicHttpEntity();\r
+               String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
+               InputStream instream = new ByteArrayInputStream(body.getBytes());\r
+               entity.setContent(instream);\r
+               resp.setEntity(entity);\r
+               return resp;\r
+            }\r
+        };\r
+               ServiceInstances instance = new ServiceInstances();\r
+               String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
+                               +"\"vnfInstanceId\":\"1882938\","\r
+                               +"\"networkInstanceId\":\"1882937\","\r
+                               +"\"volumeGroupInstanceId\":\"1882935\","\r
+                               +"\"vfModuleInstanceId\":\"1882934\","\r
+                               + "\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"vnf\",\"modelName\":\"serviceModel\",\"modelCustomizationName\":\"test\"}}}";\r
+               Response resp = instance.createServiceInstance(requestJson, "v5");\r
+               String respBody = resp.getEntity().toString();\r
+               assertTrue(respBody.indexOf("No valid modelVersionId is specified") != -1);\r
+       }\r
+       \r
+       @Test\r
+       public void createServiceInstanceTestNullHttpResp(){\r
+               new MockUp<RequestsDatabase>() {\r
+            @Mock\r
+            public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+                return null;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public Service getServiceByModelName (String defaultServiceModelName) {\r
+               Service serviceRecord = new Service();\r
+               serviceRecord.setModelUUID("2883992993");\r
+               return serviceRecord;\r
+            }\r
+        };\r
+        new MockUp<CatalogDatabase>() {\r
+            @Mock\r
+            public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+               ServiceRecipe recipe =new ServiceRecipe();\r
+               recipe.setOrchestrationUri("/test/mso");\r
+               recipe.setRecipeTimeout(1000);\r
+               return recipe;\r
+            }\r
+        };\r
+        \r
+        new MockUp<MsoRequest>() {\r
+            @Mock\r
+            public void createRequestRecord (Status status, Action action) {\r
+               return;\r
+            }\r
+        };\r
+        \r
+        new MockUp<RequestClientFactory>() {\r
+            @Mock\r
+            public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{\r
+               RequestClient client = new CamundaClient();\r
+               client.setUrl("/test/url");\r
+               return client;\r
+            }\r
+        };\r
+        \r
+        new MockUp<CamundaClient>() {\r
+            @Mock\r
+            public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+                               int recipeTimeout, String requestAction, String serviceInstanceId,\r
+                               String vnfId, String vfModuleId, String volumeGroupId, String networkId,\r
+                               String serviceType, String vnfType, String vfModuleType, String networkType,\r
+                               String requestDetails){ \r
+               return null;\r
+            }\r
+        };\r
+               ServiceInstances instance = new ServiceInstances();\r
+               String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
+                               +"\"vnfInstanceId\":\"1882938\","\r
+                               +"\"networkInstanceId\":\"1882937\","\r
+                               +"\"volumeGroupInstanceId\":\"1882935\","\r
+                               +"\"vfModuleInstanceId\":\"1882934\","\r
+                               + "\"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\"}}}";\r
+               Response resp = instance.createServiceInstance(requestJson, "v2");\r
+               String respBody = resp.getEntity().toString();\r
+               assertTrue(respBody.indexOf("bpelResponse is null") != -1);\r
+       }\r
+       \r
        @Test\r
        public void createServiceInstanceNormalNullDBFatch(){\r
                new MockUp<RequestsDatabase>() {\r