From a7017351a7c22023ed005280d6331a6afc6979c1 Mon Sep 17 00:00:00 2001 From: "Gamboa, Gilbert" Date: Tue, 24 Sep 2019 15:16:15 -0400 Subject: sdn post 1908 rollback and resume mso should Do not remove UnassignFabricConfigurationBB when rolling back to created Do not remove UnassignFabricConfigurationBB when rolling back to created. Added unit test. Enhace error message for unassign and deactivate fabric flows if they fail during rollback Looks like a bad whitespace in pom file Updated rollback failure message for fabric. Added unit test and robot tests. Issue-ID: SO-2364 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I72d570826ade865e9c12ca7571b01cccbe920865 --- .../tasks/WorkflowActionBBFailureTest.java | 27 +++++++++++++ .../workflow/tasks/WorkflowActionBBTasksTest.java | 45 ++++++++++++++++++++++ 2 files changed, 72 insertions(+) (limited to 'bpmn/so-bpmn-tasks/src/test/java') 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 2d48d02774..573601b20f 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 @@ -41,6 +41,8 @@ import org.mockito.Spy; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.constants.Status; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -139,6 +141,31 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest { assertEquals(Status.FAILED.toString(), req.getRequestStatus()); } + @Test + public void updateRequestStatusToFailedRollbackFabric() { + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock bb = new BuildingBlock(); + bb.setBpmnFlowName("UnassignFabricConfigurationBB"); + ebb.setBuildingBlock(bb); + execution.setVariable("buildingBlock", ebb); + execution.setVariable("mso-request-id", "123"); + execution.setVariable("isRollbackComplete", false); + execution.setVariable("isRollback", true); + InfraActiveRequests req = new InfraActiveRequests(); + req.setStatusMessage("PINC failure."); + WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback"); + execution.setVariable("WorkflowException", wfe); + doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123"); + doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class)); + workflowActionBBFailure.updateRequestStatusToFailed(execution); + String errorMsg = (String) execution.getVariable("RollbackErrorMessage"); + assertEquals("error in rollback", errorMsg); + assertEquals( + "PINC failure. Warning: The vf-module is active but configuration was not removed completely for one or more VMs.", + req.getStatusMessage()); + assertEquals(Status.FAILED.toString(), req.getRequestStatus()); + } + @Test public void updateRequestStatusToRolledback() { execution.setVariable("mso-request-id", "123"); 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 1df4ad797f..ac7d82cd51 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 @@ -327,6 +327,51 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { assertEquals(1, ebbs.size()); } + @Test + public void rollbackExecutionRollbackToAssignedWithFabricTest() { + execution.setVariable("isRollback", false); + execution.setVariable("handlingCode", "RollbackToAssigned"); + List flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); + BuildingBlock bb1 = new BuildingBlock(); + bb1.setBpmnFlowName("AssignVfModuleBB"); + ebb1.setBuildingBlock(bb1); + flowsToExecute.add(ebb1); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("CreateVfModuleBB"); + ebb2.setBuildingBlock(bb2); + flowsToExecute.add(ebb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("ActivateVfModuleBB"); + ebb3.setBuildingBlock(bb3); + flowsToExecute.add(ebb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("AssignFabricConfigurationBB"); + ebb4.setBuildingBlock(bb4); + flowsToExecute.add(ebb4); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); + BuildingBlock bb5 = new BuildingBlock(); + bb5.setBpmnFlowName("ActivateFabricConfigurationBB"); + ebb5.setBuildingBlock(bb5); + flowsToExecute.add(ebb5); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 5); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(0, execution.getVariable("gCurrentSequence")); + assertEquals(4, ebbs.size()); + assertEquals("DeactivateFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName()); + assertEquals("UnassignFabricConfigurationBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName()); + assertEquals("DeactivateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName()); + assertEquals("DeleteVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName()); + + } + @Test public void rollbackExecutionRollbackToCreatedTest() { execution.setVariable("isRollback", false); -- cgit 1.2.3-korg