diff options
author | Mateusz Gołuchowski <mateusz.goluchowski@nokia.com> | 2020-06-16 14:02:28 +0200 |
---|---|---|
committer | Mateusz Gołuchowski <mateusz.goluchowski@nokia.com> | 2020-06-22 12:56:41 +0200 |
commit | c4c9f922fa9ae3549f307677d307948bda22602f (patch) | |
tree | d8d1bed8be00bc7b2ca33a0420da41b6dc408504 /bpmn/MSOCommonBPMN | |
parent | 07f92dace9984821f162aacd3f92770c41ad1187 (diff) |
[WIP] WorkflowAction refactoring
Extracted superclass for ExecuteBuildingBlock and ConfigBuildingBlocksDataObject
Changed setters to return void instead of 'this'.
Adjusted all code which was using setters chaining
Issue-ID: SO-2634
Change-Id: I375db2004687f1f634adac31d4d1af3635f5981c
Signed-off-by: Mateusz Goluchowski <mateusz.goluchowski@nokia.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN')
5 files changed, 140 insertions, 112 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 new file mode 100644 index 0000000000..9e320700bd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java @@ -0,0 +1,89 @@ +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 abd301fa4d..9274e0659e 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,119 +21,36 @@ package org.onap.so.bpmn.servicedecomposition.entities; import java.io.Serializable; -import org.onap.so.serviceinstancebeans.RequestDetails; -public class ExecuteBuildingBlock implements Serializable { +public class ExecuteBuildingBlock extends BuildingBlockBase implements Serializable { - private static final long serialVersionUID = 2L; private BuildingBlock buildingBlock; - private String requestId; - private String apiVersion; - private String resourceId; - private String requestAction; - private String vnfType; - private Boolean aLaCarte; - private Boolean homing = false; - private WorkflowResourceIds workflowResourceIds; - private RequestDetails requestDetails; private ConfigurationResourceKeys configurationResourceKeys; + private Boolean homing = false; + private static final long serialVersionUID = 3L; public BuildingBlock getBuildingBlock() { return buildingBlock; } - public ExecuteBuildingBlock setBuildingBlock(BuildingBlock buildingBlock) { + public void 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 ExecuteBuildingBlock setHoming(Boolean homing) { + public void 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 ExecuteBuildingBlock setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { + public void 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 d7cfaf94f7..a74d78e04b 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,7 +115,8 @@ 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).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -181,7 +182,8 @@ public class BBInputSetupPopulateMethodsTest { ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.VF_MODULE.toString()).setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); @@ -243,7 +245,8 @@ public class BBInputSetupPopulateMethodsTest { ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.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 458919c48e..ffdc275dee 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,8 +308,9 @@ public class BBInputSetupTest { @Test public void testGetExecuteBBFromExecution() throws IOException { BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB"); - ExecuteBuildingBlock expected = - new ExecuteBuildingBlock().setBuildingBlock(bb).setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017"); + ExecuteBuildingBlock expected = new ExecuteBuildingBlock(); + expected.setBuildingBlock(bb); + expected.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); @@ -321,7 +322,8 @@ public class BBInputSetupTest { GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), GeneralBuildingBlock.class); - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId"); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setRequestId("requestId"); RequestDetails requestDetails = new RequestDetails(); ModelInfo modelInfo = new ModelInfo(); modelInfo.setModelType(ModelType.service); @@ -349,7 +351,8 @@ public class BBInputSetupTest { GeneralBuildingBlock expected = mapper .readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"), GeneralBuildingBlock.class); - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId"); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setRequestId("requestId"); RequestDetails requestDetails = new RequestDetails(); requestDetails.setModelInfo(null); RequestParameters requestParams = new RequestParameters(); @@ -1003,7 +1006,9 @@ public class BBInputSetupTest { Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString()); - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setaLaCarte(true).setBuildingBlock(buildingBlock); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.setaLaCarte(true); + executeBB.setBuildingBlock(buildingBlock); RequestDetails requestDetails = new RequestDetails(); RequestInfo reqInfo = new RequestInfo(); reqInfo.setInstanceName("serviceInstanceName"); @@ -2050,7 +2055,8 @@ public class BBInputSetupTest { Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap(); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("AssignVrfConfigurationBB"); buildingBlock.setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); @@ -2230,7 +2236,8 @@ 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).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -2299,7 +2306,8 @@ public class BBInputSetupTest { requestDetails.getRequestParameters().setUserParams(null); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(false); @@ -2344,7 +2352,8 @@ public class BBInputSetupTest { requestDetails.getRequestParameters().setUserParams(null); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()) .setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(true); @@ -2390,7 +2399,8 @@ public class BBInputSetupTest { requestDetails.getRequestParameters().setUserParams(null); ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName(otherFlowName).setKey("ab153b6e-c364-44c0-bef6-1f2982117f04") .setIsVirtualLink(true); @@ -2462,7 +2472,8 @@ public class BBInputSetupTest { aaiNetwork.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("DeleteNetworkBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -2513,7 +2524,8 @@ public class BBInputSetupTest { aaiVnf.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); buildingBlock.setBpmnScope("VNF"); @@ -2565,7 +2577,8 @@ public class BBInputSetupTest { aaiVnf.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ActivateVnfBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -2621,7 +2634,8 @@ public class BBInputSetupTest { aaiVfModule.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); buildingBlock.setBpmnScope("VfModule"); @@ -2681,7 +2695,8 @@ public class BBInputSetupTest { aaiVfModule.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("UnassignVfModuleBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); @@ -2742,7 +2757,8 @@ public class BBInputSetupTest { aaiVolumeGroup.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("UnassignVolumeGroupBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); @@ -2808,7 +2824,8 @@ public class BBInputSetupTest { aaiConfiguration.setModelCustomizationId("modelCustId"); ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); - executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + executeBB.setConfigurationResourceKeys(configResourceKeys); + executeBB.setRequestDetails(requestDetails); BuildingBlock buildingBlock = executeBB.getBuildingBlock(); buildingBlock.setBpmnFlowName("ActivateFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); @@ -2876,7 +2893,8 @@ public class BBInputSetupTest { @Test public void testGetVnfId() { String expected = "vnfId"; - ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId"); + ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock(); + executeBB.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 ee47b514d1..bac29150c1 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,7 +58,8 @@ public class ExecuteBuildingBlockRainyDayTest extends BaseTest { vnf = setGenericVnf(); BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB"); - ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock); + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); + executeBuildingBlock.setBuildingBlock(buildingBlock); delegateExecution.setVariable("gBBInput", gBBInput); delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, "")); |