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/src/test/java/org | |
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/src/test/java/org')
3 files changed, 44 insertions, 22 deletions
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, "")); |