aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java')
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java146
1 files changed, 61 insertions, 85 deletions
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index 2b1dc384a1..abab08bdf3 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -1,21 +1,16 @@
/*
*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
+ * Foundation. ================================================================================ Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
+ * obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and limitations under the
+ * License.
*
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
+ * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
*/
package org.onap.so.bpmn.infrastructure.process;
@@ -29,7 +24,6 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static org.assertj.core.api.Assertions.fail;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import java.io.IOException;
@@ -77,14 +71,13 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
variables.put("bpmnRequest", requestObject);
/**
- * This variable indicates that the flow was invoked asynchronously.
- * It's injected by {@link WorkflowProcessor}.
+ * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
*/
variables.put("isAsyncProcess", "true");
/**
- * Temporary solution to add pnfCorrelationId to context.
- * this value is getting from the request to SO api handler and then convert to CamudaInput
+ * Temporary solution to add pnfCorrelationId to context. this value is getting from the request to SO api
+ * handler and then convert to CamudaInput
*/
variables.put("pnfCorrelationId", "PNFDemo");
@@ -112,12 +105,12 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
mockAai();
mockDmaapForPnf();
- ProcessInstance pi = runtimeService
- .startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
assertThat(pi).isNotNull();
Execution execution = runtimeService.createExecutionQuery().processDefinitionKey("CreateAndActivatePnfResource")
- .activityId("WaitForDmaapPnfReadyNotification").singleResult();
+ .activityId("WaitForDmaapPnfReadyNotification").singleResult();
if (!execution.isSuspended() && !execution.isEnded()) {
try {
@@ -127,25 +120,11 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
}
- assertThat(pi).isStarted().hasPassedInOrder(
- "createVCPE_startEvent",
- "preProcessRequest_ScriptTask",
- "sendSyncAckResponse_ScriptTask",
- "ScriptTask_0cdtchu",
- "DecomposeService",
- "ScriptTask_0lpv2da",
- "ScriptTask_1y241p8",
- "CallActivity_1vc4jeh",
- "ScriptTask_1y5lvl7",
- "GeneratePnfUuid",
- "Task_14l19kv",
- "Pnf_Con",
- "setPONR_ScriptTask",
- "postProcessAndCompletionRequest_ScriptTask",
- "callCompleteMsoProcess_CallActivity",
- "ScriptTask_2",
- "CreateVCPE_EndEvent"
- );
+ assertThat(pi).isStarted().hasPassedInOrder("createVCPE_startEvent", "preProcessRequest_ScriptTask",
+ "sendSyncAckResponse_ScriptTask", "ScriptTask_0cdtchu", "DecomposeService", "ScriptTask_0lpv2da",
+ "ScriptTask_1y241p8", "CallActivity_1vc4jeh", "ScriptTask_1y5lvl7", "GeneratePnfUuid", "Task_14l19kv",
+ "Pnf_Con", "setPONR_ScriptTask", "postProcessAndCompletionRequest_ScriptTask",
+ "callCompleteMsoProcess_CallActivity", "ScriptTask_2", "CreateVCPE_EndEvent");
assertThat(pi).isEnded();
@@ -154,7 +133,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
try {
checkConfigAssign(detailedMessages.get(0));
checkConfigDeploy(detailedMessages.get(1));
- } catch(Exception e){
+ } catch (Exception e) {
e.printStackTrace();
fail("ConfigAssign/deploy request exception", e);
}
@@ -164,7 +143,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
/**
- * the fields of actionIdentifiers should match the one in the response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
+ * the fields of actionIdentifiers should match the one in the
+ * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
@@ -182,15 +162,18 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
- assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
+ .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
+ .matches("68dc9a92-214c-11e7-93ae-92361f002680");
}
private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) {
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
/**
- * the fields of actionIdentifiers should match the one in the response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
+ * the fields of actionIdentifiers should match the one in the
+ * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
@@ -208,8 +191,10 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue();
assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
- assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()).matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
+ .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
+ .matches("68dc9a92-214c-11e7-93ae-92361f002680");
/**
* IP addresses match the OAM ip addresses from AAI.
@@ -229,51 +214,42 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* Get the events from PNF topic
*/
wireMockServer
- .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse)));
+ .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse)));
}
private void mockAai() {
- String aaiResponse = "{\n"
- + " \"results\": [\n"
- + " {\n"
- + " \"resource-type\": \"service-instance\",\n"
- + " \"resource-link\": \"https://localhost:8443/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/key3\"\n"
- + " }\n"
- + " ]\n"
- + "}";
-
- String aaiPnfEntry = "{ \n"
- + " \"pnf-name\":\"PNFDemo\",\n"
- + " \"pnf-id\":\"testtest\",\n"
- + " \"in-maint\":true,\n"
- + " \"resource-version\":\"1541720264047\",\n"
- + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n"
- + " \"ipaddress-v6-oam\":\"::/128\"\n"
- + "}";
+ String aaiResponse = "{\n" + " \"results\": [\n" + " {\n"
+ + " \"resource-type\": \"service-instance\",\n"
+ + " \"resource-link\": \"https://localhost:8443/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/key3\"\n"
+ + " }\n" + " ]\n" + "}";
+
+ String aaiPnfEntry = "{ \n" + " \"pnf-name\":\"PNFDemo\",\n" + " \"pnf-id\":\"testtest\",\n"
+ + " \"in-maint\":true,\n" + " \"resource-version\":\"1541720264047\",\n"
+ + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n" + " \"ipaddress-v6-oam\":\"::/128\"\n" + "}";
/**
* Get the AAI entry for globalCustomerId as specified in the request file.
*/
wireMockServer.stubFor(
- get(urlPathMatching("/aai/v15/business/customers/customer/ADemoCustomerInCiti.*")).willReturn(ok()));
+ get(urlPathMatching("/aai/v15/business/customers/customer/ADemoCustomerInCiti.*")).willReturn(ok()));
/**
- * PUT the service to AAI with globalCustomerId, service type as specified in the request file.
- * Service instance id is generated during runtime, REGEX is used to represent the information.
+ * PUT the service to AAI with globalCustomerId, service type as specified in the request file. Service instance
+ * id is generated during runtime, REGEX is used to represent the information.
*/
wireMockServer.stubFor(put(urlPathMatching(
- "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*")));
+ "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*")));
wireMockServer.stubFor(get(urlPathMatching(
- "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*"))
- .willReturn(okJson(aaiResponse)));
+ "/aai/v15/business/customers/customer/ADemoCustomerInCiti/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/.*"))
+ .willReturn(okJson(aaiResponse)));
/**
* Get the service from AAI
*/
wireMockServer.stubFor(get(urlPathMatching("/aai/v15/nodes/service-instances/service-instance/.*"))
- .willReturn(okJson(aaiResponse)));
+ .willReturn(okJson(aaiResponse)));
/**
* Put the project as specified in the request file to AAI.
@@ -283,8 +259,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* GET the project as specified in the request file to AAI.
*/
- wireMockServer
- .stubFor(get(urlPathMatching("/aai/v15/business/projects/project/Project-Demonstration")).willReturn(ok()));
+ wireMockServer.stubFor(
+ get(urlPathMatching("/aai/v15/business/projects/project/Project-Demonstration")).willReturn(ok()));
/**
* PUT the PNF correlation ID to AAI.
@@ -299,8 +275,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* Put the PNF relationship
*/
- wireMockServer.stubFor(
- put(urlEqualTo("/aai/v15/business/projects/project/Project-Demonstration/relationship-list/relationship")));
+ wireMockServer.stubFor(put(
+ urlEqualTo("/aai/v15/business/projects/project/Project-Demonstration/relationship-list/relationship")));
}
/**
@@ -308,29 +284,29 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
*/
private void mockCatalogDb() {
- String catalogdbClientResponse = FileUtil
- .readResourceFile("response/" + getClass().getSimpleName() + "_catalogdb.json");
+ String catalogdbClientResponse =
+ FileUtil.readResourceFile("response/" + getClass().getSimpleName() + "_catalogdb.json");
/**
* Return valid json for the model UUID in the request file.
*/
wireMockServer
- .stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
- .willReturn(okJson(responseObject)));
+ .stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(responseObject)));
/**
* Return valid json for the service model InvariantUUID as specified in the request file.
*/
wireMockServer.stubFor(
- get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=539b7a2f-9524-4dbf-9eee-f2e05521df3f"))
- .willReturn(okJson(responseObject)));
+ get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=539b7a2f-9524-4dbf-9eee-f2e05521df3f"))
+ .willReturn(okJson(responseObject)));
/**
* Return valid spring data rest json for the service model UUID as specified in the request file.
*/
wireMockServer.stubFor(get(urlEqualTo(
- "/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
- .willReturn(okJson(catalogdbClientResponse)));
+ "/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=f2daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(catalogdbClientResponse)));
}
private void mockRequestDb() {