summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java89
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java54
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java110
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java123
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java106
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java88
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java285
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java131
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java6
20 files changed, 510 insertions, 851 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java
deleted file mode 100644
index 9e320700bd..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.onap.so.bpmn.servicedecomposition.entities;
-
-import org.onap.so.serviceinstancebeans.RequestDetails;
-
-public class BuildingBlockBase {
-
- private Boolean aLaCarte;
- private String apiVersion;
- private Boolean isResume;
- private String resourceId;
- private String requestId;
- private String requestAction;
- private RequestDetails requestDetails;
- private WorkflowResourceIds workflowResourceIds;
- private String vnfType;
-
- public void setaLaCarte(Boolean aLaCarte) {
- this.aLaCarte = aLaCarte;
- }
-
- public void setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- }
-
- public void setResume(Boolean resume) {
- isResume = resume;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public void setRequestAction(String requestAction) {
- this.requestAction = requestAction;
- }
-
- public void setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- }
-
- public void setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
- this.workflowResourceIds = workflowResourceIds;
- }
-
- public void setVnfType(String vnfType) {
- this.vnfType = vnfType;
- }
-
- public Boolean isResume() {
- return isResume;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public String getApiVersion() {
- return apiVersion;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public String getRequestAction() {
- return requestAction;
- }
-
- public Boolean isaLaCarte() {
- return aLaCarte;
- }
-
- public String getVnfType() {
- return vnfType;
- }
-
- public WorkflowResourceIds getWorkflowResourceIds() {
- return workflowResourceIds;
- }
-
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
index 9274e0659e..abd301fa4d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
@@ -21,36 +21,119 @@
package org.onap.so.bpmn.servicedecomposition.entities;
import java.io.Serializable;
+import org.onap.so.serviceinstancebeans.RequestDetails;
-public class ExecuteBuildingBlock extends BuildingBlockBase implements Serializable {
+public class ExecuteBuildingBlock implements Serializable {
+ private static final long serialVersionUID = 2L;
private BuildingBlock buildingBlock;
- private ConfigurationResourceKeys configurationResourceKeys;
+ private String requestId;
+ private String apiVersion;
+ private String resourceId;
+ private String requestAction;
+ private String vnfType;
+ private Boolean aLaCarte;
private Boolean homing = false;
- private static final long serialVersionUID = 3L;
+ private WorkflowResourceIds workflowResourceIds;
+ private RequestDetails requestDetails;
+ private ConfigurationResourceKeys configurationResourceKeys;
public BuildingBlock getBuildingBlock() {
return buildingBlock;
}
- public void setBuildingBlock(BuildingBlock buildingBlock) {
+ public ExecuteBuildingBlock setBuildingBlock(BuildingBlock buildingBlock) {
this.buildingBlock = buildingBlock;
+ return this;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public ExecuteBuildingBlock setRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public ExecuteBuildingBlock setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ return this;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public ExecuteBuildingBlock setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ return this;
+ }
+
+ public String getRequestAction() {
+ return requestAction;
+ }
+
+ public ExecuteBuildingBlock setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ return this;
+ }
+
+ public Boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public ExecuteBuildingBlock setaLaCarte(Boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ return this;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public ExecuteBuildingBlock setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ return this;
}
public Boolean isHoming() {
return homing;
}
- public void setHoming(Boolean homing) {
+ public ExecuteBuildingBlock setHoming(Boolean homing) {
this.homing = homing;
+ return this;
+ }
+
+ public WorkflowResourceIds getWorkflowResourceIds() {
+ return workflowResourceIds;
+ }
+
+ public ExecuteBuildingBlock setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
+ this.workflowResourceIds = workflowResourceIds;
+ return this;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public ExecuteBuildingBlock setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ return this;
}
public ConfigurationResourceKeys getConfigurationResourceKeys() {
return configurationResourceKeys;
}
- public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ public ExecuteBuildingBlock setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
this.configurationResourceKeys = configurationResourceKeys;
+ return this;
}
-
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
index 4379864bfe..68161a8dd5 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.serviceinstancebeans.Pnfs;
@@ -36,6 +37,10 @@ final class BBInputSetupPnf {
Pnf pnf = new Pnf();
pnf.setPnfId(pnfId);
pnf.setPnfName(pnfs.getInstanceName());
+ pnf.setModelInfoPnf(new ModelInfoPnf());
+ pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId());
+ pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId());
+ pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId());
pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
serviceInstance.getPnfs().add(pnf);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
index 0eef9cccd8..aa9943b9b1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
@@ -29,6 +29,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.Pnfs;
import static org.mockito.Mockito.doReturn;
@@ -38,11 +39,22 @@ public class BBInputSetupPnfTest {
@Mock
private Pnfs pnfs;
+ @Mock
+ private ModelInfo modelInfo;
+
@Test
public void populatePnfShouldSetRequiredFields() {
final String pnfId = "PNF_id1";
final String pnfName = "PNF_name1";
+ final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb031";
+ final String modelInvariantId = "3360a2a5-22ff-44c7-8935-08c8e5ecbd06";
+ final String modelVersionId = "b80c3a52-abd4-436c-a22e-9c5da768781a";
+
+ doReturn(modelCustomizationId).when(modelInfo).getModelCustomizationId();
+ doReturn(modelInvariantId).when(modelInfo).getModelInvariantId();
+ doReturn(modelVersionId).when(modelInfo).getModelVersionId();
doReturn(pnfName).when(pnfs).getInstanceName();
+ doReturn(modelInfo).when(pnfs).getModelInfo();
ServiceInstance serviceInstance = new ServiceInstance();
BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance);
@@ -53,6 +65,9 @@ public class BBInputSetupPnfTest {
assertEquals(pnfId, pnf.getPnfId());
assertEquals(pnfName, pnf.getPnfName());
+ assertEquals(modelCustomizationId, pnf.getModelInfoPnf().getModelCustomizationUuid());
+ assertEquals(modelInvariantId, pnf.getModelInfoPnf().getModelInvariantUuid());
+ assertEquals(modelVersionId, pnf.getModelInfoPnf().getModelUuid());
assertEquals(OrchestrationStatus.PRECREATED, pnf.getOrchestrationStatus());
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
index a74d78e04b..d7cfaf94f7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
@@ -115,8 +115,7 @@ public class BBInputSetupPopulateMethodsTest {
.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -182,8 +181,7 @@ public class BBInputSetupPopulateMethodsTest {
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.VF_MODULE.toString()).setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
@@ -245,8 +243,7 @@ public class BBInputSetupPopulateMethodsTest {
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("AssignFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index ffdc275dee..458919c48e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -308,9 +308,8 @@ public class BBInputSetupTest {
@Test
public void testGetExecuteBBFromExecution() throws IOException {
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
- ExecuteBuildingBlock expected = new ExecuteBuildingBlock();
- expected.setBuildingBlock(bb);
- expected.setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017");
+ ExecuteBuildingBlock expected =
+ new ExecuteBuildingBlock().setBuildingBlock(bb).setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017");
DelegateExecution execution = Mockito.mock(DelegateExecution.class);
doReturn(expected).when(execution).getVariable(any(String.class));
ExecuteBuildingBlock actual = SPY_bbInputSetup.getExecuteBBFromExecution(execution);
@@ -322,8 +321,7 @@ public class BBInputSetupTest {
GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"),
GeneralBuildingBlock.class);
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setRequestId("requestId");
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId");
RequestDetails requestDetails = new RequestDetails();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelType(ModelType.service);
@@ -351,8 +349,7 @@ public class BBInputSetupTest {
GeneralBuildingBlock expected = mapper
.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"), GeneralBuildingBlock.class);
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setRequestId("requestId");
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId");
RequestDetails requestDetails = new RequestDetails();
requestDetails.setModelInfo(null);
RequestParameters requestParams = new RequestParameters();
@@ -1006,9 +1003,7 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString());
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setaLaCarte(true);
- executeBB.setBuildingBlock(buildingBlock);
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setaLaCarte(true).setBuildingBlock(buildingBlock);
RequestDetails requestDetails = new RequestDetails();
RequestInfo reqInfo = new RequestInfo();
reqInfo.setInstanceName("serviceInstanceName");
@@ -2055,8 +2050,7 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("AssignVrfConfigurationBB");
buildingBlock.setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
@@ -2236,8 +2230,7 @@ public class BBInputSetupTest {
.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -2306,8 +2299,7 @@ public class BBInputSetupTest {
requestDetails.getRequestParameters().setUserParams(null);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(false);
@@ -2352,8 +2344,7 @@ public class BBInputSetupTest {
requestDetails.getRequestParameters().setUserParams(null);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(true);
@@ -2399,8 +2390,7 @@ public class BBInputSetupTest {
requestDetails.getRequestParameters().setUserParams(null);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(otherFlowName).setKey("ab153b6e-c364-44c0-bef6-1f2982117f04")
.setIsVirtualLink(true);
@@ -2472,8 +2462,7 @@ public class BBInputSetupTest {
aaiNetwork.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("DeleteNetworkBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -2524,8 +2513,7 @@ public class BBInputSetupTest {
aaiVnf.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
buildingBlock.setBpmnScope("VNF");
@@ -2577,8 +2565,7 @@ public class BBInputSetupTest {
aaiVnf.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ActivateVnfBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -2634,8 +2621,7 @@ public class BBInputSetupTest {
aaiVfModule.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
buildingBlock.setBpmnScope("VfModule");
@@ -2695,8 +2681,7 @@ public class BBInputSetupTest {
aaiVfModule.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("UnassignVfModuleBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
@@ -2757,8 +2742,7 @@ public class BBInputSetupTest {
aaiVolumeGroup.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("UnassignVolumeGroupBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
@@ -2824,8 +2808,7 @@ public class BBInputSetupTest {
aaiConfiguration.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ActivateFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
@@ -2893,8 +2876,7 @@ public class BBInputSetupTest {
@Test
public void testGetVnfId() {
String expected = "vnfId";
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setRequestId("requestId");
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId");
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
InfraActiveRequests request = new InfraActiveRequests();
request.setVnfId(expected);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
index bac29150c1..ee47b514d1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
@@ -58,8 +58,7 @@ public class ExecuteBuildingBlockRainyDayTest extends BaseTest {
vnf = setGenericVnf();
BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- executeBuildingBlock.setBuildingBlock(buildingBlock);
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock);
delegateExecution.setVariable("gBBInput", gBBInput);
delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, ""));
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java
deleted file mode 100644
index fd7498f468..0000000000
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.onap.so.bpmn.common.workflow.service;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.ProcessEngine;
-import org.camunda.bpm.engine.RepositoryService;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.migration.MigrationInstruction;
-import org.camunda.bpm.engine.migration.MigrationPlan;
-import org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder;
-import org.camunda.bpm.engine.repository.ProcessDefinition;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstanceQuery;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Service;
-
-@Service
-public class AutoProcessInstanceMigrationService {
-
- private static Logger logger = LoggerFactory.getLogger(AutoProcessInstanceMigrationService.class);
-
- @Autowired
- private Environment env;
- @Autowired
- protected ProcessEngine processEngine;
-
- @Value("${migration.autoMigrationEnabled:false}")
- private boolean autoMigrationEnabled;
-
- private RuntimeService runtimeService;
- private RepositoryService repositoryService;
- private List<String> processDefinitionKeys;
-
- @EventListener(ApplicationReadyEvent.class)
- protected void executeAutoProcessInstanceMigrations() {
- if (autoMigrationEnabled) {
- runtimeService = processEngine.getRuntimeService();
- repositoryService = processEngine.getRepositoryService();
- for (ProcessDefinition definition : getProcessDefinitions()) {
- for (ProcessDefinition procDefOld : getOldProcessDefinitions(definition.getKey(),
- definition.getVersion())) {
- migrate(procDefOld.getId(), definition.getId());
- }
- }
- }
- }
-
- protected List<ProcessDefinition> getProcessDefinitions() {
- List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
- processDefinitionKeys = env.getProperty("migration.processDefinitionKeys", List.class, new ArrayList<String>());
- for (String key : processDefinitionKeys) {
- processDefinitions.add(repositoryService.createProcessDefinitionQuery().processDefinitionKey(key)
- .latestVersion().singleResult());
- }
- return processDefinitions;
- }
-
- private void migrate(String sourceProcessDefinitionId, String targetProcessDefinitionId) {
- MigrationPlan migrationPlan =
- runtimeService.createMigrationPlan(sourceProcessDefinitionId, targetProcessDefinitionId)
- .mapEqualActivities().updateEventTriggers().build();
- List<String> activityIds = new ArrayList<>();
-
- for (MigrationInstruction instruction : migrationPlan.getInstructions()) {
- activityIds.add(instruction.getSourceActivityId());
- }
- for (String activityId : activityIds) {
- ProcessInstanceQuery activeProcessInstancesQuery = runtimeService.createProcessInstanceQuery()
- .processDefinitionId(sourceProcessDefinitionId).activityIdIn(activityId).active();
- if (!activeProcessInstancesQuery.list().isEmpty()) {
- logger.info("Migrating {} process instance(s) from {} to {}",
- Long.valueOf(activeProcessInstancesQuery.count()), sourceProcessDefinitionId,
- targetProcessDefinitionId);
- MigrationPlanExecutionBuilder migration =
- runtimeService.newMigration(migrationPlan).processInstanceQuery(activeProcessInstancesQuery);
- migration.executeAsync();
- }
- }
- suspendEmptyProcessDefinition(sourceProcessDefinitionId);
- }
-
- private void suspendEmptyProcessDefinition(String sourceProcessDefinitionId) {
- List<ProcessInstance> activeProcessInstances = runtimeService.createProcessInstanceQuery()
- .processDefinitionId(sourceProcessDefinitionId).active().list();
- if (activeProcessInstances.isEmpty()) {
- repositoryService.suspendProcessDefinitionById(sourceProcessDefinitionId);
- } else {
- logger.info("Unable to migrate {} process instance(s) from {}",
- Integer.valueOf(activeProcessInstances.size()), sourceProcessDefinitionId);
- }
- }
-
- protected List<ProcessDefinition> getOldProcessDefinitions(String key, int version) {
- List<ProcessDefinition> processDefinitions =
- repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).list();
- List<ProcessDefinition> oldProcessDefinitions = new ArrayList<>();
- for (ProcessDefinition processDef : processDefinitions) {
- if (!processDef.isSuspended() && (processDef.getVersion() != version)) {
- oldProcessDefinitions.add(processDef);
- }
- }
- return oldProcessDefinitions;
- }
-}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java
deleted file mode 100644
index 77b3535ce1..0000000000
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.so.bpmn.common.workflow.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.ProcessEngine;
-import org.camunda.bpm.engine.RepositoryService;
-import org.camunda.bpm.engine.repository.ProcessDefinition;
-import org.camunda.bpm.engine.repository.ProcessDefinitionQuery;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.springframework.core.env.Environment;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AutoProcessInstanceMigrationServiceTest {
-
- @Mock
- private ProcessEngine processEngine;
-
- @Mock
- private ProcessDefinition outdated;
-
- @Mock
- private ProcessDefinition newDef;
-
- @Mock
- private ProcessDefinition key;
-
- @Mock
- private ProcessDefinition testKey;
-
- @Mock
- private ProcessDefinition suspendedDef;
-
- @Mock
- private RepositoryService repositoryService;
-
- @Mock
- private ProcessDefinitionQuery query;
-
- @Mock
- private ProcessDefinitionQuery keyQuery;
-
- @Mock
- private Environment env;
-
- @Spy
- @InjectMocks
- private AutoProcessInstanceMigrationService migrationService;
-
-
- @Test
- public void getOldProcessDefinitionsTest() {
- List<ProcessDefinition> expectedList = new ArrayList<>();
- expectedList.add(outdated);
-
- List<ProcessDefinition> defList = new ArrayList<>();
- defList.add(outdated);
- defList.add(newDef);
- defList.add(suspendedDef);
-
- doReturn(query).when(repositoryService).createProcessDefinitionQuery();
- doReturn(query).when(query).processDefinitionKey("test");
- doReturn(defList).when(query).list();
- doReturn(3).when(outdated).getVersion();
- doReturn(4).when(newDef).getVersion();
- doReturn(true).when(suspendedDef).isSuspended();
- List<ProcessDefinition> outdatedList = migrationService.getOldProcessDefinitions("test", 4);
-
- assertEquals(expectedList, outdatedList);
- }
-
- @Test
- public void getProcessDefinitionsTest() {
- List<ProcessDefinition> expected = new ArrayList<ProcessDefinition>();
- expected.add(testKey);
- expected.add(key);
-
- List<String> processDefinitionKeys = new ArrayList<String>();
- processDefinitionKeys.add("testKey");
- processDefinitionKeys.add("key");
-
- doReturn(processDefinitionKeys).when(env).getProperty("migration.processDefinitionKeys", List.class,
- new ArrayList<String>());
-
- doReturn(query).when(repositoryService).createProcessDefinitionQuery();
- doReturn(query).when(query).processDefinitionKey("testKey");
- doReturn(query).when(query).latestVersion();
- doReturn(testKey).when(query).singleResult();
-
- doReturn(keyQuery).when(query).processDefinitionKey("key");
- doReturn(keyQuery).when(keyQuery).latestVersion();
- doReturn(key).when(keyQuery).singleResult();
-
- List<ProcessDefinition> actualProcessDefinitions = migrationService.getProcessDefinitions();
-
- assertEquals(expected, actualProcessDefinitions);
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index a4ffb45370..415d4614da 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -166,16 +166,10 @@ public class ExecuteActivity implements JavaDelegate {
String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- executeBuildingBlock.setaLaCarte(true);
- executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION));
- executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID));
- executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE));
- executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
- executeBuildingBlock.setRequestId(requestId);
- executeBuildingBlock.setBuildingBlock(buildingBlock);
- executeBuildingBlock.setRequestDetails(requestDetails);
- return executeBuildingBlock;
+ return new ExecuteBuildingBlock().setaLaCarte(true).setRequestAction((String) execution.getVariable(G_ACTION))
+ .setResourceId((String) execution.getVariable(VNF_ID))
+ .setVnfType((String) execution.getVariable(VNF_TYPE)).setWorkflowResourceIds(workflowResourceIds)
+ .setRequestId(requestId).setBuildingBlock(buildingBlock).setRequestDetails(requestDetails);
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
index d22435c495..1852485083 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
@@ -20,48 +20,136 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
+import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlockBase;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
-import java.util.List;
-public class ConfigBuildingBlocksDataObject extends BuildingBlockBase {
+public class ConfigBuildingBlocksDataObject {
- private DelegateExecution execution;
+ private ServiceInstancesRequest sIRequest;
private List<OrchestrationFlow> orchFlows;
+ private String requestId;
private Resource resourceKey;
- private ServiceInstancesRequest sIRequest;
+ private String apiVersion;
+ private String resourceId;
+ private String requestAction;
+ private boolean aLaCarte;
+ private String vnfType;
+ private WorkflowResourceIds workflowResourceIds;
+ private RequestDetails requestDetails;
+ private DelegateExecution execution;
public ServiceInstancesRequest getsIRequest() {
return sIRequest;
}
- public void setsIRequest(ServiceInstancesRequest sIRequest) {
+ public ConfigBuildingBlocksDataObject setsIRequest(ServiceInstancesRequest sIRequest) {
this.sIRequest = sIRequest;
+ return this;
}
public List<OrchestrationFlow> getOrchFlows() {
return orchFlows;
}
- public void setOrchFlows(List<OrchestrationFlow> orchFlows) {
+ public ConfigBuildingBlocksDataObject setOrchFlows(List<OrchestrationFlow> orchFlows) {
this.orchFlows = orchFlows;
+ return this;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
}
public Resource getResourceKey() {
return resourceKey;
}
- public void setResourceKey(Resource resourceKey) {
+ public ConfigBuildingBlocksDataObject setResourceKey(Resource resourceKey) {
this.resourceKey = resourceKey;
+ return this;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public ConfigBuildingBlocksDataObject setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ return this;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public ConfigBuildingBlocksDataObject setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ return this;
+ }
+
+ public String getRequestAction() {
+ return requestAction;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ return this;
+ }
+
+ public boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public ConfigBuildingBlocksDataObject setaLaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ return this;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+
+ public ConfigBuildingBlocksDataObject setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ return this;
+ }
+
+ public WorkflowResourceIds getWorkflowResourceIds() {
+ return workflowResourceIds;
+ }
+
+ public ConfigBuildingBlocksDataObject setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
+ this.workflowResourceIds = workflowResourceIds;
+ return this;
+ }
+
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public ConfigBuildingBlocksDataObject setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ return this;
}
public DelegateExecution getExecution() {
return execution;
}
- public void setExecution(DelegateExecution execution) {
+ public ConfigBuildingBlocksDataObject setExecution(DelegateExecution execution) {
this.execution = execution;
+ return this;
}
+
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index e2dd73f9ec..f233de2baa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -11,9 +11,9 @@
* 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.
@@ -24,9 +24,15 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.EnumSet;
-import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
@@ -45,6 +51,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
+import java.util.EnumSet;
+import java.util.Set;
@Component
public class OrchestrationStatusValidator {
@@ -57,9 +65,6 @@ public class OrchestrationStatusValidator {
private static final String ORCHESTRATION_VALIDATION_FAIL =
"Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)";
private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult";
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
private static final String RESOURCE_EXIST_STATUS_MESSAGE =
"The %s was found to already exist, thus no new %s was created in the cloud via this request";
private static final String RESOURCE_NOT_EXIST_STATUS_MESSAGE =
@@ -79,20 +84,11 @@ public class OrchestrationStatusValidator {
/**
* This method validate's the status of the OrchestrationStatus against the buildingBlockDetail ResourceType
- *
- * @param execution
*/
public void validateOrchestrationStatus(BuildingBlockExecution execution) {
try {
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult =
- execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT);
-
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
-
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
-
String buildingBlockFlowName = execution.getFlowToBeCalled();
-
BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName);
if (buildingBlockDetail == null) {
@@ -100,63 +96,10 @@ public class OrchestrationStatusValidator {
String.format(BUILDING_BLOCK_DETAIL_NOT_FOUND, buildingBlockFlowName));
}
- OrchestrationStatus orchestrationStatus;
-
- switch (buildingBlockDetail.getResourceType()) {
- case SERVICE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- orchestrationStatus = serviceInstance.getOrchestrationStatus();
- break;
- case VNF:
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatus = genericVnf.getOrchestrationStatus();
- break;
- case VF_MODULE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
- extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- orchestrationStatus = vfModule.getOrchestrationStatus();
- break;
- case VOLUME_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
- extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- orchestrationStatus = volumeGroup.getOrchestrationStatus();
- break;
- case NETWORK:
- org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network =
- extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- orchestrationStatus = network.getOrchestrationStatus();
- break;
- case NETWORK_COLLECTION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- org.onap.so.bpmn.servicedecomposition.bbobjects.Collection networkCollection =
- serviceInst.getCollection();
- orchestrationStatus = networkCollection.getOrchestrationStatus();
- break;
- case CONFIGURATION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
- extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- orchestrationStatus = configuration.getOrchestrationStatus();
- break;
- case INSTANCE_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup =
- extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- orchestrationStatus = instanceGroup.getOrchestrationStatus();
- break;
- case NO_VALIDATE:
- // short circuit and exit method
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
- OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
- return;
- default:
- // can't currently get here, so not tested. Added in case enum is expanded
- // without a change to this
- // code
- throw new OrchestrationStatusValidationException(
- String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
- buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
+ OrchestrationStatus orchestrationStatus =
+ getOrchestrationStatus(execution, buildingBlockFlowName, buildingBlockDetail);
+ if (buildingBlockDetail.getResourceType().equals(ResourceType.NO_VALIDATE)) {
+ return;
}
if (orchestrationStatus == null) {
@@ -199,6 +142,66 @@ public class OrchestrationStatusValidator {
}
}
+ private OrchestrationStatus getOrchestrationStatus(BuildingBlockExecution execution, String buildingBlockFlowName,
+ BuildingBlockDetail buildingBlockDetail)
+ throws BBObjectNotFoundException, OrchestrationStatusValidationException {
+ OrchestrationStatus orchestrationStatus = null;
+
+ switch (buildingBlockDetail.getResourceType()) {
+ case SERVICE:
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ orchestrationStatus = serviceInstance.getOrchestrationStatus();
+ break;
+ case VNF:
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ orchestrationStatus = genericVnf.getOrchestrationStatus();
+ break;
+ case VF_MODULE:
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ orchestrationStatus = vfModule.getOrchestrationStatus();
+ break;
+ case VOLUME_GROUP:
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ orchestrationStatus = volumeGroup.getOrchestrationStatus();
+ break;
+ case NETWORK:
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ orchestrationStatus = network.getOrchestrationStatus();
+ break;
+ case NETWORK_COLLECTION:
+ Collection networkCollection = getNetworkCollection(execution);
+ orchestrationStatus = networkCollection.getOrchestrationStatus();
+ break;
+ case CONFIGURATION:
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ orchestrationStatus = configuration.getOrchestrationStatus();
+ break;
+ case INSTANCE_GROUP:
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ orchestrationStatus = instanceGroup.getOrchestrationStatus();
+ break;
+ case NO_VALIDATE:
+ // short circuit and exit method
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
+ OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
+ break;
+ default:
+ // can't currently get here, so not tested. Added in case enum is expanded
+ // without a change to this
+ // code
+ throw new OrchestrationStatusValidationException(
+ String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
+ buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
+ }
+ return orchestrationStatus;
+ }
+
+ private Collection getNetworkCollection(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ return serviceInst.getCollection();
+ }
+
private void updatedResourceStatus(BuildingBlockExecution execution, BuildingBlockDetail buildingBlockDetail) {
if (cloudResources.contains(buildingBlockDetail.getResourceType())) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index b64f62a8a3..09c7a661e0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -176,32 +176,25 @@ public class WorkflowAction {
final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest =
new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
-
- final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
-
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
String uri = (String) execution.getVariable(BBConstants.G_URI);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
boolean isResume = isUriResume(uri);
-
- final boolean isALaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
- Resource resource = getResource(bbInputSetupUtils, isResume, isALaCarte, uri, requestId);
-
- WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- RequestDetails requestDetails = sIRequest.getRequestDetails();
String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+ WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
+ Resource resource = getResource(bbInputSetupUtils, isResume, aLaCarte, uri, requestId);
String resourceId = getResourceId(resource, requestAction, requestDetails, workflowResourceIds);
WorkflowType resourceType = resource.getResourceType();
-
String serviceInstanceId = getServiceInstanceId(execution, resourceId, resourceType);
-
fillExecution(execution, requestDetails.getRequestInfo().getSuppressRollback(), resourceId, resourceType);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
-
- if (isRequestMacroServiceResume(isALaCarte, resourceType, requestAction, serviceInstanceId)) {
+ if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {
buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path.");
}
- } else if (isALaCarte && isResume) {
+ } else if (aLaCarte && isResume) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
if (flowsToExecute == null) {
buildAndThrowException(execution,
@@ -215,30 +208,20 @@ public class WorkflowAction {
final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
final String serviceType =
Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
- if (isALaCarte) {
+ if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true,
cloudOwner, serviceType);
}
Resource resourceKey = getResourceKey(sIRequest, resourceType);
- if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- ConfigBuildingBlocksDataObject configBuildingBlocksDataObject =
- new ConfigBuildingBlocksDataObject();
- configBuildingBlocksDataObject.setsIRequest(sIRequest);
- configBuildingBlocksDataObject.setOrchFlows(orchFlows);
- configBuildingBlocksDataObject.setRequestId(requestId);
- configBuildingBlocksDataObject.setResourceKey(resourceKey);
- configBuildingBlocksDataObject.setApiVersion(apiVersion);
- configBuildingBlocksDataObject.setResourceId(resourceId);
- configBuildingBlocksDataObject.setRequestAction(requestAction);
- configBuildingBlocksDataObject.setaLaCarte(true);
- configBuildingBlocksDataObject.setVnfType(vnfType);
- configBuildingBlocksDataObject.setWorkflowResourceIds(workflowResourceIds);
- configBuildingBlocksDataObject.setRequestDetails(requestDetails);
- configBuildingBlocksDataObject.setExecution(execution);
-
- List<ExecuteBuildingBlock> configBuildingBlocks =
- getConfigBuildingBlocks(configBuildingBlocksDataObject);
+ boolean isConfiguration = isConfiguration(orchFlows);
+ if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
+ new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
+ .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
+ .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
+ .setRequestDetails(requestDetails).setExecution(execution));
flowsToExecute.addAll(configBuildingBlocks);
}
@@ -249,23 +232,12 @@ public class WorkflowAction {
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS))
&& resourceType.equals(WorkflowType.VFMODULE)) {
logger.debug("Build a BB list for replacing BB modules");
-
- ConfigBuildingBlocksDataObject configBuildingBlocksDataObject =
- new ConfigBuildingBlocksDataObject();
- configBuildingBlocksDataObject.setsIRequest(sIRequest);
- configBuildingBlocksDataObject.setOrchFlows(orchFlows);
- configBuildingBlocksDataObject.setRequestId(requestId);
- configBuildingBlocksDataObject.setResourceKey(resourceKey);
- configBuildingBlocksDataObject.setApiVersion(apiVersion);
- configBuildingBlocksDataObject.setResourceId(resourceId);
- configBuildingBlocksDataObject.setRequestAction(requestAction);
- configBuildingBlocksDataObject.setaLaCarte(true);
- configBuildingBlocksDataObject.setVnfType(vnfType);
- configBuildingBlocksDataObject.setWorkflowResourceIds(workflowResourceIds);
- configBuildingBlocksDataObject.setRequestDetails(requestDetails);
- configBuildingBlocksDataObject.setExecution(execution);
-
- orchFlows = getVfModuleReplaceBuildingBlocks(configBuildingBlocksDataObject);
+ orchFlows = getVfModuleReplaceBuildingBlocks(
+ new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
+ .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
+ .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
+ .setRequestDetails(requestDetails).setExecution(execution));
}
for (OrchestrationFlow orchFlow : orchFlows) {
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
@@ -347,7 +319,7 @@ public class WorkflowAction {
logger.info("Found {}", foundObjects);
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, isALaCarte,
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
cloudOwner, serviceType);
}
boolean vnfReplace = false;
@@ -1478,16 +1450,10 @@ public class WorkflowAction {
resourceId = workflowResourceIds.getVolumeGroupId();
}
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- executeBuildingBlock.setApiVersion(apiVersion);
- executeBuildingBlock.setaLaCarte(aLaCarte);
- executeBuildingBlock.setRequestAction(requestAction);
- executeBuildingBlock.setResourceId(resourceId);
- executeBuildingBlock.setVnfType(vnfType);
- executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
- executeBuildingBlock.setRequestId(requestId);
- executeBuildingBlock.setBuildingBlock(buildingBlock);
- executeBuildingBlock.setRequestDetails(requestDetails);
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion)
+ .setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock)
+ .setRequestDetails(requestDetails);
if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) {
ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 31df5bbdc3..9d68b5a3f0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -493,16 +493,11 @@ public class WorkflowActionBBTasks {
WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
workflowResourceIds.setConfigurationId(configurationId);
- ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
- configBB.setaLaCarte(ebb.isaLaCarte());
- configBB.setApiVersion(ebb.getApiVersion());
- configBB.setRequestAction(ebb.getRequestAction());
- configBB.setVnfType(ebb.getVnfType());
- configBB.setRequestId(ebb.getRequestId());
- configBB.setRequestDetails(ebb.getRequestDetails());
- configBB.setBuildingBlock(buildingBlock);
- configBB.setWorkflowResourceIds(workflowResourceIds);
- configBB.setConfigurationResourceKeys(configurationResourceKeys);
+ ExecuteBuildingBlock configBB = new ExecuteBuildingBlock().setaLaCarte(ebb.isaLaCarte())
+ .setApiVersion(ebb.getApiVersion()).setRequestAction(ebb.getRequestAction())
+ .setVnfType(ebb.getVnfType()).setRequestId(ebb.getRequestId())
+ .setRequestDetails(ebb.getRequestDetails()).setBuildingBlock(buildingBlock)
+ .setWorkflowResourceIds(workflowResourceIds).setConfigurationResourceKeys(configurationResourceKeys);
return configBB;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index b9feeedc14..98f84414db 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,31 +22,20 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.when;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.exception.OrchestrationStatusValidationException;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -52,7 +43,16 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.springframework.beans.factory.annotation.Autowired;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@@ -62,6 +62,9 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
private static final String vfModuleNotExistExpectedMessage =
"The VfModule was not found, thus no VfModule was deleted in the cloud via this request";
+ @Mock
+ private ExceptionBuilder exceptionBuilder;
+
@InjectMocks
protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@@ -72,11 +75,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("AssignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -88,12 +88,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.thenReturn(serviceInstance);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.CONTINUE,
+ OrchestrationStatus.PRECREATED, ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED,
@@ -107,6 +103,19 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
Mockito.verifyZeroInteractions(requestsDbClient);
}
+ private OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
+ OrchestrationStatusValidationDirective aContinue, OrchestrationStatus precreated, ResourceType service,
+ OrchestrationAction assign) {
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(aContinue);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(precreated);
+ orchestrationStatusStateTransitionDirective.setResourceType(service);
+ orchestrationStatusStateTransitionDirective.setTargetAction(assign);
+ return orchestrationStatusStateTransitionDirective;
+ }
+
@Test
public void test_validateOrchestrationStatusConfiguration() throws Exception {
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
@@ -124,11 +133,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.setVariable("flowToBeCalled", flowToBeCalled);
execution.setVariable("aLaCarte", true);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("UnassignFabricConfigurationBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.CONFIGURATION);
- buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN);
+ BuildingBlockDetail buildingBlockDetail = getBuildingBlockDetail("UnassignFabricConfigurationBB",
+ ResourceType.CONFIGURATION, OrchestrationAction.UNASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -140,13 +146,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.thenReturn(configuration);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.CONFIGURATION);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.UNASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PRECREATED, ResourceType.CONFIGURATION, OrchestrationAction.UNASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.CONFIGURATION,
@@ -160,44 +161,30 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
Mockito.verifyZeroInteractions(requestsDbClient);
}
- @Ignore
@Test
- public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
- expectedException.expect(BpmnError.class);
-
+ public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() {
String flowToBeCalled = "AssignServiceInstanceBB";
-
execution.setVariable("flowToBeCalled", flowToBeCalled);
-
doReturn(null).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ verify(exceptionBuilder).buildAndThrowWorkflowException(eq(execution), eq(7000),
+ any(OrchestrationStatusValidationException.class));
}
- @Ignore
@Test
- public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
- expectedException.expect(BpmnError.class);
-
+ public void test_validateOrchestrationStatus_orchestrationValidationFail() {
String flowToBeCalled = "AssignServiceInstanceBB";
-
execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("AssignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.FAIL,
+ OrchestrationStatus.PRECREATED, ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED,
@@ -206,32 +193,23 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
Mockito.verifyZeroInteractions(requestsDbClient);
+ verify(exceptionBuilder).buildAndThrowWorkflowException(eq(execution), eq(7000),
+ any(NullPointerException.class));
}
- @Ignore
@Test
- public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
- expectedException.expect(BpmnError.class);
-
+ public void test_validateOrchestrationStatus_orchestrationValidationNotFound() {
String flowToBeCalled = "AssignServiceInstanceBB";
-
execution.setVariable("flowToBeCalled", flowToBeCalled);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("AssignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.FAIL,
+ OrchestrationStatus.PRECREATED, ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.NETWORK, OrchestrationStatus.PRECREATED,
@@ -240,24 +218,33 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
Mockito.verifyZeroInteractions(requestsDbClient);
+ verify(exceptionBuilder).buildAndThrowWorkflowException(eq(execution), eq(7000),
+ any(NullPointerException.class));
+ }
+
+ private BuildingBlockDetail getBuildingBlockDetail(String assignServiceInstanceBB, ResourceType service,
+ OrchestrationAction assign) {
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName(assignServiceInstanceBB);
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(service);
+ buildingBlockDetail.setTargetAction(assign);
+ return buildingBlockDetail;
}
@Test
- public void test_validateOrchestrationStatus_unassignNotFound() throws Exception {
+ public void test_validateOrchestrationStatus_unassignNotFound() {
String flowToBeCalled = "UnassignServiceInstanceBB";
execution.setVariable("flowToBeCalled", flowToBeCalled);
execution.setVariable("aLaCarte", true);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("UnassignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("UnassignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.UNASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
- lookupKeyMap = new HashMap<ResourceKey, String>();
+ lookupKeyMap = new HashMap<>();
orchestrationStatusValidator.validateOrchestrationStatus(execution);
@@ -285,21 +272,14 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.CONTINUE,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -334,22 +314,14 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -387,11 +359,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -402,13 +371,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -446,11 +410,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -461,13 +422,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ASSIGNED,
@@ -505,11 +461,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ACTIVATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.ACTIVATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -520,13 +473,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.ACTIVATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -564,11 +512,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -579,13 +524,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.ACTIVATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -611,11 +551,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@Test
public void continueValidationActivatedTest() throws Exception {
String flowToBeCalled = "DeactivateVnfBB";
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName(flowToBeCalled);
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.DEACTIVATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail(flowToBeCalled, ResourceType.VF_MODULE, OrchestrationAction.DEACTIVATE);
when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
@@ -625,12 +562,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.DEACTIVATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.CONTINUE,
+ OrchestrationStatus.ACTIVATED, ResourceType.VF_MODULE, OrchestrationAction.DEACTIVATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED,
OrchestrationAction.DEACTIVATE);
@@ -666,22 +599,14 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("DeleteVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("DeleteVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index 23ffbac645..7f44c97f59 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -144,8 +144,7 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
@Test
public void updateRequestStatusToFailedRollbackFabric() {
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("UnassignFabricConfigurationBB");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(bb);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
execution.setVariable("buildingBlock", ebb);
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", false);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index 9b41d0fada..a736d85197 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -115,9 +115,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
ModelInfo mi = new ModelInfo();
mi.setModelUuid(modelUuid);
rd.setModelInfo(mi);
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(buildingBlock);
- ebb.setRequestDetails(rd);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd);
flowsToExecute.add(ebb);
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
@@ -152,9 +150,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
ModelInfo mi = new ModelInfo();
mi.setModelUuid(modelUuid);
rd.setModelInfo(mi);
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(buildingBlock);
- ebb.setRequestDetails(rd);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd);
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
flowsToExecute.add(ebb);
@@ -204,18 +200,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -238,18 +231,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -272,23 +262,19 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateNetworkCollectionBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -312,18 +298,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -344,29 +327,24 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", "VfModule");
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("ChangeModelVnfBB");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ChangeModelServiceInstanceBB");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(buildingBlock5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
flowsToExecute.add(ebb5);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -389,23 +367,19 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -429,18 +403,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -461,53 +432,43 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("VNFCheckInMaintFlagActivity");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("VNFSetInMaintFlagActivity");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("VNFCheckClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("VNFSetClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(buildingBlock5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
flowsToExecute.add(ebb5);
BuildingBlock buildingBlock6 = new BuildingBlock().setBpmnFlowName("VNFLockActivity");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(buildingBlock6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock6);
flowsToExecute.add(ebb6);
BuildingBlock buildingBlock7 = new BuildingBlock().setBpmnFlowName("VNFUpgradePreCheckActivity");
- ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock();
- ebb7.setBuildingBlock(buildingBlock7);
+ ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock7);
flowsToExecute.add(ebb7);
BuildingBlock buildingBlock8 = new BuildingBlock().setBpmnFlowName("VNFQuiesceTrafficActivity");
- ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock();
- ebb8.setBuildingBlock(buildingBlock8);
+ ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock8);
flowsToExecute.add(ebb8);
BuildingBlock buildingBlock9 = new BuildingBlock().setBpmnFlowName("VNFStopActivity");
- ExecuteBuildingBlock ebb9 = new ExecuteBuildingBlock();
- ebb9.setBuildingBlock(buildingBlock9);
+ ExecuteBuildingBlock ebb9 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock9);
flowsToExecute.add(ebb9);
BuildingBlock buildingBlock10 = new BuildingBlock().setBpmnFlowName("VNFSnapShotActivity");
- ExecuteBuildingBlock ebb10 = new ExecuteBuildingBlock();
- ebb10.setBuildingBlock(buildingBlock10);
+ ExecuteBuildingBlock ebb10 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock10);
flowsToExecute.add(ebb10);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -532,33 +493,27 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("VNFCheckInMaintFlagActivity");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("VNFSetInMaintFlagActivity");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("VNFCheckClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("VNFSetClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(buildingBlock5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
flowsToExecute.add(ebb5);
BuildingBlock buildingBlock6 = new BuildingBlock().setBpmnFlowName("VNFHealthCheckActivity");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(buildingBlock6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock6);
flowsToExecute.add(ebb6);
execution.setVariable("flowsToExecute", flowsToExecute);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
index e064fb0b64..73aace7592 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
@@ -68,12 +68,10 @@ public class WorkflowActionBBTasksUpdateReqDbTest extends BaseTaskTest {
public void getUpdatedRequestTest() throws Exception {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
BuildingBlock bb1 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(bb1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(bb1);
flowsToExecute.add(ebb1);
BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(bb2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2);
flowsToExecute.add(ebb2);
String requestId = "requestId";
execution.setVariable("mso-request-id", requestId);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index c762c16d92..e24eaf0581 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -1647,19 +1647,10 @@ public class WorkflowActionTest extends BaseTaskTest {
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
"UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
- ConfigBuildingBlocksDataObject dataObj = new ConfigBuildingBlocksDataObject();
- dataObj.setsIRequest(sIRequest);
- dataObj.setOrchFlows(orchFlows);
- dataObj.setRequestId(requestId);
- dataObj.setResourceKey(resourceKey);
- dataObj.setApiVersion(apiVersion);
- dataObj.setResourceId(resourceId);
- dataObj.setRequestAction(requestAction);
- dataObj.setaLaCarte(aLaCarte);
- dataObj.setVnfType(vnfType);
- dataObj.setWorkflowResourceIds(workflowResourceIds);
- dataObj.setRequestDetails(requestDetails);
- dataObj.setExecution(execution);
+ ConfigBuildingBlocksDataObject dataObj = new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest)
+ .setOrchFlows(orchFlows).setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestDetails(requestDetails).setExecution(execution);
org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
vnf.setVnfId("vnf0");
@@ -1816,33 +1807,27 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> executeFlows = new ArrayList<>();
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(bb);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
executeFlows.add(ebb);
BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(bb2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2);
executeFlows.add(ebb2);
BuildingBlock bb3 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(bb3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(bb3);
executeFlows.add(ebb3);
BuildingBlock bb4 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(bb4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(bb4);
executeFlows.add(ebb4);
BuildingBlock bb5 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(bb5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(bb5);
executeFlows.add(ebb5);
BuildingBlock bb6 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(bb6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(bb6);
executeFlows.add(ebb6);
List<ExecuteBuildingBlock> sorted =
@@ -1856,33 +1841,27 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> executeFlows = new ArrayList<>();
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("DeactivateNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(bb);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
executeFlows.add(ebb);
BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("DeactivateNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(bb2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2);
executeFlows.add(ebb2);
BuildingBlock bb3 = new BuildingBlock().setBpmnFlowName("DeleteNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(bb3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(bb3);
executeFlows.add(ebb3);
BuildingBlock bb4 = new BuildingBlock().setBpmnFlowName("DeleteNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(bb4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(bb4);
executeFlows.add(ebb4);
BuildingBlock bb5 = new BuildingBlock().setBpmnFlowName("UnassignNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(bb5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(bb5);
executeFlows.add(ebb5);
BuildingBlock bb6 = new BuildingBlock().setBpmnFlowName("UnassignNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(bb6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(bb6);
executeFlows.add(ebb6);
List<ExecuteBuildingBlock> sorted =
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
index 1b4ddf71c2..9d208f41e8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
@@ -91,10 +91,8 @@ public class MultiStageSkipListenerTest {
workflowResourceIds.setServiceInstanceId("serviceInstanceId");
workflowResourceIds.setVnfId(vnfId);
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setResourceId(vfModuleId);
- ebb.setBuildingBlock(bb);
- ebb.setWorkflowResourceIds(workflowResourceIds);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setResourceId(vfModuleId).setBuildingBlock(bb)
+ .setWorkflowResourceIds(workflowResourceIds);
flowsToExecute.add(ebb);
flowsToExecute.add(new ExecuteBuildingBlock());
flowsToExecute.add(new ExecuteBuildingBlock());