diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
5 files changed, 165 insertions, 225 deletions
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 573601b20f..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 @@ -143,10 +143,8 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest { @Test public void updateRequestStatusToFailedRollbackFabric() { - ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); - BuildingBlock bb = new BuildingBlock(); - bb.setBpmnFlowName("UnassignFabricConfigurationBB"); - ebb.setBuildingBlock(bb); + BuildingBlock bb = new BuildingBlock().setBpmnFlowName("UnassignFabricConfigurationBB"); + 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 4991fa59ee..ff1246bc46 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 @@ -4,12 +4,14 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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,19 +22,6 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.mockito.ArgumentMatchers.anyObject; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; @@ -58,15 +47,26 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; -import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.RequestDetails; -import org.onap.so.serviceinstancebeans.RequestInfo; import org.springframework.core.env.Environment; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; public class WorkflowActionBBTasksTest extends BaseTaskTest { + private static final String SAMPLE_MSO_REQUEST_ID = "00f704ca-c5e5-4f95-a72c-6889db7b0688"; + private static final String SAMPLE_REQUEST_ACTION = "Delete-Network-Collection"; + private static final int SAMPLE_SEQUENCE = 0; @Mock protected WorkflowAction workflowAction; @@ -94,7 +94,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { @Before public void before() throws Exception { execution = new DelegateExecutionFake(); - org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance(); + ServiceInstance servInstance = new ServiceInstance(); servInstance.setServiceInstanceId("TEST"); when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance); workflowAction.setBbInputSetupUtils(bbSetupUtils); @@ -102,30 +102,22 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test - public void selectBBTest() throws Exception { - String gAction = "Delete-Network-Collection"; - execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); - execution.setVariable("requestAction", gAction); - execution.setVariable("gCurrentSequence", 0); - execution.setVariable("homing", false); - execution.setVariable("calledHoming", false); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); - + public void selectBBTest() { String vnfCustomizationUUID = "1234567"; String modelUuid = "1234567"; - BuildingBlock buildingBlock = new BuildingBlock(); - buildingBlock.setBpmnFlowName("ConfigAssignVnfBB"); - buildingBlock.setKey(vnfCustomizationUUID); - ebb.setBuildingBlock(buildingBlock); + prepareDelegateExecution(); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + + BuildingBlock buildingBlock = + new BuildingBlock().setBpmnFlowName("ConfigAssignVnfBB").setKey(vnfCustomizationUUID); RequestDetails rd = new RequestDetails(); ModelInfo mi = new ModelInfo(); mi.setModelUuid(modelUuid); rd.setModelInfo(mi); - ebb.setRequestDetails(rd); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd); flowsToExecute.add(ebb); - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); VnfResourceCustomization vrc = new VnfResourceCustomization(); vrc.setSkipPostInstConf(false); vrc.setModelCustomizationUUID(vnfCustomizationUUID); @@ -140,42 +132,37 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { workflowActionBBTasks.selectBB(execution); boolean success = (boolean) execution.getVariable("completed"); int currentSequence = (int) execution.getVariable("gCurrentSequence"); - assertEquals(true, success); + assertTrue(success); assertEquals(1, currentSequence); } @Test - public void select2BBTest() throws Exception { - String gAction = "Delete-Network-Collection"; - execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); - execution.setVariable("requestAction", gAction); - execution.setVariable("gCurrentSequence", 0); - execution.setVariable("homing", false); - execution.setVariable("calledHoming", false); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - + public void select2BBTest() { String vnfCustomizationUUID = "1234567"; String modelUuid = "1234567"; - BuildingBlock buildingBlock = new BuildingBlock(); - buildingBlock.setBpmnFlowName("ConfigDeployVnfBB"); - buildingBlock.setKey(vnfCustomizationUUID); - ebb.setBuildingBlock(buildingBlock); + + prepareDelegateExecution(); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + BuildingBlock buildingBlock = + new BuildingBlock().setBpmnFlowName("ConfigDeployVnfBB").setKey(vnfCustomizationUUID); RequestDetails rd = new RequestDetails(); ModelInfo mi = new ModelInfo(); mi.setModelUuid(modelUuid); rd.setModelInfo(mi); - ebb.setRequestDetails(rd); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + flowsToExecute.add(ebb); - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); VnfResourceCustomization vrc = new VnfResourceCustomization(); + vrc.setSkipPostInstConf(false); vrc.setModelCustomizationUUID(vnfCustomizationUUID); vnfResourceCustomizations.add(vrc); GenericVnf genericVnf = new GenericVnf(); genericVnf.setModelCustomizationId(vnfCustomizationUUID); + doReturn(vnfResourceCustomizations).when(catalogDbClient).getVnfResourceCustomizationByModelUuid(modelUuid); doReturn(vrc).when(catalogDbClient).findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations); @@ -190,7 +177,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test - public void updateRequestStatusToCompleteTest() throws Exception { + public void updateRequestStatusToCompleteTest() { String reqId = "reqId123"; execution.setVariable("mso-request-id", reqId); execution.setVariable("requestAction", "createInstance"); @@ -208,21 +195,17 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionPathTest() { execution.setVariable("handlingCode", "Rollback"); execution.setVariable("isRollback", false); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); - BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("AssignVfModuleBB"); - ebb1.setBuildingBlock(bb1); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); flowsToExecute.add(ebb1); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("CreateVfModuleBB"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); flowsToExecute.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("ActivateVfModuleBB"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); flowsToExecute.add(ebb3); execution.setVariable("flowsToExecute", flowsToExecute); @@ -241,21 +224,17 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionPathUnfinishedFlowTest() { execution.setVariable("handlingCode", "Rollback"); execution.setVariable("isRollback", false); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); - BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("AssignVfModuleBB"); - ebb1.setBuildingBlock(bb1); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); flowsToExecute.add(ebb1); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("CreateVfModuleBB"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); flowsToExecute.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("ActivateVfModuleBB"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); flowsToExecute.add(ebb3); execution.setVariable("flowsToExecute", flowsToExecute); @@ -274,26 +253,21 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionTest() { execution.setVariable("handlingCode", "Rollback"); execution.setVariable("isRollback", false); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); - BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("AssignServiceInstanceBB"); - ebb1.setBuildingBlock(bb1); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); flowsToExecute.add(ebb1); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("CreateNetworkCollectionBB"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateNetworkCollectionBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); flowsToExecute.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("AssignNetworkBB"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); flowsToExecute.add(ebb3); - ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); - BuildingBlock bb4 = new BuildingBlock(); - bb4.setBpmnFlowName("CreateNetworkBB"); - ebb4.setBuildingBlock(bb4); + + BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB"); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4); flowsToExecute.add(ebb4); execution.setVariable("flowsToExecute", flowsToExecute); @@ -312,21 +286,18 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionRollbackToAssignedTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "RollbackToAssigned"); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); - BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("AssignVfModuleBB"); - ebb1.setBuildingBlock(bb1); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); flowsToExecute.add(ebb1); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("CreateVfModuleBB"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); flowsToExecute.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("ActivateVfModuleBB"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); flowsToExecute.add(ebb3); execution.setVariable("flowsToExecute", flowsToExecute); @@ -343,31 +314,26 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionRollbackToAssignedWithFabricTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "RollbackToAssigned"); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); - BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("AssignVfModuleBB"); - ebb1.setBuildingBlock(bb1); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); flowsToExecute.add(ebb1); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("CreateVfModuleBB"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); flowsToExecute.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("ActivateVfModuleBB"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); flowsToExecute.add(ebb3); - ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); - BuildingBlock bb4 = new BuildingBlock(); - bb4.setBpmnFlowName("AssignFabricConfigurationBB"); - ebb4.setBuildingBlock(bb4); + + BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB"); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4); flowsToExecute.add(ebb4); - ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); - BuildingBlock bb5 = new BuildingBlock(); - bb5.setBpmnFlowName("ActivateFabricConfigurationBB"); - ebb5.setBuildingBlock(bb5); + + BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5); flowsToExecute.add(ebb5); execution.setVariable("flowsToExecute", flowsToExecute); @@ -388,21 +354,17 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionRollbackToCreatedTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "RollbackToCreated"); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); - BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("AssignVfModuleBB"); - ebb1.setBuildingBlock(bb1); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); flowsToExecute.add(ebb1); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("CreateVfModuleBB"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); flowsToExecute.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("ActivateVfModuleBB"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); flowsToExecute.add(ebb3); execution.setVariable("flowsToExecute", flowsToExecute); @@ -480,8 +442,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc(); vnfc.setModelInvariantId("modelInvariantId"); vnfc.setVnfcName("testVnfcName"); - List<org.onap.aai.domain.yang.Configuration> configurations = - new ArrayList<org.onap.aai.domain.yang.Configuration>(); + List<Configuration> configurations = new ArrayList<>(); org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); configuration.setConfigurationId("configurationId"); configuration.setModelCustomizationId("modelCustimizationId"); @@ -585,4 +546,12 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { assertEquals("volumeGroupName", request.getVolumeGroupName()); } + + private void prepareDelegateExecution() { + execution.setVariable("mso-request-id", SAMPLE_MSO_REQUEST_ID); + execution.setVariable("requestAction", SAMPLE_REQUEST_ACTION); + execution.setVariable("gCurrentSequence", SAMPLE_SEQUENCE); + execution.setVariable("homing", false); + execution.setVariable("calledHoming", false); + } } 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 9c3f0c6f0b..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 @@ -67,16 +67,12 @@ public class WorkflowActionBBTasksUpdateReqDbTest extends BaseTaskTest { @Test public void getUpdatedRequestTest() throws Exception { List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); - ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); - BuildingBlock bb1 = new BuildingBlock(); - bb1.setBpmnFlowName("CreateNetworkBB"); + BuildingBlock bb1 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(bb1); flowsToExecute.add(ebb1); - ebb1.setBuildingBlock(bb1); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("ActivateNetworkBB"); + BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2); flowsToExecute.add(ebb2); - ebb2.setBuildingBlock(bb2); String requestId = "requestId"; execution.setVariable("mso-request-id", requestId); execution.setVariable("flowsToExecute", flowsToExecute); 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 ed3ee0a3a1..cc4a5ce04e 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 @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * 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 @@ -109,7 +111,6 @@ import org.springframework.core.env.Environment; public class WorkflowActionTest extends BaseTaskTest { - @Mock protected Environment environment; @InjectMocks @@ -1706,41 +1707,29 @@ public class WorkflowActionTest extends BaseTaskTest { @Test public void sortExecutionPathByObjectForVlanTaggingCreateTest() throws Exception { List<ExecuteBuildingBlock> executeFlows = new ArrayList<>(); - ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); - BuildingBlock bb = new BuildingBlock(); - bb.setBpmnFlowName("AssignNetworkBB"); - bb.setKey("0"); - ebb.setBuildingBlock(bb); + + BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("0"); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb); executeFlows.add(ebb); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("AssignNetworkBB"); - bb2.setKey("1"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("1"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2); executeFlows.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("CreateNetworkBB"); - bb3.setKey("0"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock bb3 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("0"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(bb3); executeFlows.add(ebb3); - ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); - BuildingBlock bb4 = new BuildingBlock(); - bb4.setBpmnFlowName("CreateNetworkBB"); - bb4.setKey("1"); - ebb4.setBuildingBlock(bb4); + + BuildingBlock bb4 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("1"); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(bb4); executeFlows.add(ebb4); - ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); - BuildingBlock bb5 = new BuildingBlock(); - bb5.setBpmnFlowName("ActivateNetworkBB"); - bb5.setKey("0"); - ebb5.setBuildingBlock(bb5); + + BuildingBlock bb5 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("0"); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(bb5); executeFlows.add(ebb5); - ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); - BuildingBlock bb6 = new BuildingBlock(); - bb6.setBpmnFlowName("ActivateNetworkBB"); - bb6.setKey("1"); - ebb6.setBuildingBlock(bb6); + + BuildingBlock bb6 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("1"); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(bb6); executeFlows.add(ebb6); List<ExecuteBuildingBlock> sorted = @@ -1752,41 +1741,29 @@ public class WorkflowActionTest extends BaseTaskTest { @Test public void sortExecutionPathByObjectForVlanTaggingDeleteTest() throws Exception { List<ExecuteBuildingBlock> executeFlows = new ArrayList<>(); - ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); - BuildingBlock bb = new BuildingBlock(); - bb.setBpmnFlowName("DeactivateNetworkBB"); - bb.setKey("0"); - ebb.setBuildingBlock(bb); + + BuildingBlock bb = new BuildingBlock().setBpmnFlowName("DeactivateNetworkBB").setKey("0"); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb); executeFlows.add(ebb); - ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); - BuildingBlock bb2 = new BuildingBlock(); - bb2.setBpmnFlowName("DeactivateNetworkBB"); - bb2.setKey("1"); - ebb2.setBuildingBlock(bb2); + + BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("DeactivateNetworkBB").setKey("1"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2); executeFlows.add(ebb2); - ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); - BuildingBlock bb3 = new BuildingBlock(); - bb3.setBpmnFlowName("DeleteNetworkBB"); - bb3.setKey("0"); - ebb3.setBuildingBlock(bb3); + + BuildingBlock bb3 = new BuildingBlock().setBpmnFlowName("DeleteNetworkBB").setKey("0"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(bb3); executeFlows.add(ebb3); - ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); - BuildingBlock bb4 = new BuildingBlock(); - bb4.setBpmnFlowName("DeleteNetworkBB"); - bb4.setKey("1"); - ebb4.setBuildingBlock(bb4); + + BuildingBlock bb4 = new BuildingBlock().setBpmnFlowName("DeleteNetworkBB").setKey("1"); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(bb4); executeFlows.add(ebb4); - ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); - BuildingBlock bb5 = new BuildingBlock(); - bb5.setBpmnFlowName("UnassignNetworkBB"); - bb5.setKey("0"); - ebb5.setBuildingBlock(bb5); + + BuildingBlock bb5 = new BuildingBlock().setBpmnFlowName("UnassignNetworkBB").setKey("0"); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(bb5); executeFlows.add(ebb5); - ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); - BuildingBlock bb6 = new BuildingBlock(); - bb6.setBpmnFlowName("UnassignNetworkBB"); - bb6.setKey("1"); - ebb6.setBuildingBlock(bb6); + + BuildingBlock bb6 = new BuildingBlock().setBpmnFlowName("UnassignNetworkBB").setKey("1"); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(bb6); executeFlows.add(ebb6); List<ExecuteBuildingBlock> sorted = @@ -2974,7 +2951,7 @@ public class WorkflowActionTest extends BaseTaskTest { ExecuteBuildingBlock result = null; try { result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null, - false, null, null, null, false, null, true); + false, null, null, null, false, null, null, true); } catch (NullPointerException e) { fail("NullPointerException should not be thrown when 'resource' is null"); } 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 82d610fa97..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 @@ -90,13 +90,13 @@ public class MultiStageSkipListenerTest { WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); workflowResourceIds.setServiceInstanceId("serviceInstanceId"); workflowResourceIds.setVnfId(vnfId); + BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setResourceId(vfModuleId).setBuildingBlock(bb) + .setWorkflowResourceIds(workflowResourceIds); + flowsToExecute.add(ebb); flowsToExecute.add(new ExecuteBuildingBlock()); flowsToExecute.add(new ExecuteBuildingBlock()); - flowsToExecute.add(new ExecuteBuildingBlock()); - flowsToExecute.get(0).setResourceId(vfModuleId); - flowsToExecute.get(0).setBuildingBlock(new BuildingBlock()); - flowsToExecute.get(0).getBuildingBlock().setBpmnFlowName("AssignVfModuleBB"); - flowsToExecute.get(0).setWorkflowResourceIds(workflowResourceIds); + BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake()); org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule(); |