diff options
author | Mateusz Gołuchowski <mateusz.goluchowski@nokia.com> | 2020-06-25 16:03:55 +0200 |
---|---|---|
committer | Mateusz Gołuchowski <mateusz.goluchowski@nokia.com> | 2020-06-26 10:38:38 +0200 |
commit | bd8108c98564c76aff752ccd64b18927342afc8c (patch) | |
tree | 33229731ddfd859fe5afa61331e485c3d715dcaf /bpmn/MSOCommonBPMN | |
parent | 9f4721c6858cd3dc1b94b22febd2fe5e38f8de3c (diff) |
Workflow refactoring - revert changes
Reverted changes concerning:
- extracting base class for ConfigBuildingBlocksDataObject and ExecuteBuildingBlock
- removing fluent setters
The reason for revert is that new hierarchy forced ConfigBuildingBlocksDataObject to implement serializable.
Issue-ID: SO-2634
Change-Id: I375db2004687f1f634adac31d4d1af3675f5981c
Signed-off-by: Mateusz Goluchowski <mateusz.goluchowski@nokia.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN')
5 files changed, 112 insertions, 140 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/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, "")); |