aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-03-09 10:00:26 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-09 10:00:26 +0000
commitf3b28a0aafd83a57d42afbf23c9f6fbe6f546db3 (patch)
tree5ecb2b2a78ab3139828db18de5f2a76d76c77519 /mso-api-handlers
parent8d0b9eb56af520d28c423da76c0f0be02cb453c7 (diff)
parent327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e (diff)
Merge "Reduce log noise/warnings format to conventions"
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java102
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java67
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java32
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java94
-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
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java141
36 files changed, 3591 insertions, 3529 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
index 4e4f0ee189..6fc396dd11 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java
@@ -50,77 +50,71 @@ import org.openecomp.mso.properties.MsoJavaProperties;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class BPELRestClientTest {
+ @Mock
+ private HttpClient mockHttpClient;
- @Mock
- private HttpClient mockHttpClient;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void tesBPELPost() throws JsonGenerationException,
- JsonMappingException, IOException {
-
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
- String responseBody ="<layer3activate:service-response xmlns:layer3activate=\"http://org.openecomp/mso/request/layer3serviceactivate/schema/v1\""
- + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
- + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
- + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
- + "<reqtype:request-id>req5</reqtype:request-id>"
- + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
- + "<reqtype:source>OMX</reqtype:source>"
- + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
- + "</layer3activate:service-response>";
-
- HttpResponse mockResponse = createResponse(200, responseBody);
- mockHttpClient = Mockito.mock(HttpClient.class);
- Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
- .thenReturn(mockResponse);
+ @Test
+ public void tesBPELPost() throws JsonGenerationException,
+ JsonMappingException, IOException {
- String reqXML = "<xml>test</xml>";
- String orchestrationURI = "/active-bpel/services/REST/MsoLayer3ServiceActivate";
- MsoJavaProperties props = new MsoJavaProperties();
- props.setProperty(CommonConstants.BPEL_URL, "http://localhost:8089");
- props.setProperty("bpelAuth", "786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1");
+ String responseBody = "<layer3activate:service-response xmlns:layer3activate=\"http://org.openecomp/mso/request/layer3serviceactivate/schema/v1\""
+ + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
+ + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
+ + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
+ + "<reqtype:request-id>req5</reqtype:request-id>"
+ + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
+ + "<reqtype:source>OMX</reqtype:source>"
+ + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
+ + "</layer3activate:service-response>";
- RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
- requestClient.setClient(mockHttpClient);
- HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null);
+ HttpResponse mockResponse = createResponse(200, responseBody);
+ mockHttpClient = Mockito.mock(HttpClient.class);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
+ .thenReturn(mockResponse);
+ String reqXML = "<xml>test</xml>";
+ String orchestrationURI = "/active-bpel/services/REST/MsoLayer3ServiceActivate";
- int statusCode = response.getStatusLine().getStatusCode();
- assertEquals(requestClient.getType(), CommonConstants.BPEL);
- assertEquals(statusCode, HttpStatus.SC_OK);
+ MsoJavaProperties props = new MsoJavaProperties();
+ props.setProperty(CommonConstants.BPEL_URL, "http://localhost:8089");
+ props.setProperty("bpelAuth", "786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1");
+ RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
+ requestClient.setClient(mockHttpClient);
+ HttpResponse response = requestClient.post(reqXML, "reqId", "timeout", "version", null, null);
- }
- private HttpResponse createResponse(int respStatus,
- String respBody) {
- HttpResponse response = new BasicHttpResponse(
- new BasicStatusLine(
- new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
- response.setStatusCode(respStatus);
- try {
- response.setEntity(new StringEntity(respBody));
- response.setHeader("Content-Type", "text/xml");
- } catch (Exception e) {
- e.printStackTrace();
- }
- return response;
- }
+ int statusCode = response.getStatusLine().getStatusCode();
+ assertEquals(requestClient.getType(), CommonConstants.BPEL);
+ assertEquals(statusCode, HttpStatus.SC_OK);
+ }
+ private HttpResponse createResponse(int respStatus,
+ String respBody) {
+ HttpResponse response = new BasicHttpResponse(
+ new BasicStatusLine(
+ new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
+ response.setStatusCode(respStatus);
+ try {
+ response.setEntity(new StringEntity(respBody));
+ response.setHeader("Content-Type", "text/xml");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return response;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
index 6ee637d864..ec3a4b025b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java
@@ -51,13 +51,10 @@ import org.openecomp.mso.properties.MsoJavaProperties;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class CamundaClientTest {
-
@Mock
private HttpClient mockHttpClient;
@@ -68,15 +65,15 @@ public class CamundaClientTest {
@Test
public void tesCamundaPost() throws JsonGenerationException,
- JsonMappingException, IOException {
+ JsonMappingException, IOException {
- String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
+ String responseBody = "{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
HttpResponse mockResponse = createResponse(200, responseBody);
mockHttpClient = Mockito.mock(HttpClient.class);
Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
- .thenReturn(mockResponse);
+ .thenReturn(mockResponse);
String reqXML = "<xml>test</xml>";
String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
@@ -93,7 +90,7 @@ public class CamundaClientTest {
assertEquals(requestClient.getType(), CommonConstants.CAMUNDA);
assertEquals(statusCode, HttpStatus.SC_OK);
- props.setProperty (CommonConstants.CAMUNDA_AUTH, "ABCD1234");
+ props.setProperty(CommonConstants.CAMUNDA_AUTH, "ABCD1234");
requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
requestClient.setClient(mockHttpClient);
response = requestClient.post(null, "reqId", null, null, null, null);
@@ -104,8 +101,8 @@ public class CamundaClientTest {
private HttpResponse createResponse(int respStatus,
String respBody) {
HttpResponse response = new BasicHttpResponse(
- new BasicStatusLine(
- new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
+ new BasicStatusLine(
+ new ProtocolVersion("HTTP", 1, 1), respStatus, ""));
response.setStatusCode(respStatus);
try {
response.setEntity(new StringEntity(respBody));
@@ -117,7 +114,4 @@ public class CamundaClientTest {
}
-
-
-
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
index 753ce9dee8..47252e92ad 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java
@@ -21,7 +21,6 @@
package org.openecomp.mso.camunda.tests;
-
import static org.junit.Assert.assertEquals;
import java.io.IOException;
@@ -38,44 +37,42 @@ import org.openecomp.mso.apihandler.common.CommonConstants;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class CamundaRequestTest {
- @Test
- public final void testSerialization() throws JsonGenerationException,
- JsonMappingException, IOException {
- CamundaRequest camundaRequest = new CamundaRequest();
- CamundaInput camundaInput = new CamundaInput();
- CamundaInput host = new CamundaInput();
- CamundaInput schema = new CamundaInput();
- CamundaInput reqid = new CamundaInput();
- CamundaInput svcid = new CamundaInput();
- CamundaInput timeout = new CamundaInput();
- camundaInput
- .setValue("<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:request-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>");
- camundaRequest.setServiceInput(camundaInput);
- host.setValue("localhost");
- camundaRequest.setHost(host);
- schema.setValue("v1");
- camundaRequest.setSchema(schema);
- reqid.setValue("reqid123");
- camundaRequest.setReqid(reqid);
- svcid.setValue("svcid123");
- camundaRequest.setSvcid(svcid);
- timeout.setValue("");
- camundaRequest.setTimeout(timeout);
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ @Test
+ public final void testSerialization() throws JsonGenerationException,
+ JsonMappingException, IOException {
+ CamundaRequest camundaRequest = new CamundaRequest();
+ CamundaInput camundaInput = new CamundaInput();
+ CamundaInput host = new CamundaInput();
+ CamundaInput schema = new CamundaInput();
+ CamundaInput reqid = new CamundaInput();
+ CamundaInput svcid = new CamundaInput();
+ CamundaInput timeout = new CamundaInput();
+ camundaInput
+ .setValue("<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\" xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"> <msoservtypes:request-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.openecomp/mso/request/types/v1\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>");
+ camundaRequest.setServiceInput(camundaInput);
+ host.setValue("localhost");
+ camundaRequest.setHost(host);
+ schema.setValue("v1");
+ camundaRequest.setSchema(schema);
+ reqid.setValue("reqid123");
+ camundaRequest.setReqid(reqid);
+ svcid.setValue("svcid123");
+ camundaRequest.setSvcid(svcid);
+ timeout.setValue("");
+ camundaRequest.setTimeout(timeout);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
- String json = mapper.writeValueAsString(camundaRequest);
- System.out.println(json);
- assertEquals(
- "{\"variables\":{\""+CommonConstants.CAMUNDA_SERVICE_INPUT+"\":{\"value\":\"<aetgt:CreateTenantRequest xmlns:aetgt=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:sdncadapterworkflow=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:ns5=\\\"http://org.openecomp/mso/request/types/v1\\\"> <msoservtypes:request-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>\",\"type\":\"String\"}" +
- ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}",
- json);
+ String json = mapper.writeValueAsString(camundaRequest);
+ System.out.println(json);
+ assertEquals(
+ "{\"variables\":{\"" + CommonConstants.CAMUNDA_SERVICE_INPUT + "\":{\"value\":\"<aetgt:CreateTenantRequest xmlns:aetgt=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:sdncadapterworkflow=\\\"http://org.openecomp/mso/workflow/schema/v1\\\" xmlns:ns5=\\\"http://org.openecomp/mso/request/types/v1\\\"> <msoservtypes:request-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:request-id>155415ab-b4a7-4382-b4c6-d17d950604</msoservtypes:request-id><msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action><msoservtypes:source>OMX</msoservtypes:source><msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url><msoservtypes:order-number>5051563</msoservtypes:order-number><msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> <msoservtypes:service-information xmlns:msoservtypes=\\\"http://org.openecomp/mso/request/types/v1\\\"><msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type><msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id><msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> <sdncadapterworkflow:cloudId>MTSNJA4LCP1</sdncadapterworkflow:cloudId> </aetgt:CreateTenantRequest>\",\"type\":\"String\"}" +
+ ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}",
+ json);
- }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
index c561f1a245..bc51685baf 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaResponseTest.java
@@ -35,25 +35,23 @@ import org.openecomp.mso.apihandler.camundabeans.CamundaResponse;
/**
* This class implements test methods of Camunda Beans.
- *
- *
*/
public class CamundaResponseTest {
- @Test
- public final void testDeserialization() throws JsonGenerationException,
- JsonMappingException, IOException {
- ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
- mapper.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
-
- String responseBody = "{ \"response\": \"<xml>xml</xml>\","+
- "\"messageCode\": 200,"+
- "\"message\": \"Successfully started the process\"," +
- "\"processInstanceID\":null,\"variables\":null}";
-
- CamundaResponse response = mapper.readValue(responseBody, CamundaResponse.class);
- assertEquals(response.toString(), "CamundaResponse [response=<xml>xml</xml>, messageCode=200, message=Successfully started the process]");
-
- }
+ @Test
+ public final void testDeserialization() throws JsonGenerationException,
+ JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
+ mapper.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+
+ String responseBody = "{ \"response\": \"<xml>xml</xml>\"," +
+ "\"messageCode\": 200," +
+ "\"message\": \"Successfully started the process\"," +
+ "\"processInstanceID\":null,\"variables\":null}";
+
+ CamundaResponse response = mapper.readValue(responseBody, CamundaResponse.class);
+ assertEquals(response.toString(), "CamundaResponse [response=<xml>xml</xml>, messageCode=200, message=Successfully started the process]");
+
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
index 99a83d3ed9..d4d563a88b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java
@@ -40,90 +40,88 @@ import org.openecomp.mso.apihandler.common.ResponseHandler;
/**
* This class implements test methods of CamundaResoponseHandler.
- *
- *
*/
public class ResponseHandlerTest {
@Test
- public void tesParseCamundaResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tesParseCamundaResponse() throws JsonGenerationException, JsonMappingException, IOException {
// String body
// ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
- + "\"message\": \"Successfully started the process\"}";
+ + "\"message\": \"Successfully started the process\"}";
- HttpResponse response = createResponse (200, body, "application/json");
+ HttpResponse response = createResponse(200, body, "application/json");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_ACCEPTED);
- assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process");
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_ACCEPTED);
+ assertEquals(respHandler.getResponse().getMessage(), "Successfully started the process");
}
@Test
- public void tesParseBpelResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tesParseBpelResponse() throws JsonGenerationException, JsonMappingException, IOException {
String body = "<layer3activate:service-response xmlns:layer3activate=\"http://org.openecomp/mso/request/layer3serviceactivate/schema/v1\""
- + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
- + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
- + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
- + "<reqtype:request-id>req5</reqtype:request-id>"
- + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
- + "<reqtype:source>OMX</reqtype:source>"
- + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
- + "</layer3activate:service-response>";
-
- HttpResponse response = createResponse (200, body, "text/xml");
-
- ResponseHandler respHandler = new ResponseHandler (response, 0);
-
- int status = respHandler.getStatus ();
- assertEquals (status, HttpStatus.SC_ACCEPTED);
- assertTrue (respHandler.getResponseBody () != null);
+ + "xmlns:reqtype=\"http://org.openecomp/mso/request/types/v1\""
+ + "xmlns:aetgt=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\""
+ + "xmlns:types=\"http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd\">"
+ + "<reqtype:request-id>req5</reqtype:request-id>"
+ + "<reqtype:request-action>Layer3ServiceActivateRequest</reqtype:request-action>"
+ + "<reqtype:source>OMX</reqtype:source>"
+ + "<reqtype:ack-final-indicator>n</reqtype:ack-final-indicator>"
+ + "</layer3activate:service-response>";
+
+ HttpResponse response = createResponse(200, body, "text/xml");
+
+ ResponseHandler respHandler = new ResponseHandler(response, 0);
+
+ int status = respHandler.getStatus();
+ assertEquals(status, HttpStatus.SC_ACCEPTED);
+ assertTrue(respHandler.getResponseBody() != null);
}
@Test
- public void tes404ErrorResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tes404ErrorResponse() throws JsonGenerationException, JsonMappingException, IOException {
+
-
- HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
+ HttpResponse response = createResponse(HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
- int status = respHandler.getStatus ();
+ int status = respHandler.getStatus();
- assertEquals (HttpStatus.SC_NOT_IMPLEMENTED, status);
+ assertEquals(HttpStatus.SC_NOT_IMPLEMENTED, status);
}
@Test
- public void tesGenricErrorResponse () throws JsonGenerationException, JsonMappingException, IOException {
+ public void tesGenricErrorResponse() throws JsonGenerationException, JsonMappingException, IOException {
String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 500,"
- + "\"message\": \"Something went wrong\"}";
+ + "\"message\": \"Something went wrong\"}";
- HttpResponse response = createResponse (500, body, "application/json");
+ HttpResponse response = createResponse(500, body, "application/json");
- ResponseHandler respHandler = new ResponseHandler (response, 1);
+ ResponseHandler respHandler = new ResponseHandler(response, 1);
- int status = respHandler.getStatus ();
- assertEquals (HttpStatus.SC_BAD_GATEWAY, status);
- assertEquals (respHandler.getResponse ().getMessage (), "Something went wrong");
- System.out.println (respHandler.getResponseBody ());
+ int status = respHandler.getStatus();
+ assertEquals(HttpStatus.SC_BAD_GATEWAY, status);
+ assertEquals(respHandler.getResponse().getMessage(), "Something went wrong");
+ System.out.println(respHandler.getResponseBody());
}
- private HttpResponse createResponse (int respStatus, String respBody, String contentType) {
- HttpResponse response = new BasicHttpResponse (new BasicStatusLine (new ProtocolVersion ("HTTP", 1, 1),
- respStatus,
- ""));
- response.setStatusCode (respStatus);
+ private HttpResponse createResponse(int respStatus, String respBody, String contentType) {
+ HttpResponse response = new BasicHttpResponse(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1),
+ respStatus,
+ ""));
+ response.setStatusCode(respStatus);
try {
- response.setEntity (new StringEntity (respBody));
- response.setHeader ("Content-Type", contentType);
+ response.setEntity(new StringEntity(respBody));
+ response.setHeader("Content-Type", contentType);
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
return response;
}
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 9028109735..1198cdb998 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 664f810b35..04c6fc82b9 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 5502d38268..95b0b2bcb5 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 e18bc5e911..fa414186a3 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 c4a1c1fffc..58e17ff273 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,261 +41,259 @@ 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 445fab329f..427b74ce87 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 c1da76e885..66dc9c28d6 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,178 +44,181 @@ 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 3738e2f94a..42c72fed07 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 5f2f39606f..04175fd113 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,6 +22,7 @@ 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;
@@ -43,159 +44,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 3bc2edf8e2..f6d5b3fa2c 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,18 +21,20 @@
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() {
}
@@ -58,7 +60,7 @@ public class RecipeLookupResultTest {
assertEquals(expResult, result);
}
-
+
/**
* Test of setOrchestrationURI method.
*/
@@ -80,7 +82,7 @@ public class RecipeLookupResultTest {
assertEquals(expResult, result);
}
-
+
/**
* Test of setRecipeTimeout method.
*/
@@ -90,7 +92,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 d3d995e851..8f21805be6 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 666da25fe7..12e171cfc9 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 4926da77b1..b2acd33ab7 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 1c3c85653b..3991fbd79f 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,41 +34,42 @@ 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 fd22af012f..6c2f264b21 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 c8ab6b5612..31c7fecf9d 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 9c9ebaee35..ac0fec076a 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,202 +43,206 @@ 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 1800bb4695..59bf6361c5 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 78ed076b55..bfe67c4796 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 fa5e094336..020c5667b7 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,169 +43,173 @@ 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 f257ca7a80..56f133df46 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,54 +21,57 @@
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 3ff389124a..15d43549d5 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,6 +23,7 @@ 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;
@@ -34,87 +35,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 293278955a..9f7e295109 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,225 +23,228 @@ 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 ec45592704..da00be855b 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,6 +23,7 @@ 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;
@@ -33,40 +34,41 @@ 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);
- }
- @After
- public void tearDown() {
- _taskRequestReference = null;
- }
+ public TaskRequestReferenceTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskRequestReference = mock(TaskRequestReference.class);
+ _taskId = "taskid";
+
+ when(_taskRequestReference.getTaskId()).thenReturn(_taskId);
+ }
+
+ @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 b593036556..051bce94d0 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,92 +23,94 @@ 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 b08729b0ff..1a9baba487 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,6 +23,7 @@ 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;
@@ -36,36 +37,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 eeb745d3bf..2832833a62 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,6 +23,7 @@ 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;
@@ -36,36 +37,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 8bfdb645d7..0f3dad357d 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,52 +21,56 @@
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 41b43c06d8..2aa2861178 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,47 +23,49 @@ 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 fdfd5a16bc..3b84e764e2 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,75 +23,77 @@ 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));
+ _variables.setSource(_source);
+ assertTrue(_variables.getSource().equals(_source));
+ }
+
+ @Test
+ public void testSetSource() {
+ _variables.setSource(_source);
+ verify(_variables).setSource(_source);
}
- @Test
- public void testSetSource(){
- _variables.setSource(_source);
- verify(_variables).setSource(_source);
- }
-
- @Test
+ @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));
+ _variables.setRequestorId(_requestorId);
+ assertTrue(_variables.getRequestorId().equals(_requestorId));
+ }
+
+ @Test
+ public void testSetRequestorId() {
+ _variables.setRequestorId(_requestorId);
+ verify(_variables).setRequestorId(_requestorId);
}
- @Test
- public void testSetRequestorId(){
- _variables.setRequestorId(_requestorId);
- verify(_variables).setRequestorId(_requestorId);
- }
-
}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
index 0bb126fa42..198e603f0a 100644
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
@@ -52,9 +52,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked SQLQuery query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createSQLQuery(" show tables "); result = query;
- query.list(); result = Arrays.asList("table1", "table2");
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createSQLQuery(" show tables ");
+ result = query;
+ query.list();
+ result = Arrays.asList("table1", "table2");
}};
assertTrue(requestsDatabase.healthCheck());
@@ -65,8 +68,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.executeUpdate();
+ result = 1;
}};
assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", "unknown"));
}
@@ -76,8 +81,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.executeUpdate();
+ result = 1;
}};
assertEquals(1, requestsDatabase.updateInfraStatus("123", "unknown", 0, "unknown"));
}
@@ -87,8 +94,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.executeUpdate(); result = 1;
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.executeUpdate();
+ result = 1;
}};
assertEquals(1, requestsDatabase.updateInfraFinalStatus("123",
"unknown",
@@ -103,8 +112,10 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- query.uniqueResult(); result = new InfraActiveRequests("123", "action");
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ query.uniqueResult();
+ result = new InfraActiveRequests("123", "action");
}};
assertEquals("123",
requestsDatabase.getRequestFromInfraActive("123").getRequestId());
@@ -116,9 +127,12 @@ public class RequestsDatabaseTest {
@Mocked Criteria criteria) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createCriteria(InfraActiveRequests.class); result = criteria;
- criteria.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createCriteria(InfraActiveRequests.class);
+ result = criteria;
+ criteria.list();
+ result = Arrays.asList(new InfraActiveRequests("123", "action"));
}};
assertEquals(1,
requestsDatabase.getRequestListFromInfraActive("queryattr",
@@ -131,9 +145,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); result = query;
- query.uniqueResult(); result = new InfraActiveRequests("123", "action");
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType");
+ result = query;
+ query.uniqueResult();
+ result = new InfraActiveRequests("123", "action");
}};
assertEquals("123",
requestsDatabase.getRequestFromInfraActive("123", "requestType").getRequestId());
@@ -144,9 +161,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Criteria criteria) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createCriteria(InfraActiveRequests.class); result = criteria;
- criteria.list(); result = Arrays.asList(new InfraActiveRequests());
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createCriteria(InfraActiveRequests.class);
+ result = criteria;
+ criteria.list();
+ result = Arrays.asList(new InfraActiveRequests());
}};
assertEquals(1,
requestsDatabase.getRequestListFromInfraActive("queryAttr",
@@ -159,9 +179,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query;
- query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC");
+ result = query;
+ query.list();
+ result = Arrays.asList(new InfraActiveRequests("123", "action"));
}};
assertEquals("123",
requestsDatabase.checkDuplicateByVnfName("vnfname",
@@ -174,9 +197,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC"); result = query;
- query.list(); result = Arrays.asList(new InfraActiveRequests("123", "action"));
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT') and requestType = :requestType ORDER BY startTime DESC");
+ result = query;
+ query.list();
+ result = Arrays.asList(new InfraActiveRequests("123", "action"));
}};
assertEquals("123",
requestsDatabase.checkDuplicateByVnfId("vnfname",
@@ -194,9 +220,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query;
- query.uniqueResult(); result = new SiteStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM SiteStatus WHERE siteName = :site_name");
+ result = query;
+ query.uniqueResult();
+ result = new SiteStatus();
}};
assertEquals(SiteStatus.class,
requestsDatabase.getSiteStatus("site").getClass());
@@ -207,9 +236,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM SiteStatus WHERE siteName = :site_name"); result = query;
- query.uniqueResult(); result = new SiteStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM SiteStatus WHERE siteName = :site_name");
+ result = query;
+ query.uniqueResult();
+ result = new SiteStatus();
}};
requestsDatabase.updateSiteStatus("site", true);
}
@@ -219,9 +251,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatus("123",
@@ -233,9 +268,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatusByServiceId("123").getClass());
@@ -246,9 +284,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_NAME = :service_name"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_NAME = :service_name");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatusByServiceName("servicename").getClass());
@@ -259,9 +300,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id");
+ result = query;
+ query.uniqueResult();
+ result = new OperationStatus();
}};
requestsDatabase.updateOperationStatus(new OperationStatus());
}
@@ -271,9 +315,12 @@ public class RequestsDatabaseTest {
@Mocked Session session,
@Mocked Query query) throws Exception {
new Expectations() {{
- sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid"); result = query;
- query.uniqueResult(); result = new ResourceOperationStatus();
+ sessionFactoryManager.getSessionFactory().openSession();
+ result = session;
+ session.createQuery("FROM ResourceOperationStatus WHERE serviceId = :service_id and operationId = :operation_id and resourceTemplateUUID= :uuid");
+ result = query;
+ query.uniqueResult();
+ result = new ResourceOperationStatus();
}};
assertEquals(ResourceOperationStatus.class,
requestsDatabase.getResourceOperationStatus("serviceId",