aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java1388
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java40
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java512
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java349
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java309
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java1460
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java190
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java71
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java16
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java396
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java70
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java330
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java67
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java167
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java421
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java162
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java64
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java62
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java98
30 files changed, 3316 insertions, 3350 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java
index 1198cdb998..9028109735 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/BeanTest.java
@@ -27,33 +27,33 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs;
public class BeanTest {
- @Test
- public void testVnfInputs() {
- VnfInputs bean = new VnfInputs();
- bean.setAicCloudRegion("south");
- bean.setAicNodeClli("38982");
- bean.setAsdcServiceModelVersion("v2");
- bean.setBackoutOnFailure(false);
- bean.setIsBaseVfModule(true);
- bean.setPersonaModelId("2017");
- bean.setPersonaModelVersion("v3");
- bean.setProvStatus("active");
- bean.setServiceId("123456");
- bean.setServiceInstanceId("aaa1234");
- bean.setServiceType("vnf");
- bean.setTenantId("89903042");
- bean.setVfModuleId("4993022");
- bean.setVfModuleModelName("m1");
- bean.setVnfId("34");
- bean.setVnfName("test");
- bean.setVnfPersonaModelId("1002");
- bean.setVnfPersonaModelVersion("v3");
- bean.setVnfType("fddf");
- bean.setVolumeGroupId("7889");
- bean.setVolumeGroupName("test");
-
- String str = bean.toString();
- assertTrue(str != null);
-
- }
+ @Test
+ public void testVnfInputs(){
+ VnfInputs bean = new VnfInputs();
+ bean.setAicCloudRegion("south");
+ bean.setAicNodeClli("38982");
+ bean.setAsdcServiceModelVersion("v2");
+ bean.setBackoutOnFailure(false);
+ bean.setIsBaseVfModule(true);
+ bean.setPersonaModelId("2017");
+ bean.setPersonaModelVersion("v3");
+ bean.setProvStatus("active");
+ bean.setServiceId("123456");
+ bean.setServiceInstanceId("aaa1234");
+ bean.setServiceType("vnf");
+ bean.setTenantId("89903042");
+ bean.setVfModuleId("4993022");
+ bean.setVfModuleModelName("m1");
+ bean.setVnfId("34");
+ bean.setVnfName("test");
+ bean.setVnfPersonaModelId("1002");
+ bean.setVnfPersonaModelVersion("v3");
+ bean.setVnfType("fddf");
+ bean.setVolumeGroupId("7889");
+ bean.setVolumeGroupName("test");
+
+ String str = bean.toString();
+ assertTrue(str != null);
+
+ }
}
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
index 04c6fc82b9..664f810b35 100644
--- 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
@@ -59,698 +59,698 @@ import mockit.MockUp;
public class E2EServiceInstancesTest {
- @Test
- public void createE2EServiceInstanceTestSuccess() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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, String recipeParamXsd) {
- 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestBpelHTTPException() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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, String recipeParamXsd) {
- 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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, String recipeParamXsd) {
- 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullBPELResponse() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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, String recipeParamXsd) {
- HttpResponse resp = null;
- return resp;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestBPMNNullREsponse() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullBpmn() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullReceipe() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestNullDBResponse() {
-
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestInvalidRequest() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestEmptyDBQuery() {
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- // assertTrue(true);
- }
-
- @Test
- public void createE2EServiceInstanceTestDBQueryFail() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceName(
- String serviceName) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
-
- @Test
- public void createE2EServiceInstanceTestForEmptyRequest() {
-
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "";
- Response resp = instance.createE2EServiceInstance(request, "v3");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr
- .contains("Mapping of request to JSON object failed. No content to map to Object due to end of input"));
- }
-
- @Test
- public void deleteE2EServiceInstanceTestNormal() {
- E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"globalSubscriberId\":\"299392392\",\"serviceType\":\"VoLTE\"}";
- Response resp = instance.deleteE2EServiceInstance(request, "v3",
- "12345678");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC1000"));
- }
-
- @Test
- public void getE2EServiceInstanceTest() {
-
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatus(String serviceId,
- String operationId) {
- OperationStatus os = new OperationStatus();
- os.setOperation("");
- os.setOperationContent("");
- os.setOperationId("123456");
- os.setProgress("");
- os.setServiceId("12345");
- os.setServiceName("VoLTE");
- os.setReason("");
- os.setResult("");
- os.setUserId("");
- return os;
- }
- };
-
- E2EServiceInstances instance = new E2EServiceInstances();
- Response resp = instance
- .getE2EServiceInstances("12345", "v3", "123456");
-
- }
-
- @Test
- public void updateE2EServiceInstanceTestNormal() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceId(
- String serviceID) {
- OperationStatus operationStatus = new OperationStatus();
- operationStatus.setProgress("100");
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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, String recipeParamXsd) {
- 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("success"));
- }
-
- @Test
- public void updateE2EServiceInstanceTestChkStatusFalse() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public OperationStatus getOperationStatusByServiceId(
- String serviceID) {
- OperationStatus operationStatus = new OperationStatus();
- return operationStatus;
- }
- };
- new MockUp<E2EServiceInstances>() {
- @Mock
- private void createOperationStatusRecordForError(Action action,
- String requestId) throws MsoDatabaseException {
-
- }
- };
- 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, String recipeParamXsd) {
- 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
- Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
- String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
- }
+ @Test
+ public void createE2EServiceInstanceTestSuccess() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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, String recipeParamXsd) {
+ 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPException() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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, String recipeParamXsd) {
+ 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBpelHTTPExceptionWithNullREsponseBody() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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, String recipeParamXsd) {
+ 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBPELResponse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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, String recipeParamXsd) {
+ HttpResponse resp = null;
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestBPMNNullREsponse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullBpmn() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullReceipe() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestNullDBResponse() {
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestInvalidRequest() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestEmptyDBQuery() {
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ // assertTrue(true);
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestDBQueryFail() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceName(
+ String serviceName) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
+
+ @Test
+ public void createE2EServiceInstanceTestForEmptyRequest() {
+
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr
+ .contains("Mapping of request to JSON object failed. No content to map to Object due to end of input"));
+ }
+
+ @Test
+ public void deleteE2EServiceInstanceTestNormal() {
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"globalSubscriberId\":\"299392392\",\"serviceType\":\"VoLTE\"}";
+ Response resp = instance.deleteE2EServiceInstance(request, "v3",
+ "12345678");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC1000"));
+ }
+
+ @Test
+ public void getE2EServiceInstanceTest() {
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatus(String serviceId,
+ String operationId) {
+ OperationStatus os = new OperationStatus();
+ os.setOperation("");
+ os.setOperationContent("");
+ os.setOperationId("123456");
+ os.setProgress("");
+ os.setServiceId("12345");
+ os.setServiceName("VoLTE");
+ os.setReason("");
+ os.setResult("");
+ os.setUserId("");
+ return os;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ Response resp = instance
+ .getE2EServiceInstances("12345", "v3", "123456");
+
+ }
+
+ @Test
+ public void updateE2EServiceInstanceTestNormal() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ operationStatus.setProgress("100");
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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, String recipeParamXsd) {
+ 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("success"));
+ }
+
+ @Test
+ public void updateE2EServiceInstanceTestChkStatusFalse() {
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public OperationStatus getOperationStatusByServiceId(
+ String serviceID) {
+ OperationStatus operationStatus = new OperationStatus();
+ return operationStatus;
+ }
+ };
+ new MockUp<E2EServiceInstances>() {
+ @Mock
+ private void createOperationStatusRecordForError(Action action,
+ String requestId) throws MsoDatabaseException {
+
+ }
+ };
+ 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, String recipeParamXsd) {
+ 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\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
+ Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.contains("SVC2000"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java
index 95b0b2bcb5..5502d38268 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandlerTest.java
@@ -37,24 +37,24 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
public class GlobalHealthcheckHandlerTest {
- public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
- public static final Response HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
-
- @Test
- public final void testGlobalHealthcheck() {
- try {
- MsoStatusUtil statusUtil = Mockito.mock(MsoStatusUtil.class);
- HealthCheckUtils utils = Mockito.mock(HealthCheckUtils.class);
- Mockito.when(utils.verifyGlobalHealthCheck(true, null)).thenReturn(true);
- Mockito.when(statusUtil.getSiteStatus(Mockito.anyString())).thenReturn(true);
- GlobalHealthcheckHandler gh = Mockito.mock(GlobalHealthcheckHandler.class);
- Mockito.when(gh.globalHealthcheck(Mockito.anyBoolean())).thenReturn(HEALTH_CHECK_RESPONSE);
- Response resp = gh.globalHealthcheck(true);
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
+ public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+ public static final Response HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+
+ @Test
+ public final void testGlobalHealthcheck() {
+ try {
+ MsoStatusUtil statusUtil = Mockito.mock(MsoStatusUtil.class);
+ HealthCheckUtils utils = Mockito.mock(HealthCheckUtils.class);
+ Mockito.when(utils.verifyGlobalHealthCheck(true, null)).thenReturn(true);
+ Mockito.when(statusUtil.getSiteStatus(Mockito.anyString())).thenReturn(true);
+ GlobalHealthcheckHandler gh = Mockito.mock(GlobalHealthcheckHandler.class);
+ Mockito.when(gh.globalHealthcheck(Mockito.anyBoolean())).thenReturn(HEALTH_CHECK_RESPONSE);
+ Response resp = gh.globalHealthcheck(true);
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java
index fa414186a3..e18bc5e911 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ManualTasksTest.java
@@ -28,11 +28,11 @@ import javax.ws.rs.core.Response;
public class ManualTasksTest {
- ManualTasks task = new ManualTasks();
-
- @Test
- public void completeTaskTest() {
- Response resp = task.completeTask("test", "v2", "1882993");
- assertTrue(resp.getEntity().toString() != null);
- }
+ ManualTasks task = new ManualTasks();
+
+ @Test
+ public void completeTaskTest(){
+ Response resp = task.completeTask("test", "v2", "1882993");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
index 58e17ff273..c4a1c1fffc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/MsoRequestTest.java
@@ -41,259 +41,261 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe
public class MsoRequestTest {
- @Test
- public void testParseOrchestration() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- ObjectMapper mapper = new ObjectMapper();
- String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parseOrchestration(sir);
- assertEquals(msoRequest.getRequestInfo().getSource(), "VID");
- assertEquals(msoRequest.getRequestInfo().getRequestorId(), "zz9999");
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseOrchestrationFailure() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- ObjectMapper mapper = new ObjectMapper();
- String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\"}}}";
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parseOrchestration(sir);
-
- }
-
- @Test
- public void testParseV3VnfCreate() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3VnfCreate.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
- assertEquals(msoRequest.getRequestInfo().getSource(), "VID");
- assertFalse(msoRequest.getALaCarteFlag());
- assertEquals(msoRequest.getReqVersion(), 3);
- boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
- assertFalse(testIsALaCarteSet);
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3VolumeGroupFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3VolumeGroupBad.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
-
- }
-
- @Test
- public void testParseV3UpdateNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3UpdateNetwork.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3UpdateNetworkFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3UpdateNetworkBad.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
-
- }
-
- @Test
- public void testParseV3DeleteNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteNetwork.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
- }
-
- @Test
- public void testParseV3ServiceInstanceDelete() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON1, requestJSON2;
- try {
- requestJSON1 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstance.json"));
- requestJSON2 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceALaCarte.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON1, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
- boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
- assertTrue(testIsALaCarteSet);
- assertFalse(msoRequest.getALaCarteFlag());
- sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
- msoRequest = new MsoRequest("12345");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
- testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
- assertTrue(testIsALaCarteSet);
- assertTrue(msoRequest.getALaCarteFlag());
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3ServiceInstanceCreateFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON2;
- try {
- requestJSON2 = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceALaCarte.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
-
- }
-
- @Test(expected = ValidationException.class)
- public void testParseV3ServiceInstanceDeleteMacroFail() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v3DeleteServiceInstanceBad.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
-
- }
-
- @Test
- public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModule.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
-
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
-
-
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModuleNoCustomizationId.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
-
- mapper = new ObjectMapper();
- instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
- }
-
- @Test(expected = ValidationException.class)
- public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException {
- String requestJSON;
- try {
- requestJSON = IOUtils.toString(ClassLoader.class.getResourceAsStream("/v4CreateVfModuleMissingModelCustomizationId.json"));
-
- } catch (IOException e) {
- fail("Exception caught");
- e.printStackTrace();
- return;
- }
-
- ObjectMapper mapper = new ObjectMapper();
- HashMap<String, String> instanceIdMap = new HashMap<>();
- instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- MsoRequest msoRequest = new MsoRequest("1234");
- msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
- }
+
+ @Test
+ public void testParseOrchestration() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ ObjectMapper mapper = new ObjectMapper();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\"}}}";
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parseOrchestration(sir);
+ assertEquals(msoRequest.getRequestInfo().getSource(),"VID");
+ assertEquals(msoRequest.getRequestInfo().getRequestorId(),"zz9999");
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseOrchestrationFailure() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ ObjectMapper mapper = new ObjectMapper();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\"}}}";
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parseOrchestration(sir);
+
+ }
+
+ @Test
+ public void testParseV3VnfCreate() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3VnfCreate.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
+ assertEquals(msoRequest.getRequestInfo().getSource(),"VID");
+ assertFalse(msoRequest.getALaCarteFlag());
+ assertEquals(msoRequest.getReqVersion(),3);
+ boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
+ assertFalse(testIsALaCarteSet);
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3VolumeGroupFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3VolumeGroupBad.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
+
+ }
+
+ @Test
+ public void testParseV3UpdateNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3UpdateNetwork.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3UpdateNetworkFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3UpdateNetworkBad.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.updateInstance, "v3");
+
+ }
+
+ @Test
+ public void testParseV3DeleteNetwork() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteNetwork.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+ }
+
+ @Test
+ public void testParseV3ServiceInstanceDelete() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON1, requestJSON2;
+ try {
+ requestJSON1 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstance.json"));
+ requestJSON2 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceALaCarte.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON1, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+ boolean testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
+ assertTrue(testIsALaCarteSet);
+ assertFalse(msoRequest.getALaCarteFlag());
+ sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
+ msoRequest = new MsoRequest ("12345");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+ testIsALaCarteSet = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters().isaLaCarteSet();
+ assertTrue(testIsALaCarteSet);
+ assertTrue(msoRequest.getALaCarteFlag());
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3ServiceInstanceCreateFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON2;
+ try {
+ requestJSON2 = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceALaCarte.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON2, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v3");
+
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testParseV3ServiceInstanceDeleteMacroFail() throws JsonParseException, JsonMappingException, IOException, ValidationException{
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v3DeleteServiceInstanceBad.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.deleteInstance, "v3");
+
+ }
+
+ @Test
+ public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModule.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+
+
+
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleNoCustomizationId.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+
+ mapper = new ObjectMapper();
+ instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testV4UsePreLoadMissingModelCustomizationId() throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ String requestJSON;
+ try {
+ requestJSON = IOUtils.toString (ClassLoader.class.getResourceAsStream ("/v4CreateVfModuleMissingModelCustomizationId.json"));
+
+ } catch (IOException e) {
+ fail ("Exception caught");
+ e.printStackTrace ();
+ return;
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ instanceIdMap.put("vnfInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ MsoRequest msoRequest = new MsoRequest ("1234");
+ msoRequest.parse(sir, instanceIdMap, Action.createInstance, "v4");
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java
index 427b74ce87..445fab329f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandlerTest.java
@@ -28,38 +28,38 @@ import org.openecomp.mso.requestsdb.InfraRequests;
public class NetworkInfoHandlerTest {
- NetworkInfoHandler handler = new NetworkInfoHandler();
-
- @Test
- public void fillVnfRequestTest() {
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v3");
- String vnfid = (String) qr.getNetworkParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2() {
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v2");
- String vnfid = (String) qr.getNetworkParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV1() {
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v1");
- String vnfid = (String) qr.getNetworkParams();
- assertTrue(vnfid.equals("test"));
- }
+ NetworkInfoHandler handler = new NetworkInfoHandler();
+
+ @Test
+ public void fillVnfRequestTest(){
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v3");
+ String vnfid = (String)qr.getNetworkParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2(){
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v2");
+ String vnfid = (String)qr.getNetworkParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV1(){
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v1");
+ String vnfid = (String)qr.getNetworkParams();
+ assertTrue(vnfid.equals("test"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
index 66dc9c28d6..c1da76e885 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandlerTest.java
@@ -44,181 +44,178 @@ import org.openecomp.mso.requestsdb.RequestsDatabase;
public class NetworkRequestHandlerTest {
- NetworkRequestHandler handler = null;
-
- UriInfo uriInfo = null;
-
- @Before
- public void setup() throws Exception {
-
- uriInfo = Mockito.mock(UriInfo.class);
- Class<?> clazz = NetworkRequestHandler.class;
- handler = (NetworkRequestHandler) clazz.newInstance();
-
- Field f1 = handler.getClass().getDeclaredField("uriInfo");
-
- f1.setAccessible(true);
+ NetworkRequestHandler handler = null;
+
+UriInfo uriInfo = null;
+
+ @Before
+ public void setup() throws Exception{
+
+ uriInfo = Mockito.mock(UriInfo.class);
+ Class<?> clazz = NetworkRequestHandler.class;
+ handler = (NetworkRequestHandler)clazz.newInstance();
+
+ Field f1 = handler.getClass().getDeclaredField("uriInfo");
+
+ f1.setAccessible(true);
f1.set(handler, uriInfo);
- }
-
- @Test
- public void manageVnfRequestTest() {
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestV1() {
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v1");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestV3() {
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v3");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestInvalidVersion() {
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2Test() {
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void fillNetworkRequestTestV1() {
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v1");
- String param = (String) qr.getNetworkParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void fillNetworkRequestTestV2() {
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v2");
- String param = (String) qr.getNetworkParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void fillNetworkRequestTestV3() {
- NetworkRequest qr = new NetworkRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillNetworkRequest(qr, ar, "v3");
- String param = (String) qr.getNetworkParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void queryFiltersTest() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
- String queryValue,
- String requestType) {
- List<InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters("networkType", "serviceType", "aicNodeClli", "tenantId", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getRequestTest() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("388293", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
+ }
+
+ @Test
+ public void manageVnfRequestTest(){
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+ @Test
+ public void manageVnfRequestTestV1(){
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v1");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestV3(){
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v3");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequestTestInvalidVersion(){
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2Test(){
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void fillNetworkRequestTestV1(){
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v1");
+ String param = (String)qr.getNetworkParams();
+ assertTrue(param.equals("test"));
+ }
+ @Test
+ public void fillNetworkRequestTestV2(){
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v2");
+ String param = (String)qr.getNetworkParams();
+ assertTrue(param.equals("test"));
+ }
+ @Test
+ public void fillNetworkRequestTestV3(){
+ NetworkRequest qr = new NetworkRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillNetworkRequest(qr, ar, "v3");
+ String param = (String)qr.getNetworkParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void queryFiltersTest(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List <InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters("networkType", "serviceType", "aicNodeClli", "tenantId", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getRequestTest(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("388293", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java
index 42c72fed07..3738e2f94a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandlerTest.java
@@ -36,38 +36,38 @@ import org.openecomp.mso.db.catalog.beans.NetworkResource;
public class NetworkTypesHandlerTest {
- NetworkTypesHandler handler = new NetworkTypesHandler();
-
- @Test
- public void getNetworkTypesTest() {
- Response resp = handler.getNetworkTypes("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getNetworkTypesTest2() {
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<NetworkResource> getAllNetworkResources() {
- return null;
- }
- };
- Response resp = handler.getNetworkTypes("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getNetworkTypesTest3() {
- List<NetworkResource> netList = new ArrayList<>();
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<NetworkResource> getAllNetworkResources() {
- NetworkResource ns = new NetworkResource();
- netList.add(ns);
- return netList;
- }
- };
- Response resp = handler.getNetworkTypes("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+ NetworkTypesHandler handler = new NetworkTypesHandler();
+
+ @Test
+ public void getNetworkTypesTest(){
+ Response resp = handler.getNetworkTypes("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getNetworkTypesTest2(){
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List <NetworkResource> getAllNetworkResources(){
+ return null;
+ }
+ };
+ Response resp = handler.getNetworkTypes("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getNetworkTypesTest3(){
+ List <NetworkResource> netList = new ArrayList<>();
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List <NetworkResource> getAllNetworkResources(){
+ NetworkResource ns = new NetworkResource();
+ netList.add(ns);
+ return netList;
+ }
+ };
+ Response resp = handler.getNetworkTypes("v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
index 04175fd113..5f2f39606f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java
@@ -22,7 +22,6 @@ package org.openecomp.mso.apihandlerinfra;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-
import java.io.IOException;
import javax.ws.rs.core.Response;
@@ -44,159 +43,159 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe
public class OrchestrationRequestsTest {
- private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- public static final Response RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- @Mock
- private static RequestsDatabase db;
- private static OrchestrationRequests orReq;
- private static GetOrchestrationResponse orRes;
-
- @Test
- public void testGetOrchestrationRequest() {
- orReq = Mockito.mock(OrchestrationRequests.class);
- orRes = new GetOrchestrationResponse();
- try {
- // create InfraActiveRequests object
- InfraActiveRequests infraRequests = new InfraActiveRequests();
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
- infraRequests.setNetworkType("CONTRAIL30_BASIC");
- infraRequests.setRequestType("createInstance");
- infraRequests.setSource("VID");
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
- infraRequests.setServiceInstanceId("bc305d54-75b4-431b-adb2-eb6b9e546014");
- infraRequests.setRequestStatus("IN_PROGRESS");
- infraRequests.setRequestorId("ab1234");
- String body = "{\"modelInfo\":{\"modelInvariantId\":\"9771b085-4705-4bf7-815d-8c0627bb7e36\",\"modelType\":\"service\",\"modelName\":\"Service with VNFs with modules\",\"modelVersion\":\"1.0\"}}";
- infraRequests.setRequestBody(body);
-
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- ///// mock mapInfraActiveRequestToRequest()
- Request request = new Request();
- request.setRequestId(infraRequests.getRequestId());
- request.setRequestScope(infraRequests.getRequestScope());
- request.setRequestType(infraRequests.getRequestAction());
-
- InstanceReferences ir = new InstanceReferences();
- if (infraRequests.getNetworkId() != null)
- ir.setNetworkInstanceId(infraRequests.getNetworkId());
- if (infraRequests.getNetworkName() != null)
- ir.setNetworkInstanceName(infraRequests.getNetworkName());
- if (infraRequests.getServiceInstanceId() != null)
- ir.setServiceInstanceId(infraRequests.getServiceInstanceId());
- if (infraRequests.getServiceInstanceName() != null)
- ir.setServiceInstanceName(infraRequests.getServiceInstanceName());
- if (infraRequests.getVfModuleId() != null)
- ir.setVfModuleInstanceId(infraRequests.getVfModuleId());
- if (infraRequests.getVfModuleName() != null)
- ir.setVfModuleInstanceName(infraRequests.getVfModuleName());
- if (infraRequests.getVnfId() != null)
- ir.setVnfInstanceId(infraRequests.getVnfId());
- if (infraRequests.getVnfName() != null)
- ir.setVnfInstanceName(infraRequests.getVnfName());
- if (infraRequests.getVolumeGroupId() != null)
- ir.setVolumeGroupInstanceId(infraRequests.getVolumeGroupId());
- if (infraRequests.getVolumeGroupName() != null)
- ir.setVolumeGroupInstanceName(infraRequests.getVolumeGroupName());
- if (infraRequests.getRequestorId() != null)
- ir.setRequestorId(infraRequests.getRequestorId());
-
- request.setInstanceReferences(ir);
- RequestStatus status = new RequestStatus();
-
- if (infraRequests.getRequestStatus() != null) {
- status.setRequestState(infraRequests.getRequestStatus());
- }
-
- request.setRequestStatus(status);
- // RequestStatus reqStatus = request.getRequestStatus();
- orRes.setRequest(request);
- Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
- Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");
-
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),
- "rq1234d1-5a33-55df-13ab-12abad84e333");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getSource(), "VID");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getTenantId(),
- "19123c2924c648eb8e42a3c1f14b7682");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getServiceInstanceId(),
- "bc305d54-75b4-431b-adb2-eb6b9e546014");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestStatus(),
- "IN_PROGRESS");
- assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestorId(),
- "ab1234");
- assertEquals(request.getInstanceReferences().getServiceInstanceId(), "bc305d54-75b4-431b-adb2-eb6b9e546014");
- assertEquals(request.getInstanceReferences().getRequestorId(), "ab1234");
- assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testGetOrchestrationRequestNotPresent() {
- orReq = Mockito.mock(OrchestrationRequests.class);
- orRes = new GetOrchestrationResponse();
- try {
- // create InfraActiveRequests object
- InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class);
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- Request request = new Request();
- RequestStatus status = new RequestStatus();
- request.setRequestStatus(status);
- orRes.setRequest(request);
- assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testUnlockOrchestrationRequest()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- ObjectMapper mapper = new ObjectMapper();
- String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
-
- MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
- ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
- msoRequest.parseOrchestration(sir);
-
- //create object instead of a DB call.
- InfraActiveRequests infraRequests = new InfraActiveRequests();
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
- infraRequests.setNetworkType("CONTRAIL30_BASIC");
- infraRequests.setSource("VID");
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
- infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
- infraRequests.setRequestStatus("IN-PROGRESS");
-
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- Request request = new Request();
- InstanceReferences ir = new InstanceReferences();
- request.setInstanceReferences(ir);
- RequestStatus status = new RequestStatus();
-
- if (infraRequests.getRequestStatus() != null) {
- status.setRequestState(infraRequests.getRequestStatus());
- }
- request.setRequestStatus(status);
- RequestStatus reqStatus = request.getRequestStatus();
-
- assertEquals(reqStatus.getRequestState(), "IN-PROGRESS");
-
- if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")) {
- reqStatus.setRequestState(Status.UNLOCKED.toString());
- }
- assertEquals(reqStatus.getRequestState(), "UNLOCKED");
-
- }
+ private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ public static final Response RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ @Mock
+ private static RequestsDatabase db;
+ private static OrchestrationRequests orReq;
+ private static GetOrchestrationResponse orRes;
+
+ @Test
+ public void testGetOrchestrationRequest() {
+ orReq = Mockito.mock(OrchestrationRequests.class);
+ orRes = new GetOrchestrationResponse();
+ try {
+ // create InfraActiveRequests object
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setRequestType("createInstance");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("bc305d54-75b4-431b-adb2-eb6b9e546014");
+ infraRequests.setRequestStatus("IN_PROGRESS");
+ infraRequests.setRequestorId("ab1234");
+ String body = "{\"modelInfo\":{\"modelInvariantId\":\"9771b085-4705-4bf7-815d-8c0627bb7e36\",\"modelType\":\"service\",\"modelName\":\"Service with VNFs with modules\",\"modelVersion\":\"1.0\"}}";
+ infraRequests.setRequestBody(body);
+
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ ///// mock mapInfraActiveRequestToRequest()
+ Request request = new Request();
+ request.setRequestId(infraRequests.getRequestId());
+ request.setRequestScope(infraRequests.getRequestScope());
+ request.setRequestType(infraRequests.getRequestAction());
+
+ InstanceReferences ir = new InstanceReferences();
+ if (infraRequests.getNetworkId() != null)
+ ir.setNetworkInstanceId(infraRequests.getNetworkId());
+ if (infraRequests.getNetworkName() != null)
+ ir.setNetworkInstanceName(infraRequests.getNetworkName());
+ if (infraRequests.getServiceInstanceId() != null)
+ ir.setServiceInstanceId(infraRequests.getServiceInstanceId());
+ if (infraRequests.getServiceInstanceName() != null)
+ ir.setServiceInstanceName(infraRequests.getServiceInstanceName());
+ if (infraRequests.getVfModuleId() != null)
+ ir.setVfModuleInstanceId(infraRequests.getVfModuleId());
+ if (infraRequests.getVfModuleName() != null)
+ ir.setVfModuleInstanceName(infraRequests.getVfModuleName());
+ if (infraRequests.getVnfId() != null)
+ ir.setVnfInstanceId(infraRequests.getVnfId());
+ if (infraRequests.getVnfName() != null)
+ ir.setVnfInstanceName(infraRequests.getVnfName());
+ if (infraRequests.getVolumeGroupId() != null)
+ ir.setVolumeGroupInstanceId(infraRequests.getVolumeGroupId());
+ if (infraRequests.getVolumeGroupName() != null)
+ ir.setVolumeGroupInstanceName(infraRequests.getVolumeGroupName());
+ if (infraRequests.getRequestorId() != null)
+ ir.setRequestorId(infraRequests.getRequestorId());
+
+ request.setInstanceReferences(ir);
+ RequestStatus status = new RequestStatus();
+
+ if (infraRequests.getRequestStatus() != null) {
+ status.setRequestState(infraRequests.getRequestStatus());
+ }
+
+ request.setRequestStatus(status);
+ // RequestStatus reqStatus = request.getRequestStatus();
+ orRes.setRequest(request);
+ Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
+ Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");
+
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),
+ "rq1234d1-5a33-55df-13ab-12abad84e333");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getSource(), "VID");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getTenantId(),
+ "19123c2924c648eb8e42a3c1f14b7682");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getServiceInstanceId(),
+ "bc305d54-75b4-431b-adb2-eb6b9e546014");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestStatus(),
+ "IN_PROGRESS");
+ assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestorId(),
+ "ab1234");
+ assertEquals(request.getInstanceReferences().getServiceInstanceId(),"bc305d54-75b4-431b-adb2-eb6b9e546014");
+ assertEquals(request.getInstanceReferences().getRequestorId(),"ab1234");
+ assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testGetOrchestrationRequestNotPresent() {
+ orReq = Mockito.mock(OrchestrationRequests.class);
+ orRes = new GetOrchestrationResponse();
+ try {
+ // create InfraActiveRequests object
+ InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class);
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ Request request = new Request();
+ RequestStatus status = new RequestStatus();
+ request.setRequestStatus(status);
+ orRes.setRequest(request);
+ assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testUnlockOrchestrationRequest()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
+
+ MsoRequest msoRequest = new MsoRequest("rq1234d1-5a33-55df-13ab-12abad84e333");
+ ServiceInstancesRequest sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ msoRequest.parseOrchestration(sir);
+
+ //create object instead of a DB call.
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
+ infraRequests.setRequestStatus("IN-PROGRESS");
+
+ db = Mockito.mock(RequestsDatabase.class);
+ Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+
+ Request request = new Request();
+ InstanceReferences ir = new InstanceReferences();
+ request.setInstanceReferences(ir);
+ RequestStatus status = new RequestStatus();
+
+ if (infraRequests.getRequestStatus() != null) {
+ status.setRequestState(infraRequests.getRequestStatus());
+ }
+ request.setRequestStatus(status);
+ RequestStatus reqStatus = request.getRequestStatus();
+
+ assertEquals(reqStatus.getRequestState(),"IN-PROGRESS");
+
+ if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")){
+ reqStatus.setRequestState(Status.UNLOCKED.toString ());
+ }
+ assertEquals(reqStatus.getRequestState(),"UNLOCKED");
+
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java
index f6d5b3fa2c..3bc2edf8e2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RecipeLookupResultTest.java
@@ -21,20 +21,18 @@
package org.openecomp.mso.apihandlerinfra;
import org.junit.After;
-
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
public class RecipeLookupResultTest {
- RecipeLookupResult instance;
+ RecipeLookupResult instance;
public RecipeLookupResultTest() {
}
@@ -60,7 +58,7 @@ public class RecipeLookupResultTest {
assertEquals(expResult, result);
}
-
+
/**
* Test of setOrchestrationURI method.
*/
@@ -82,7 +80,7 @@ public class RecipeLookupResultTest {
assertEquals(expResult, result);
}
-
+
/**
* Test of setRecipeTimeout method.
*/
@@ -92,7 +90,7 @@ public class RecipeLookupResultTest {
instance.setRecipeTimeout(recipeTimeOut);
verify(instance).setRecipeTimeout(10);
}
-
-
+
+
}
\ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
index 8f21805be6..d3d995e851 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
@@ -56,850 +56,850 @@ 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.contains("Error parsing request. No valid model-info is specified"));
- }
-
- @Test
- public void createServiceInstanceNormalDuplicate() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
+ /*** 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.contains("Error parsing request. No valid model-info is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceNormalDuplicate(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
return new InfraActiveRequests();
}
};
- 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.contains(
- "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."));
- }
-
- @Test
- public void createServiceInstanceTestDBException() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
+ 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.contains(
+ "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."));
+ }
+
+ @Test
+ public void createServiceInstanceTestDBException(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName(String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
- ServiceRecipe recipe = new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
- }
- };
- 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.contains("Exception while creating record in DB null"));
- }
-
- @Test
- public void createServiceInstanceTestBpmnFail() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
+ }
+ };
+ 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.contains("Exception while creating record in DB null"));
+ }
+
+ @Test
+ public void createServiceInstanceTestBpmnFail(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName(String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
- ServiceRecipe recipe = new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord(Status status, Action action) {
- return;
- }
- };
- 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.contains("Failed calling bpmn properties"));
- }
-
- @Test(expected = Exception.class)
- public void createServiceInstanceTest200Http() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
+ public void createRequestRecord (Status status, Action action) {
+ return;
+ }
+ };
+ 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.contains("Failed calling bpmn properties"));
+ }
+
+ @Test(expected = Exception.class)
+ public void createServiceInstanceTest200Http(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName(String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
- ServiceRecipe recipe = new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord(Status status, Action action) {
- return;
+ public void createRequestRecord (Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ 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, String recipeParamXsd) {
- ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
- HttpResponse resp = new BasicHttpResponse(pv, 200, "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;
- }
- };
- 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();
- }
-
- @Test
- public void createServiceInstanceTest500Http() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,200, "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;
+ }
+ };
+ 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();
+ }
+
+ @Test
+ public void createServiceInstanceTest500Http(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName(String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
- ServiceRecipe recipe = new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord(Status status, Action action) {
- return;
+ public void createRequestRecord (Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ 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, String recipeParamXsd) {
- 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;
- }
- };
- 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.contains("Request Failed due to BPEL error with HTTP Status"));
- }
-
- @Test
- public void createServiceInstanceTestVnfModelType() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
+ 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;
+ }
+ };
+ 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.contains("Request Failed due to BPEL error with HTTP Status"));
+ }
+
+ @Test
+ public void createServiceInstanceTestVnfModelType(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName(String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
- ServiceRecipe recipe = new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord(Status status, Action action) {
- return;
+ public void createRequestRecord (Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ 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, String recipeParamXsd) {
- 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;
- }
- };
- 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\":\"vnf\",\"modelName\":\"serviceModel\",\"modelCustomizationName\":\"test\"}}}";
- Response resp = instance.createServiceInstance(requestJson, "v5");
- String respBody = resp.getEntity().toString();
- assertTrue(respBody.contains("No valid modelVersionId is specified"));
- }
-
- @Test
- public void createServiceInstanceTestNullHttpResp() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
+ 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;
+ }
+ };
+ 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\":\"vnf\",\"modelName\":\"serviceModel\",\"modelCustomizationName\":\"test\"}}}";
+ Response resp = instance.createServiceInstance(requestJson, "v5");
+ String respBody = resp.getEntity().toString();
+ assertTrue(respBody.contains("No valid modelVersionId is specified"));
+ }
+
+ @Test
+ public void createServiceInstanceTestNullHttpResp(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
return null;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public Service getServiceByModelName(String defaultServiceModelName) {
- Service serviceRecord = new Service();
- serviceRecord.setModelUUID("2883992993");
- return serviceRecord;
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
}
};
new MockUp<CatalogDatabase>() {
@Mock
- public ServiceRecipe getServiceRecipeByModelUUID(String uuid, String action) {
- ServiceRecipe recipe = new ServiceRecipe();
- recipe.setOrchestrationUri("/test/mso");
- recipe.setRecipeTimeout(1000);
- return recipe;
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
}
};
-
+
new MockUp<MsoRequest>() {
@Mock
- public void createRequestRecord(Status status, Action action) {
- return;
+ public void createRequestRecord (Status status, Action action) {
+ return;
}
};
-
+
new MockUp<RequestClientFactory>() {
@Mock
- public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException {
- RequestClient client = new CamundaClient();
- client.setUrl("/test/url");
- return client;
+ 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, String recipeParamXsd) {
- return null;
- }
- };
- 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.contains("bpelResponse is null"));
- }
-
- @Test
- public void createServiceInstanceNormalNullDBFatch() {
- new MockUp<RequestsDatabase>() {
- @Mock
- private List<InfraActiveRequests> executeInfraQuery(List<Criterion> criteria, Order order) {
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
+ return null;
+ }
+ };
+ 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.contains("bpelResponse is null"));
+ }
+
+ @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.contains("Recipe could not be retrieved from catalog DB null"));
- }
-
-
- @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.contains("Error parsing request. No valid modelVersionId is specified"));
- }
-
- @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.contains("Error parsing request. No valid instanceName is specified"));
- }
-
-
- @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.contains("Error parsing request. No valid model-info is specified"));
- }
-
- @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.contains("Error parsing request. No valid modelType is specified"));
- }
-
- @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.contains("Error parsing request. No valid modelType is specified"));
- }
-
-
- @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.contains("Error parsing request. No valid modelType is specified"));
- }
-
- @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.contains("Mapping of request to JSON object failed."));
- }
-
- @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.contains("Error parsing request. No valid modelName is specified"));
- }
-
- @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.contains("Error parsing request. AutoBuildVfModule is not valid in the v2 version"));
- }
-
- @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.contains("Error parsing request. No valid subscriptionServiceType is specified"));
- }
-
- @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.contains("Error parsing request. No valid subscriptionServiceType is specified"));
- }
-
- @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.contains("Mapping of request to JSON object failed"));
- }
-
- /*** 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.contains("Mapping of request to JSON object failed"));
- }
-
- @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.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
- }
-
- @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.contains(
- "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
- }
-
- @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.contains("SVC2000"));
- }
-
- /*** 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.contains("Mapping of request to JSON object failed"));
- }
-
- @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.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
- }
-
- @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.contains(
- "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
- }
-
- @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.contains("SVC2000"));
- }
-
- /*** 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.contains("Mapping of request to JSON object failed"));
- }
-
- @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.contains("Error parsing request. No valid modelVersionId is specified"));
- }
-
- @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.contains("Error parsing request. No valid modelVersionId is specified"));
- }
-
- @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.contains("SVC2000"));
- }
-
- /*** 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.contains("Error parsing request. No valid cloudConfiguration is specified"));
- }
-
- @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.contains("Error parsing request. No valid lcpCloudRegionId is specified"));
- }
-
- @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.contains("Error parsing request. No valid tenantId is specified"));
- }
-
- @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.contains("SVC2000"));
- }
-
- /*** 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.contains("SVC2000"));
- }
-
- /*** 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.contains("SVC2000"));
- }
-
- /*** 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.contains("SVC2000"));
- }
+ 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.contains("Recipe could not be retrieved from catalog DB null"));
+ }
+
+
+ @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.contains("Error parsing request. No valid modelVersionId is specified"));
+ }
+
+ @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.contains("Error parsing request. No valid instanceName is specified"));
+ }
+
+
+ @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.contains("Error parsing request. No valid model-info is specified"));
+ }
+
+ @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.contains("Error parsing request. No valid modelType is specified"));
+ }
+
+ @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.contains("Error parsing request. No valid modelType is specified"));
+ }
+
+
+ @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.contains("Error parsing request. No valid modelType is specified"));
+ }
+
+ @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.contains("Mapping of request to JSON object failed."));
+ }
+
+ @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.contains("Error parsing request. No valid modelName is specified"));
+ }
+
+ @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.contains("Error parsing request. AutoBuildVfModule is not valid in the v2 version"));
+ }
+
+ @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.contains("Error parsing request. No valid subscriptionServiceType is specified"));
+ }
+
+ @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.contains("Error parsing request. No valid subscriptionServiceType is specified"));
+ }
+
+ @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.contains("Mapping of request to JSON object failed"));
+ }
+
+ /*** 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.contains("Mapping of request to JSON object failed"));
+ }
+
+ @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.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
+ }
+
+ @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.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
+ }
+
+ @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.contains("SVC2000"));
+ }
+
+ /*** 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.contains("Mapping of request to JSON object failed"));
+ }
+
+ @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.contains("Error parsing request. No valid modelVersionId in relatedInstance is specified"));
+ }
+
+ @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.contains(
+ "Error parsing request. No valid serviceInstanceId matching the serviceInstanceId in request URI is specified"));
+ }
+
+ @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.contains("SVC2000"));
+ }
+
+ /*** 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.contains("Mapping of request to JSON object failed"));
+ }
+
+ @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.contains("Error parsing request. No valid modelVersionId is specified"));
+ }
+
+ @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.contains("Error parsing request. No valid modelVersionId is specified"));
+ }
+
+ @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.contains("SVC2000"));
+ }
+
+ /*** 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.contains("Error parsing request. No valid cloudConfiguration is specified"));
+ }
+
+ @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.contains("Error parsing request. No valid lcpCloudRegionId is specified"));
+ }
+
+ @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.contains("Error parsing request. No valid tenantId is specified"));
+ }
+
+ @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.contains("SVC2000"));
+ }
+
+ /*** 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.contains("SVC2000"));
+ }
+
+ /*** 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.contains("SVC2000"));
+ }
+
+ /*** 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.contains("SVC2000"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java
index 12e171cfc9..666da25fe7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstancesTest.java
@@ -47,100 +47,100 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRe
public class ServiceInstancesTest {
- private static final String requestJSONCreate = "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\", "
- + "\"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\","
- + " \"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", \"modelName\": \"Test\","
- + " \"modelVersion\": \"1.0\" }, \"cloudConfiguration\": "
- + "{ \"lcpCloudRegionId\": \"mdt1\", \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" },"
- + " \"subscriberInfo\": { \"globalSubscriberId\": \"{some subscriber id}\","
- + " \"subscriberName\": \"{some subscriber name}\" },"
- + " \"requestInfo\": { \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", "
- + "\"source\": \"VID\", \"suppressRollback\": true, \"requestorId\": \"az2016\" },"
- + " \"requestParameters\": { \"subscriptionServiceType\": \"MOG\", \"aLaCarte\": false,"
- + " \"userParams\": [ { \"name\": \"someUserParam\", \"value\": \"someValue\" } ] } } } ";
-
- private static final String requestJSONActivateDeacivate =
- "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\","
- + " \"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\", "
- + "\"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", "
- + "\"modelName\": \"Test\", \"modelVersion\": \"1.0\" }, "
- + "\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"az2016\" }, "
- + "\"requestParameters\": { \"userParams\": [ { \"name\": \"aic_zone\", "
- + "\"value\": \"someValue\" } ] } } } ";
-
- private static final String requestJSONDelete =
- "{ \"requestDetails\": { \"modelInfo\": { \"modelType\":\"network\", "
- + "\"modelName\":\"CONTRAIL30_BASIC\" }, \"cloudConfiguration\": { \"lcpCloudRegionId\":\"mdt1\", "
- + "\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\" }, "
- + "\"requestInfo\": { \"source\":\"VID\", \"requestorId\":\"az2016\" } } }";
-
- @Test
- public void testCreateServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
-
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- sir.createServiceInstance(requestJSONCreate, "v3");
- Mockito.when(sir.createServiceInstance(requestJSONCreate, "v3")).thenReturn(SERVICE_RESPONSE);
- Response resp = sir.createServiceInstance(requestJSONCreate, "v3");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testActivateServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- Mockito.when(sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
- .thenReturn(SERVICE_RESPONSE);
- Response resp = sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDeactivateServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- Mockito.when(sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
- .thenReturn(SERVICE_RESPONSE);
- Response resp = sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDeleteServiceInstance()
- throws JsonParseException, JsonMappingException, IOException, ValidationException {
- final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
- final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
- try {
- ServiceInstances sir = Mockito.mock(ServiceInstances.class);
- Mockito.when(sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
- .thenReturn(SERVICE_RESPONSE);
- Response resp = sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
+ private static final String requestJSONCreate = "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\", "
+ + "\"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\","
+ + " \"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", \"modelName\": \"Test\","
+ + " \"modelVersion\": \"1.0\" }, \"cloudConfiguration\": "
+ + "{ \"lcpCloudRegionId\": \"mdt1\", \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" },"
+ + " \"subscriberInfo\": { \"globalSubscriberId\": \"{some subscriber id}\","
+ + " \"subscriberName\": \"{some subscriber name}\" },"
+ + " \"requestInfo\": { \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", "
+ + "\"source\": \"VID\", \"suppressRollback\": true, \"requestorId\": \"az2016\" },"
+ + " \"requestParameters\": { \"subscriptionServiceType\": \"MOG\", \"aLaCarte\": false,"
+ + " \"userParams\": [ { \"name\": \"someUserParam\", \"value\": \"someValue\" } ] } } } ";
+
+ private static final String requestJSONActivateDeacivate =
+ "{ \"requestDetails\": { \"modelInfo\": { \"modelType\": \"service\","
+ + " \"modelInvariantId\": \"ff3514e3-5a33-55df-13ab-12abad84e7ff\", "
+ + "\"modelVersionId\": \"fe6985cd-ea33-3346-ac12-ab121484a3fe\", "
+ + "\"modelName\": \"Test\", \"modelVersion\": \"1.0\" }, "
+ + "\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"az2016\" }, "
+ + "\"requestParameters\": { \"userParams\": [ { \"name\": \"aic_zone\", "
+ + "\"value\": \"someValue\" } ] } } } ";
+
+ private static final String requestJSONDelete =
+ "{ \"requestDetails\": { \"modelInfo\": { \"modelType\":\"network\", "
+ + "\"modelName\":\"CONTRAIL30_BASIC\" }, \"cloudConfiguration\": { \"lcpCloudRegionId\":\"mdt1\", "
+ + "\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\" }, "
+ + "\"requestInfo\": { \"source\":\"VID\", \"requestorId\":\"az2016\" } } }";
+
+ @Test
+ public void testCreateServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ sir.createServiceInstance(requestJSONCreate, "v3");
+ Mockito.when(sir.createServiceInstance(requestJSONCreate, "v3")).thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.createServiceInstance(requestJSONCreate, "v3");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testActivateServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ Mockito.when(sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
+ .thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.activateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDeactivateServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ Mockito.when(sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
+ .thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.deactivateServiceInstance(requestJSONActivateDeacivate, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDeleteServiceInstance()
+ throws JsonParseException, JsonMappingException, IOException, ValidationException {
+ final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+ final Response SERVICE_RESPONSE = Response.status(HttpStatus.SC_OK).entity(CHECK_HTML).build();
+ try {
+ ServiceInstances sir = Mockito.mock(ServiceInstances.class);
+ Mockito.when(sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"))
+ .thenReturn(SERVICE_RESPONSE);
+ Response resp = sir.deleteServiceInstance(requestJSONDelete, "v5", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc");
+ assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java
index b2acd33ab7..4926da77b1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/TasksHandlerTest.java
@@ -27,13 +27,13 @@ import javax.ws.rs.core.Response;
import org.junit.Test;
public class TasksHandlerTest {
-
- TasksHandler handler = new TasksHandler();
-
- @Test
- public void queryFiltersTest() {
- Response resp = handler.queryFilters("10020", "399495", "test", "nfRole", "buildingBlockName", "originalRequestDate", "originalRequestorId", "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+
+ TasksHandler handler = new TasksHandler();
+
+ @Test
+ public void queryFiltersTest(){
+ Response resp = handler.queryFilters("10020", "399495", "test", "nfRole", "buildingBlockName", "originalRequestDate", "originalRequestorId", "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
index 3991fbd79f..1c3c85653b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandlerTest.java
@@ -34,42 +34,41 @@ import org.openecomp.mso.db.catalog.beans.VfModule;
import org.openecomp.mso.db.catalog.beans.VnfResource;
import javax.ws.rs.core.Response;
-
public class VfModuleModelNamesHandlerTest {
- VfModuleModelNamesHandler handler = new VfModuleModelNamesHandler();
-
- @Test
- public void getVfModuleModelNamesTest() {
- Response resp = handler.getVfModuleModelNames("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getVfModuleModelNamesTest2() {
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<VfModule> getAllVfModules() {
- List<VfModule> list = new ArrayList<>();
- VfModule resource = new VfModule();
- list.add(resource);
- return list;
- }
- };
- Response resp = handler.getVfModuleModelNames("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
-
- @Test
- public void getVfModuleModelNamesTest3() {
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<VfModule> getAllVfModules() {
- return null;
- }
- };
- Response resp = handler.getVfModuleModelNames("v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+ VfModuleModelNamesHandler handler = new VfModuleModelNamesHandler();
+
+ @Test
+ public void getVfModuleModelNamesTest(){
+ Response resp = handler.getVfModuleModelNames("v2");
+ assertTrue(resp.getEntity().toString()!= null);
+ }
+
+ @Test
+ public void getVfModuleModelNamesTest2(){
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List <VfModule> getAllVfModules(){
+ List <VfModule> list = new ArrayList<>();
+ VfModule resource = new VfModule();
+ list.add(resource);
+ return list;
+ }
+ };
+ Response resp = handler.getVfModuleModelNames("v2");
+ assertTrue(resp.getEntity().toString()!= null);
+ }
+
+
+ @Test
+ public void getVfModuleModelNamesTest3(){
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List <VfModule> getAllVfModules(){
+ return null;
+ }
+ };
+ Response resp = handler.getVfModuleModelNames("v2");
+ assertTrue(resp.getEntity().toString()!= null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java
index 6c2f264b21..fd22af012f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandlerTest.java
@@ -28,27 +28,27 @@ import org.openecomp.mso.requestsdb.InfraRequests;
public class VnfInfoHandlerTest {
- VnfInfoHandler handler = new VnfInfoHandler();
-
- @Test
- public void fillVnfRequestTest() {
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v3");
- String vnfid = (String) qr.getVnfParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2() {
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v2");
- String vnfid = (String) qr.getVnfParams();
- assertTrue(vnfid.equals("test"));
- }
+ VnfInfoHandler handler = new VnfInfoHandler();
+
+ @Test
+ public void fillVnfRequestTest(){
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v3");
+ String vnfid = (String)qr.getVnfParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2(){
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v2");
+ String vnfid = (String)qr.getVnfParams();
+ assertTrue(vnfid.equals("test"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java
index 31c7fecf9d..c8ab6b5612 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequestTest.java
@@ -27,12 +27,12 @@ import org.openecomp.mso.apihandler.common.ValidationException;
import org.openecomp.mso.properties.MsoJavaProperties;
public class VnfMsoInfraRequestTest {
- VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020");
-
- @Test(expected = Exception.class)
- public void parseTest() throws ValidationException {
- String reqXML = "<vnf-request><request-info> <request-id>29993</request-id><request-status>COMPLETE</request-status></request-info></vnf-request>";
- request.parse(reqXML, "v1", new MsoJavaProperties());
- }
-
+ VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020");
+
+ @Test(expected=Exception.class)
+ public void parseTest() throws ValidationException {
+ String reqXML = "<vnf-request><request-info> <request-id>29993</request-id><request-status>COMPLETE</request-status></request-info></vnf-request>";
+ request.parse(reqXML, "v1", new MsoJavaProperties());
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
index ac0fec076a..9c9ebaee35 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java
@@ -43,206 +43,202 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
public class VnfRequestHandlerTest {
- VnfRequestHandler handler = null;
- UriInfo uriInfo = null;
-
- @Before
- public void setup() throws Exception {
-
- uriInfo = Mockito.mock(UriInfo.class);
- Class<?> clazz = VnfRequestHandler.class;
- handler = (VnfRequestHandler) clazz.newInstance();
-
- Field f1 = handler.getClass().getDeclaredField("uriInfo");
-
- f1.setAccessible(true);
+ VnfRequestHandler handler = null;
+ UriInfo uriInfo = null;
+
+ @Before
+ public void setup() throws Exception{
+
+ uriInfo = Mockito.mock(UriInfo.class);
+ Class<?> clazz = VnfRequestHandler.class;
+ handler = (VnfRequestHandler)clazz.newInstance();
+
+ Field f1 = handler.getClass().getDeclaredField("uriInfo");
+
+ f1.setAccessible(true);
f1.set(handler, uriInfo);
- }
-
- @Test
- public void manageVnfRequestTestV2() {
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestv1() {
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v1");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestv3() {
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v3");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequestTestInvalidVersion() {
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v30");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2Test() {
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void fillVnfRequestTest() {
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v1");
- String param = (String) qr.getVnfParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2() {
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- handler.fillVnfRequest(qr, ar, "v2");
- String param = (String) qr.getVnfParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV3() {
- VnfRequest qr = new VnfRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("1003");
- ar.setVnfName("vnf");
- ar.setVnfType("vnt");
- ar.setTenantId("48889690");
- ar.setProvStatus("uuu");
- ar.setVolumeGroupName("volume");
- ar.setVolumeGroupId("38838");
- ar.setServiceType("vnf");
- ar.setAicNodeClli("djerfe");
- ar.setAaiServiceId("599499");
- ar.setAicCloudRegion("south");
- ar.setVfModuleName("m1");
- ar.setVfModuleId("39949");
- ar.setVfModuleModelName("test");
- ar.setAaiServiceId("37728");
- ar.setVnfParams("test");
- ar.setServiceInstanceId("38829");
- handler.fillVnfRequest(qr, ar, "v3");
- String param = (String) qr.getVnfParams();
- assertTrue(param.equals("test"));
- }
-
- @Test
- public void queryFiltersTest() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
- String queryValue,
- String requestType) {
- List<InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters("vnfType", "serviceType", "aicNodeClli", "tenantId", "volumeGroupId", "volumeGroupName", "vnfName", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void queryFiltersTestNullVnfType() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
- String queryValue,
- String requestType) {
- List<InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters(null, null, null, null, null, null, null, "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getRequestTest() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("388293", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
+ }
+
+ @Test
+ public void manageVnfRequestTestV2(){
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+ @Test
+ public void manageVnfRequestTestv1(){
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v1");
+ assertTrue(null != resp);
+ }
+ @Test
+ public void manageVnfRequestTestv3(){
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v3");
+ assertTrue(null != resp);
+ }
+ @Test
+ public void manageVnfRequestTestInvalidVersion(){
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v30");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2Test(){
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void fillVnfRequestTest(){
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v1");
+ String param = (String)qr.getVnfParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2(){
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ handler.fillVnfRequest(qr, ar, "v2");
+ String param = (String)qr.getVnfParams();
+ assertTrue(param.equals("test"));
+ }
+ @Test
+ public void fillVnfRequestTestV3(){
+ VnfRequest qr = new VnfRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("1003");
+ ar.setVnfName("vnf");
+ ar.setVnfType("vnt");
+ ar.setTenantId("48889690");
+ ar.setProvStatus("uuu");
+ ar.setVolumeGroupName("volume");
+ ar.setVolumeGroupId("38838");
+ ar.setServiceType("vnf");
+ ar.setAicNodeClli("djerfe");
+ ar.setAaiServiceId("599499");
+ ar.setAicCloudRegion("south");
+ ar.setVfModuleName("m1");
+ ar.setVfModuleId("39949");
+ ar.setVfModuleModelName("test");
+ ar.setAaiServiceId("37728");
+ ar.setVnfParams("test");
+ ar.setServiceInstanceId("38829");
+ handler.fillVnfRequest(qr, ar, "v3");
+ String param = (String)qr.getVnfParams();
+ assertTrue(param.equals("test"));
+ }
+
+ @Test
+ public void queryFiltersTest(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List <InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters("vnfType", "serviceType", "aicNodeClli", "tenantId", "volumeGroupId", "volumeGroupName", "vnfName", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void queryFiltersTestNullVnfType(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List <InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters(null, null, null, null, null, null, null, "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getRequestTest(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("388293", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
index 59bf6361c5..1800bb4695 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandlerTest.java
@@ -36,40 +36,40 @@ import org.openecomp.mso.db.catalog.beans.VnfResource;
import javax.ws.rs.core.Response;
public class VnfTypesHandlerTest {
-
- VnfTypesHandler handler = new VnfTypesHandler();
-
- @Test
- public void getVnfTypesTest() {
- Response resp = handler.getVnfTypes(null, "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getVnfTypesTest2() {
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<VnfResource> getAllVnfResources() {
- return null;
- }
- };
- Response resp = handler.getVnfTypes(null, "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getVnfTypesTest3() {
- new MockUp<CatalogDatabase>() {
- @Mock
- public List<VnfResource> getAllVnfResources() {
- List<VnfResource> list = new ArrayList<>();
- VnfResource resource = new VnfResource();
- list.add(resource);
- return list;
- }
- };
- Response resp = handler.getVnfTypes(null, "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+
+ VnfTypesHandler handler = new VnfTypesHandler();
+
+ @Test
+ public void getVnfTypesTest(){
+ Response resp = handler.getVnfTypes(null, "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getVnfTypesTest2(){
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List <VnfResource> getAllVnfResources(){
+ return null;
+ }
+ };
+ Response resp = handler.getVnfTypes(null, "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+
+ @Test
+ public void getVnfTypesTest3(){
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public List <VnfResource> getAllVnfResources(){
+ List <VnfResource> list = new ArrayList<>();
+ VnfResource resource = new VnfResource();
+ list.add(resource);
+ return list;
+ }
+ };
+ Response resp = handler.getVnfTypes(null, "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
index bfe67c4796..78ed076b55 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandlerTest.java
@@ -28,27 +28,27 @@ import org.openecomp.mso.requestsdb.InfraRequests;
public class VolumeInfoHandlerTest {
- VolumeInfoHandler handler = new VolumeInfoHandler();
-
- @Test
- public void fillVnfRequestTestV3() {
- VolumeRequest qr = new VolumeRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVolumeRequest(qr, ar, "v3");
- String vnfid = (String) qr.getVolumeParams();
- assertTrue(vnfid.equals("test"));
- }
-
- @Test
- public void fillVnfRequestTestV2() {
- VolumeRequest qr = new VolumeRequest();
- InfraRequests ar = new InfraRequests();
- ar.setVnfId("2990102");
- ar.setVnfParams("test");
- handler.fillVolumeRequest(qr, ar, "v2");
- String vnfid = (String) qr.getVolumeParams();
- assertTrue(vnfid.equals("test"));
- }
+ VolumeInfoHandler handler = new VolumeInfoHandler();
+
+ @Test
+ public void fillVnfRequestTestV3(){
+ VolumeRequest qr = new VolumeRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVolumeRequest(qr, ar, "v3");
+ String vnfid = (String)qr.getVolumeParams();
+ assertTrue(vnfid.equals("test"));
+ }
+
+ @Test
+ public void fillVnfRequestTestV2(){
+ VolumeRequest qr = new VolumeRequest();
+ InfraRequests ar = new InfraRequests();
+ ar.setVnfId("2990102");
+ ar.setVnfParams("test");
+ handler.fillVolumeRequest(qr, ar, "v2");
+ String vnfid = (String)qr.getVolumeParams();
+ assertTrue(vnfid.equals("test"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
index 020c5667b7..fa5e094336 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandlerTest.java
@@ -43,173 +43,169 @@ import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
public class VolumeRequestHandlerTest {
- VolumeRequestHandler handler = null;
-
+ VolumeRequestHandler handler = null;
+
UriInfo uriInfo = null;
-
- @Before
- public void setup() throws Exception {
-
- uriInfo = Mockito.mock(UriInfo.class);
- Class<?> clazz = VolumeRequestHandler.class;
- handler = (VolumeRequestHandler) clazz.newInstance();
-
- Field f1 = handler.getClass().getDeclaredField("uriInfo");
-
- f1.setAccessible(true);
+
+ @Before
+ public void setup() throws Exception{
+
+ uriInfo = Mockito.mock(UriInfo.class);
+ Class<?> clazz = VolumeRequestHandler.class;
+ handler = (VolumeRequestHandler)clazz.newInstance();
+
+ Field f1 = handler.getClass().getDeclaredField("uriInfo");
+
+ f1.setAccessible(true);
f1.set(handler, uriInfo);
- }
-
- @Test
- public void manageVnfRequestTest() {
- Response resp = handler.manageVolumeRequest("<name>Test</name>", "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestV1InvalidRequestData() {
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "{\"result\":\"success\"}";
- Response resp = handler.manageVolumeRequest(request, "v1");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestV1() {
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v1");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestV2() {
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v2\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v2");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestV3() {
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v3\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v3");
- assertTrue(null != resp);
- }
-
- @Test
- public void manageVnfRequest2TestInvalidVersion() {
- Mockito.when(uriInfo.getRequestUri())
- .thenReturn(URI.create("http://localhost:8080/test"));
-
- new MockUp<MsoPropertiesUtils>() {
- @Mock
- public synchronized final boolean getNoPropertiesState() {
- return false;
- }
- };
- String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
- Response resp = handler.manageVolumeRequest(request, "v33");
- assertTrue(null != resp);
- }
-
- @Test
- public void queryFiltersTest() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName,
- String queryValue,
- String requestType) {
- List<InfraActiveRequests> list = new ArrayList<>();
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- list.add(req);
- return list;
- }
- };
- Response resp = handler.queryFilters("vnfType", "serviceType", "aic", "19929293", "288393923", "test", "v1");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getRequestTestV3() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("399293", "v3");
- assertTrue(resp.getEntity().toString() != null);
- }
-
- @Test
- public void getRequestTestV2() {
- new MockUp<RequestsDatabase>() {
- @Mock
- public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType) {
- InfraActiveRequests req = new InfraActiveRequests();
- req.setAaiServiceId("299392");
- req.setAction("CREATE");
- req.setRequestStatus("COMPLETE");
- req.setProgress(10001L);
- req.setSource("test");
- req.setStartTime(new Timestamp(10020100));
- req.setEndTime(new Timestamp(20020100));
- req.setStatusMessage("message");
- return req;
- }
- };
- Response resp = handler.getRequest("399293", "v2");
- assertTrue(resp.getEntity().toString() != null);
- }
+ }
+
+ @Test
+ public void manageVnfRequestTest(){
+ Response resp = handler.manageVolumeRequest("<name>Test</name>", "v2");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestV1InvalidRequestData(){
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "{\"result\":\"success\"}";
+ Response resp = handler.manageVolumeRequest(request, "v1");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestV1(){
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v1");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void manageVnfRequest2TestV2(){
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v2\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v2");
+ assertTrue(null != resp);
+ }
+ @Test
+ public void manageVnfRequest2TestV3(){
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v3\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v3");
+ assertTrue(null != resp);
+ }
+ @Test
+ public void manageVnfRequest2TestInvalidVersion(){
+ Mockito.when(uriInfo.getRequestUri())
+ .thenReturn(URI.create("http://localhost:8080/test"));
+
+ new MockUp<MsoPropertiesUtils>() {
+ @Mock
+ public synchronized final boolean getNoPropertiesState() {
+ return false;
+ }
+ };
+ String request = "<volume-request xmlns=\"http://org.openecomp/mso/infra/volume-request/v1\"><request-info><action>CREATE</action><request-status>COMPLETE</request-status><status-message>message</status-message><progress>10001</progress><start-time>1970-01-01 02:47:00.1</start-time><end-time>1970-01-01 05:33:40.1</end-time><source>test</source></request-info><volume-inputs><service-id>299392</service-id></volume-inputs></volume-request>";
+ Response resp = handler.manageVolumeRequest(request, "v33");
+ assertTrue(null != resp);
+ }
+
+ @Test
+ public void queryFiltersTest(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ List <InfraActiveRequests> list = new ArrayList<>();
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ list.add(req);
+ return list;
+ }
+ };
+ Response resp = handler.queryFilters("vnfType", "serviceType", "aic", "19929293", "288393923", "test", "v1");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+ @Test
+ public void getRequestTestV3(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("399293", "v3");
+ assertTrue(resp.getEntity().toString() != null);
+ }
+ @Test
+ public void getRequestTestV2(){
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setAaiServiceId("299392");
+ req.setAction("CREATE");
+ req.setRequestStatus("COMPLETE");
+ req.setProgress(10001L);
+ req.setSource("test");
+ req.setStartTime(new Timestamp(10020100));
+ req.setEndTime(new Timestamp(20020100));
+ req.setStatusMessage("message");
+ return req;
+ }
+ };
+ Response resp = handler.getRequest("399293", "v2");
+ assertTrue(resp.getEntity().toString() != null);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java
index 56f133df46..f257ca7a80 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestDetailsTest.java
@@ -21,57 +21,54 @@
package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
-
import static org.junit.Assert.assertTrue;
-
import org.junit.Before;
import org.junit.Test;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestDetails;
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestInfo;
+
public class RequestDetailsTest {
- RequestDetails _requestDetails;
- RequestInfo _requestInfo;
+ RequestDetails _requestDetails;
+ RequestInfo _requestInfo;
- public RequestDetailsTest() {
- }
+ public RequestDetailsTest() {
+ }
- @Before
- public void setUp() {
- _requestDetails = mock(RequestDetails.class);
- _requestInfo = new RequestInfo();
- when(_requestDetails.getRequestInfo()).thenReturn(_requestInfo);
- }
+ @Before
+ public void setUp() {
+ _requestDetails = mock(RequestDetails.class);
+ _requestInfo = new RequestInfo();
+ when(_requestDetails.getRequestInfo()).thenReturn(_requestInfo);
+ }
- @After
- public void tearDown() {
- _requestDetails = null;
- _requestInfo = null;
- }
+ @After
+ public void tearDown() {
+ _requestDetails = null;
+ _requestInfo = null;
+ }
- /**
- * Test of getRequestInfo method
- */
- @Test
- public void testGetRequestInfo() {
- _requestDetails.setRequestInfo(_requestInfo);
- assertTrue(_requestDetails.getRequestInfo().equals(_requestInfo));
+ /**
+ * Test of getRequestInfo method
+ */
+ @Test
+ public void testGetRequestInfo() {
+ _requestDetails.setRequestInfo(_requestInfo);
+ assertTrue(_requestDetails.getRequestInfo().equals(_requestInfo));
- }
+ }
- /**
- * Test setRequestInfo
- */
- @Test
- public void testSetRequestInfo() {
- _requestDetails.setRequestInfo(_requestInfo);
- verify(_requestDetails).setRequestInfo(_requestInfo);
- }
+ /**
+ * Test setRequestInfo
+ */
+ @Test
+ public void testSetRequestInfo() {
+ _requestDetails.setRequestInfo(_requestInfo);
+ verify(_requestDetails).setRequestInfo(_requestInfo);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java
index 15d43549d5..3ff389124a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/RequestInfoTest.java
@@ -23,7 +23,6 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestInfo;
@@ -35,87 +34,87 @@ import static org.mockito.Mockito.when;
public class RequestInfoTest {
- RequestInfo _requestInfo;
- String _source;
- ValidResponses _responseValue;
- String _requestorId;
-
- public RequestInfoTest() {
- }
-
- @Before
- public void setUp() {
- _requestInfo = mock(RequestInfo.class);
- _responseValue = ValidResponses.abort;
- _requestorId = "ab1234";
- _source = "VID";
- when(_requestInfo.getRequestorId()).thenReturn(_requestorId);
- when(_requestInfo.getSource()).thenReturn(_source);
- when(_requestInfo.getResponseValue()).thenReturn(_responseValue);
-
- }
-
- @After
- public void tearDown() {
- _requestInfo = null;
- _responseValue = null;
- }
-
- /**
- * Test of getSource method
- */
- @Test
- public void testGetSource() {
- String result = _requestInfo.getSource();
- assertEquals(_source, result);
-
- }
-
- /**
- * Test setSource
- */
- @Test
- public void testSetSource() {
- _requestInfo.setSource("VID");
- verify(_requestInfo).setSource(_source);
- }
-
- /**
- * Test of getRequestorId method
- */
- @Test
- public void testGetRequestorId() {
- String result = _requestInfo.getRequestorId();
- assertEquals(_requestorId, result);
-
- }
-
- /**
- * Test setRequestInfo
- */
- @Test
- public void testSetRequestorId() {
- _requestInfo.setRequestorId(_requestorId);
- verify(_requestInfo).setRequestorId(_requestorId);
- }
-
-
- /**
- * Test of getResponseValue method
- */
- @Test
- public void testGetResponseValue() {
- ValidResponses result = _requestInfo.getResponseValue();
- assertEquals(_responseValue, result);
-
- }
-
- /**
- * Test setResponseValues method
- */
- @Test
- public void testSetResponseValue() {
- _requestInfo.setResponseValue(ValidResponses.abort);
- verify(_requestInfo).setResponseValue(_responseValue);
- }
+ RequestInfo _requestInfo;
+ String _source;
+ ValidResponses _responseValue;
+ String _requestorId;
+
+ public RequestInfoTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _requestInfo = mock(RequestInfo.class);
+ _responseValue = ValidResponses.abort;
+ _requestorId = "ab1234";
+ _source = "VID";
+ when(_requestInfo.getRequestorId()).thenReturn(_requestorId);
+ when(_requestInfo.getSource()).thenReturn(_source);
+ when(_requestInfo.getResponseValue()).thenReturn(_responseValue);
+
+ }
+
+ @After
+ public void tearDown() {
+ _requestInfo = null;
+ _responseValue = null;
+ }
+
+ /**
+ * Test of getSource method
+ */
+ @Test
+ public void testGetSource() {
+ String result = _requestInfo.getSource();
+ assertEquals(_source, result);
+
+ }
+
+ /**
+ * Test setSource
+ */
+ @Test
+ public void testSetSource() {
+ _requestInfo.setSource("VID");
+ verify(_requestInfo).setSource(_source);
+ }
+
+ /**
+ * Test of getRequestorId method
+ */
+ @Test
+ public void testGetRequestorId() {
+ String result = _requestInfo.getRequestorId();
+ assertEquals(_requestorId, result);
+
+ }
+
+ /**
+ * Test setRequestInfo
+ */
+ @Test
+ public void testSetRequestorId() {
+ _requestInfo.setRequestorId(_requestorId);
+ verify(_requestInfo).setRequestorId(_requestorId);
+ }
+
+
+ /**
+ * Test of getResponseValue method
+ */
+ @Test
+ public void testGetResponseValue() {
+ ValidResponses result = _requestInfo.getResponseValue();
+ assertEquals(_responseValue, result);
+
+ }
+
+ /**
+ * Test setResponseValues method
+ */
+ @Test
+ public void testSetResponseValue() {
+ _requestInfo.setResponseValue(ValidResponses.abort);
+ verify(_requestInfo).setResponseValue(_responseValue);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java
index 9f7e295109..293278955a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskListTest.java
@@ -23,228 +23,225 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.json.JSONArray;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskList;
public class TaskListTest {
- TaskList _taskList;
- protected String _taskId;
- protected String _type;
- protected String _nfRole;
- protected String _subscriptionServiceType;
- protected String _originalRequestId;
- protected String _originalRequestorId;
- protected String _errorSource;
- protected String _errorCode;
- protected String _errorMessage;
- protected String _buildingBlockName;
- protected String _buildingBlockStep;
- protected JSONArray _validResponses;
-
- public TaskListTest() {
- }
-
- @Before
- public void setUp() {
- _taskList = mock(TaskList.class);
- _taskId = "_taskid";
- _type = "type";
- _nfRole = "nfrole";
- _subscriptionServiceType = "subscriptionservicetype";
- _originalRequestId = "originalrequestid";
- _originalRequestorId = "originalrequestorid";
- _errorSource = "errorsource";
- _errorCode = "errorcode";
- _errorMessage = "errormessage";
- _buildingBlockName = "buildingblockname";
- _buildingBlockStep = "buildingblockstep";
- _validResponses = mock(JSONArray.class);
-
- when(_taskList.getTaskId()).thenReturn(_taskId);
- when(_taskList.getType()).thenReturn(_type);
- when(_taskList.getNfRole()).thenReturn(_nfRole);
- when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType);
- when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId);
- when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId);
- when(_taskList.getErrorSource()).thenReturn(_errorSource);
- when(_taskList.getErrorCode()).thenReturn(_errorCode);
- when(_taskList.getErrorMessage()).thenReturn(_errorMessage);
- when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName);
- when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep);
- when(_taskList.getValidResponses()).thenReturn(_validResponses);
- }
-
- @After
- public void tearDown() {
- _taskList = null;
- _validResponses = null;
- }
-
- @Test
- public void testGetTaskId() {
- String result = _taskList.getTaskId();
- assertEquals(_taskId, result);
-
- }
-
- @Test
- public void testSetTaskId() {
- _taskList.setTaskId("_taskid");
- verify(_taskList).setTaskId(_taskId);
- }
-
- @Test
- public void testGetType() {
- String result = _taskList.getType();
- assertEquals(_type, result);
-
- }
-
- @Test
- public void testSetType() {
- _taskList.setType(_type);
- verify(_taskList).setType(_type);
- }
-
- @Test
- public void testGetNfRole() {
- String result = _taskList.getNfRole();
- assertEquals(_nfRole, result);
-
- }
-
- @Test
- public void testSetNfRole() {
- _taskList.setType(_nfRole);
- verify(_taskList).setType(_nfRole);
- }
-
- @Test
- public void testGetSubscriptionServiceType() {
- String result = _taskList.getSubscriptionServiceType();
- assertEquals(_subscriptionServiceType, result);
-
- }
-
- @Test
- public void testSetSubscriptionServiceType() {
- _taskList.setSubscriptionServiceType(_subscriptionServiceType);
- verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
- }
-
- @Test
- public void testGetOriginalRequestId() {
- String result = _taskList.getOriginalRequestId();
- assertEquals(_originalRequestId, result);
-
- }
-
- @Test
- public void testSetOriginalRequestId() {
- _taskList.setOriginalRequestId(_originalRequestId);
- verify(_taskList).setOriginalRequestId(_originalRequestId);
- }
-
- @Test
- public void testGetOriginalRequestorId() {
- String result = _taskList.getOriginalRequestorId();
- assertEquals(_originalRequestorId, result);
-
- }
-
- @Test
- public void testSetOriginalRequestorId() {
- _taskList.setOriginalRequestorId(_originalRequestorId);
- verify(_taskList).setOriginalRequestorId(_originalRequestorId);
- }
-
- @Test
- public void testGetErrorSource() {
- String result = _taskList.getErrorSource();
- assertEquals(_errorSource, result);
-
- }
-
- @Test
- public void testSetErrorSource() {
- _taskList.setErrorSource(_errorSource);
- verify(_taskList).setErrorSource(_errorSource);
- }
-
- @Test
- public void testGetErrorCode() {
- String result = _taskList.getErrorCode();
- assertEquals(_errorCode, result);
-
- }
-
- @Test
- public void testSetErrorCode() {
- _taskList.setErrorCode(_errorCode);
- verify(_taskList).setErrorCode(_errorCode);
- }
-
- @Test
- public void testGetErrorMessage() {
- String result = _taskList.getErrorMessage();
- assertEquals(_errorMessage, result);
-
- }
-
- @Test
- public void testSetErrorMessage() {
- _taskList.setErrorMessage(_errorMessage);
- verify(_taskList).setErrorMessage(_errorMessage);
- }
-
- @Test
- public void testGetBuildingBlockName() {
- String result = _taskList.getBuildingBlockName();
- assertEquals(_buildingBlockName, result);
-
- }
-
- @Test
- public void testSetBuildingBlockName() {
- _taskList.setBuildingBlockName(_buildingBlockName);
- verify(_taskList).setBuildingBlockName(_buildingBlockName);
- }
-
- @Test
- public void testGetBuildingBlockStep() {
- String result = _taskList.getBuildingBlockStep();
- assertEquals(_buildingBlockStep, result);
-
- }
-
- @Test
- public void testSetBuildingBlockStep() {
- _taskList.setBuildingBlockStep(_buildingBlockStep);
- verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
- }
-
- @Test
- public void testGetValidResponses() {
-
- JSONArray result = _taskList.getValidResponses();
- assertEquals(_validResponses, result);
-
- }
-
- @Test
- public void testSetValidResponses() {
- _taskList.setValidResponses(_validResponses);
- verify(_taskList).setValidResponses(_validResponses);
- }
+ TaskList _taskList;
+ protected String _taskId;
+ protected String _type;
+ protected String _nfRole;
+ protected String _subscriptionServiceType;
+ protected String _originalRequestId;
+ protected String _originalRequestorId;
+ protected String _errorSource;
+ protected String _errorCode;
+ protected String _errorMessage;
+ protected String _buildingBlockName;
+ protected String _buildingBlockStep;
+ protected JSONArray _validResponses;
+
+ public TaskListTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskList = mock(TaskList.class);
+ _taskId = "_taskid";
+ _type = "type";
+ _nfRole = "nfrole";
+ _subscriptionServiceType = "subscriptionservicetype";
+ _originalRequestId = "originalrequestid";
+ _originalRequestorId = "originalrequestorid";
+ _errorSource = "errorsource";
+ _errorCode = "errorcode";
+ _errorMessage = "errormessage";
+ _buildingBlockName = "buildingblockname";
+ _buildingBlockStep = "buildingblockstep";
+ _validResponses = mock(JSONArray.class);
+
+ when(_taskList.getTaskId()).thenReturn(_taskId);
+ when(_taskList.getType()).thenReturn(_type);
+ when(_taskList.getNfRole()).thenReturn(_nfRole);
+ when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType);
+ when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId);
+ when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId);
+ when(_taskList.getErrorSource()).thenReturn(_errorSource);
+ when(_taskList.getErrorCode()).thenReturn(_errorCode);
+ when(_taskList.getErrorMessage()).thenReturn(_errorMessage);
+ when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName);
+ when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep);
+ when(_taskList.getValidResponses()).thenReturn(_validResponses);
+ }
+
+ @After
+ public void tearDown() {
+ _taskList = null;
+ _validResponses = null;
+ }
+
+ @Test
+ public void testGetTaskId() {
+ String result = _taskList.getTaskId();
+ assertEquals(_taskId, result);
+
+ }
+
+ @Test
+ public void testSetTaskId() {
+ _taskList.setTaskId("_taskid");
+ verify(_taskList).setTaskId(_taskId);
+ }
+
+ @Test
+ public void testGetType() {
+ String result = _taskList.getType();
+ assertEquals(_type, result);
+
+ }
+
+ @Test
+ public void testSetType() {
+ _taskList.setType(_type);
+ verify(_taskList).setType(_type);
+ }
+
+ @Test
+ public void testGetNfRole() {
+ String result = _taskList.getNfRole();
+ assertEquals(_nfRole, result);
+
+ }
+
+ @Test
+ public void testSetNfRole() {
+ _taskList.setType(_nfRole);
+ verify(_taskList).setType(_nfRole);
+ }
+
+ @Test
+ public void testGetSubscriptionServiceType() {
+ String result = _taskList.getSubscriptionServiceType();
+ assertEquals(_subscriptionServiceType, result);
+
+ }
+
+ @Test
+ public void testSetSubscriptionServiceType() {
+ _taskList.setSubscriptionServiceType(_subscriptionServiceType);
+ verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
+ }
+
+ @Test
+ public void testGetOriginalRequestId() {
+ String result = _taskList.getOriginalRequestId();
+ assertEquals(_originalRequestId, result);
+
+ }
+
+ @Test
+ public void testSetOriginalRequestId() {
+ _taskList.setOriginalRequestId(_originalRequestId);
+ verify(_taskList).setOriginalRequestId(_originalRequestId);
+ }
+
+ @Test
+ public void testGetOriginalRequestorId() {
+ String result = _taskList.getOriginalRequestorId();
+ assertEquals(_originalRequestorId, result);
+
+ }
+
+ @Test
+ public void testSetOriginalRequestorId() {
+ _taskList.setOriginalRequestorId(_originalRequestorId);
+ verify(_taskList).setOriginalRequestorId(_originalRequestorId);
+ }
+
+ @Test
+ public void testGetErrorSource() {
+ String result = _taskList.getErrorSource();
+ assertEquals(_errorSource, result);
+
+ }
+
+ @Test
+ public void testSetErrorSource() {
+ _taskList.setErrorSource(_errorSource);
+ verify(_taskList).setErrorSource(_errorSource);
+ }
+
+ @Test
+ public void testGetErrorCode() {
+ String result = _taskList.getErrorCode();
+ assertEquals(_errorCode, result);
+
+ }
+
+ @Test
+ public void testSetErrorCode() {
+ _taskList.setErrorCode(_errorCode);
+ verify(_taskList).setErrorCode(_errorCode);
+ }
+
+ @Test
+ public void testGetErrorMessage() {
+ String result = _taskList.getErrorMessage();
+ assertEquals(_errorMessage, result);
+
+ }
+
+ @Test
+ public void testSetErrorMessage() {
+ _taskList.setErrorMessage(_errorMessage);
+ verify(_taskList).setErrorMessage(_errorMessage);
+ }
+
+ @Test
+ public void testGetBuildingBlockName() {
+ String result = _taskList.getBuildingBlockName();
+ assertEquals(_buildingBlockName, result);
+
+ }
+
+ @Test
+ public void testSetBuildingBlockName() {
+ _taskList.setBuildingBlockName(_buildingBlockName);
+ verify(_taskList).setBuildingBlockName(_buildingBlockName);
+ }
+
+ @Test
+ public void testGetBuildingBlockStep() {
+ String result = _taskList.getBuildingBlockStep();
+ assertEquals(_buildingBlockStep, result);
+
+ }
+
+ @Test
+ public void testSetBuildingBlockStep() {
+ _taskList.setBuildingBlockStep(_buildingBlockStep);
+ verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
+ }
+
+ @Test
+ public void testGetValidResponses() {
+
+ JSONArray result = _taskList.getValidResponses();
+ assertEquals(_validResponses, result);
+
+ }
+
+ @Test
+ public void testSetValidResponses() {
+ _taskList.setValidResponses(_validResponses);
+ verify(_taskList).setValidResponses(_validResponses);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java
index da00be855b..ec45592704 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskRequestReferenceTest.java
@@ -23,7 +23,6 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskRequestReference;
@@ -34,41 +33,40 @@ import static org.mockito.Mockito.when;
public class TaskRequestReferenceTest {
- TaskRequestReference _taskRequestReference;
+ TaskRequestReference _taskRequestReference;
protected String _taskId;
+ public TaskRequestReferenceTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskRequestReference = mock(TaskRequestReference.class);
+ _taskId = "taskid";
+
+ when(_taskRequestReference.getTaskId()).thenReturn(_taskId);
+ }
- public TaskRequestReferenceTest() {
- }
-
- @Before
- public void setUp() {
- _taskRequestReference = mock(TaskRequestReference.class);
- _taskId = "taskid";
-
- when(_taskRequestReference.getTaskId()).thenReturn(_taskId);
- }
-
- @After
- public void tearDown() {
- _taskRequestReference = null;
- }
+ @After
+ public void tearDown() {
+ _taskRequestReference = null;
+ }
- /**
- * Test getTaskRequestReference
- */
- @Test
- public void taskGetRequestReference() {
- String result = _taskRequestReference.getTaskId();
+ /**
+ * Test getTaskRequestReference
+ */
+ @Test
+ public void taskGetRequestReference() {
+ String result = _taskRequestReference.getTaskId();
assertEquals(_taskId, result);
- }
+ }
- /**
- * Test setTaskRequestReference
- */
- @Test
- public void testSetRequestInfo() {
- _taskRequestReference.setTaskId(_taskId);
- verify(_taskRequestReference).setTaskId(_taskId);
- }
+ /**
+ * Test setTaskRequestReference
+ */
+ @Test
+ public void testSetRequestInfo() {
+ _taskRequestReference.setTaskId(_taskId);
+ verify(_taskRequestReference).setTaskId(_taskId);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java
index 051bce94d0..b593036556 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariableValueTest.java
@@ -23,94 +23,92 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskVariableValue;
public class TaskVariableValueTest {
- TaskVariableValue _taskVariableValue;
- protected String _name;
- protected String _value;
- protected String _operator;
-
- public TaskVariableValueTest() {
- }
-
- @Before
- public void setUp() {
- _taskVariableValue = mock(TaskVariableValue.class);
- _name = "name";
- _value = "value";
- _operator = "operator";
- when(_taskVariableValue.getName()).thenReturn(_name);
- when(_taskVariableValue.getValue()).thenReturn(_value);
- when(_taskVariableValue.getOperator()).thenReturn(_operator);
- }
-
- @After
- public void tearDown() {
- _taskVariableValue = null;
- }
-
- /**
- * Test of getName method
- */
- @Test
- public void testGetName() {
- _taskVariableValue.setName(_name);
- assertEquals(_taskVariableValue.getName(), _name);
-
- }
-
- /**
- * Test setName
- */
- @Test
- public void testSetName() {
- _taskVariableValue.setName(_name);
- verify(_taskVariableValue).setName(_name);
- }
-
- /**
- * Test of getName method
- */
- @Test
- public void testGetValue() {
- _taskVariableValue.setValue(_value);
- assertEquals(_taskVariableValue.getValue(), _value);
-
- }
-
- /**
- * Test setName
- */
- @Test
- public void testSetValue() {
- _taskVariableValue.setValue(_value);
- verify(_taskVariableValue).setValue(_value);
- }
-
- /**
- * Test of getName method
- */
- @Test
- public void testGetOperator() {
- _taskVariableValue.setOperator(_operator);
- assertEquals(_taskVariableValue.getOperator(), _operator);
-
- }
-
- /**
- * Test setName
- */
- @Test
- public void testSetRequestDetails() {
- _taskVariableValue.setOperator(_operator);
- verify(_taskVariableValue).setOperator(_operator);
- }
+ TaskVariableValue _taskVariableValue;
+ protected String _name;
+ protected String _value;
+ protected String _operator;
+
+ public TaskVariableValueTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskVariableValue = mock(TaskVariableValue.class);
+ _name = "name";
+ _value = "value";
+ _operator = "operator";
+ when(_taskVariableValue.getName()).thenReturn(_name);
+ when(_taskVariableValue.getValue()).thenReturn(_value);
+ when(_taskVariableValue.getOperator()).thenReturn(_operator);
+ }
+
+ @After
+ public void tearDown() {
+ _taskVariableValue = null;
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetName() {
+ _taskVariableValue.setName(_name);
+ assertEquals(_taskVariableValue.getName(),_name);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetName() {
+ _taskVariableValue.setName(_name);
+ verify(_taskVariableValue).setName(_name);
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetValue() {
+ _taskVariableValue.setValue(_value);
+ assertEquals(_taskVariableValue.getValue(),_value);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetValue() {
+ _taskVariableValue.setValue(_value);
+ verify(_taskVariableValue).setValue(_value);
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetOperator() {
+ _taskVariableValue.setOperator(_operator);
+ assertEquals(_taskVariableValue.getOperator(),_operator);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetRequestDetails() {
+ _taskVariableValue.setOperator(_operator);
+ verify(_taskVariableValue).setOperator(_operator);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java
index 1a9baba487..b08729b0ff 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TaskVariablesTest.java
@@ -23,7 +23,6 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskVariableValue;
@@ -37,36 +36,36 @@ import java.util.List;
public class TaskVariablesTest {
- TaskVariables _taskVariables;
- private List<TaskVariableValue> _taskVariableValueList;
+ TaskVariables _taskVariables;
+ private List<TaskVariableValue> _taskVariableValueList;
- public TaskVariablesTest() {
- }
+ public TaskVariablesTest() {
+ }
- @SuppressWarnings("unchecked")
- @Before
- public void setUp() {
- _taskVariables = mock(TaskVariables.class);
- _taskVariableValueList = mock(List.class);
- when(_taskVariables.getTaskVariables()).thenReturn(_taskVariableValueList);
- }
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() {
+ _taskVariables = mock(TaskVariables.class);
+ _taskVariableValueList = mock(List.class);
+ when(_taskVariables.getTaskVariables()).thenReturn(_taskVariableValueList);
+ }
- @After
- public void tearDown() {
- _taskVariables = null;
- }
+ @After
+ public void tearDown() {
+ _taskVariables = null;
+ }
- @Test
- public void testGetTaskVariables() {
- List<TaskVariableValue> result = _taskVariables.getTaskVariables();
- assertEquals(_taskVariableValueList, result);
+ @Test
+ public void testGetTaskVariables() {
+ List<TaskVariableValue> result = _taskVariables.getTaskVariables();
+ assertEquals(_taskVariableValueList, result);
- }
+ }
- @Test
- public void testSetTaskVariables() {
- _taskVariables.setTaskVariables(_taskVariableValueList);
- verify(_taskVariables).setTaskVariables(_taskVariableValueList);
+ @Test
+ public void testSetTaskVariables() {
+ _taskVariables.setTaskVariables(_taskVariableValueList);
+ verify(_taskVariables).setTaskVariables(_taskVariableValueList);
- }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java
index 2832833a62..eeb745d3bf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksGetResponseTest.java
@@ -23,7 +23,6 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import static org.junit.Assert.assertEquals;
-
import org.junit.Before;
import org.junit.Test;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TaskList;
@@ -37,36 +36,36 @@ import java.util.List;
public class TasksGetResponseTest {
- TasksGetResponse _tasksGetResponse;
- private List<TaskList> _taskList;
+ TasksGetResponse _tasksGetResponse;
+ private List<TaskList> _taskList;
- public TasksGetResponseTest() {
- }
+ public TasksGetResponseTest() {
+ }
- @SuppressWarnings("unchecked")
- @Before
- public void setUp() {
- _tasksGetResponse = mock(TasksGetResponse.class);
- _taskList = mock(List.class);
- when(_tasksGetResponse.getTaskList()).thenReturn(_taskList);
- }
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() {
+ _tasksGetResponse = mock(TasksGetResponse.class);
+ _taskList = mock(List.class);
+ when(_tasksGetResponse.getTaskList()).thenReturn(_taskList);
+ }
- @After
- public void tearDown() {
- _tasksGetResponse = null;
- }
+ @After
+ public void tearDown() {
+ _tasksGetResponse = null;
+ }
- @Test
- public void testGetTaskList() {
- List<TaskList> result = _tasksGetResponse.getTaskList();
- assertEquals(_taskList, result);
+ @Test
+ public void testGetTaskList() {
+ List<TaskList> result = _tasksGetResponse.getTaskList();
+ assertEquals(_taskList, result);
- }
+ }
- @Test
- public void testSetTaskList() {
- _tasksGetResponse.setTaskList(_taskList);
- verify(_tasksGetResponse).setTaskList(_taskList);
+ @Test
+ public void testSetTaskList() {
+ _tasksGetResponse.setTaskList(_taskList);
+ verify(_tasksGetResponse).setTaskList(_taskList);
- }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java
index 0f3dad357d..8bfdb645d7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/TasksRequestTest.java
@@ -21,56 +21,52 @@
package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
-
import static org.junit.Assert.assertTrue;
-
import org.junit.Before;
import org.junit.Test;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.openecomp.mso.apihandlerinfra.tasksbeans.RequestDetails;
import org.openecomp.mso.apihandlerinfra.tasksbeans.TasksRequest;
public class TasksRequestTest {
- TasksRequest _tasksRequest;
- private RequestDetails _requestDetails;
+ TasksRequest _tasksRequest;
+ private RequestDetails _requestDetails;
- public TasksRequestTest() {
- }
+ public TasksRequestTest() {
+ }
- @Before
- public void setUp() {
- _tasksRequest = mock(TasksRequest.class);
- _requestDetails = new RequestDetails();
- when(_tasksRequest.getRequestDetails()).thenReturn(_requestDetails);
- }
+ @Before
+ public void setUp() {
+ _tasksRequest = mock(TasksRequest.class);
+ _requestDetails = new RequestDetails();
+ when(_tasksRequest.getRequestDetails()).thenReturn(_requestDetails);
+ }
- @After
- public void tearDown() {
- _tasksRequest = null;
- }
+ @After
+ public void tearDown() {
+ _tasksRequest = null;
+ }
- /**
- * Test of getRequestDetails method
- */
- @Test
- public void testGetRequestDetails() {
- _tasksRequest.setRequestDetails(_requestDetails);
- assertTrue(_tasksRequest.getRequestDetails().equals(_requestDetails));
+ /**
+ * Test of getRequestDetails method
+ */
+ @Test
+ public void testGetRequestDetails() {
+ _tasksRequest.setRequestDetails(_requestDetails);
+ assertTrue(_tasksRequest.getRequestDetails().equals(_requestDetails));
- }
+ }
- /**
- * Test setRequestDetails
- */
- @Test
- public void testSetRequestDetails() {
- _tasksRequest.setRequestDetails(_requestDetails);
- verify(_tasksRequest).setRequestDetails(_requestDetails);
- }
+ /**
+ * Test setRequestDetails
+ */
+ @Test
+ public void testSetRequestDetails() {
+ _tasksRequest.setRequestDetails(_requestDetails);
+ verify(_tasksRequest).setRequestDetails(_requestDetails);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java
index 2aa2861178..41b43c06d8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/ValueTest.java
@@ -23,49 +23,47 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.openecomp.mso.apihandlerinfra.tasksbeans.Value;
public class ValueTest {
- Value _valueInstance;
- protected String _value;
+ Value _valueInstance;
+ protected String _value;
- public ValueTest() {
- }
+ public ValueTest() {
+ }
- @Before
- public void setUp() {
- _valueInstance = mock(Value.class);
- _value = "_value";
- when(_valueInstance.getValue()).thenReturn(_value);
- }
+ @Before
+ public void setUp() {
+ _valueInstance = mock(Value.class);
+ _value = "_value";
+ when(_valueInstance.getValue()).thenReturn(_value);
+ }
- @After
- public void tearDown() {
- _valueInstance = null;
- }
+ @After
+ public void tearDown() {
+ _valueInstance = null;
+ }
- /**
- * Test of getValue method
- */
- @Test
- public void testGetValue() {
- _valueInstance.setValue(_value);
- assertEquals(_valueInstance.getValue(), _value);
+ /**
+ * Test of getValue method
+ */
+ @Test
+ public void testGetValue() {
+ _valueInstance.setValue(_value);
+ assertEquals(_valueInstance.getValue(),_value);
- }
+ }
- /**
- * Test setValue
- */
- @Test
- public void testSetValue() {
- _valueInstance.setValue(_value);
- verify(_valueInstance).setValue(_value);
- }
+ /**
+ * Test setValue
+ */
+ @Test
+ public void testSetValue() {
+ _valueInstance.setValue(_value);
+ verify(_valueInstance).setValue(_value);
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java
index 3b84e764e2..fdfd5a16bc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/taskbeans/VariablesTest.java
@@ -23,77 +23,75 @@ package org.openecomp.mso.apihandlerinfra.taskbeans;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-
import org.openecomp.mso.apihandlerinfra.tasksbeans.Variables;
import org.openecomp.mso.apihandlerinfra.tasksbeans.Value;
public class VariablesTest {
- Variables _variables;
- protected Value _source;
- protected Value _responseValue;
+ Variables _variables;
+ protected Value _source;
+ protected Value _responseValue;
protected Value _requestorId;
-
+
@Before
- public void setUp() {
- _variables = mock(Variables.class);
+ public void setUp() {
+ _variables = mock(Variables.class);
_source = mock(Value.class);
_responseValue = mock(Value.class);
_requestorId = mock(Value.class);
-
- when(_variables.getSource()).thenReturn(_source);
- when(_variables.getRequestorId()).thenReturn(_requestorId);
- when(_variables.getResponseValue()).thenReturn(_responseValue);
-
- }
-
- @After
- public void tearDown() {
- _variables = null;
- _source = null;
- _responseValue = null;
- _requestorId = null;
- }
-
- @Test
+
+ when(_variables.getSource()).thenReturn(_source);
+ when(_variables.getRequestorId()).thenReturn(_requestorId);
+ when(_variables.getResponseValue()).thenReturn(_responseValue);
+
+ }
+
+ @After
+ public void tearDown() {
+ _variables = null;
+ _source = null;
+ _responseValue = null;
+ _requestorId = null;
+ }
+
+ @Test
public void testGetSource() {
- _variables.setSource(_source);
- assertTrue(_variables.getSource().equals(_source));
- }
-
- @Test
- public void testSetSource() {
- _variables.setSource(_source);
- verify(_variables).setSource(_source);
+ _variables.setSource(_source);
+ assertTrue(_variables.getSource().equals(_source));
}
- @Test
+ @Test
+ public void testSetSource(){
+ _variables.setSource(_source);
+ verify(_variables).setSource(_source);
+ }
+
+ @Test
public void testGetResponseValue() {
- _variables.setResponseValue(_responseValue);
- assertTrue(_variables.getResponseValue().equals(_responseValue));
+ _variables.setResponseValue(_responseValue);
+ assertTrue(_variables.getResponseValue().equals(_responseValue));
}
- @Test
- public void testSetResponseValue() {
- _variables.setResponseValue(_responseValue);
- verify(_variables).setResponseValue(_responseValue);
- }
-
- @Test
+ @Test
+ public void testSetResponseValue(){
+ _variables.setResponseValue(_responseValue);
+ verify(_variables).setResponseValue(_responseValue);
+ }
+
+ @Test
public void testGetRequestorId() {
- _variables.setRequestorId(_requestorId);
- assertTrue(_variables.getRequestorId().equals(_requestorId));
- }
-
- @Test
- public void testSetRequestorId() {
- _variables.setRequestorId(_requestorId);
- verify(_variables).setRequestorId(_requestorId);
+ _variables.setRequestorId(_requestorId);
+ assertTrue(_variables.getRequestorId().equals(_requestorId));
}
+ @Test
+ public void testSetRequestorId(){
+ _variables.setRequestorId(_requestorId);
+ verify(_variables).setRequestorId(_requestorId);
+ }
+
}