summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java45
2 files changed, 72 insertions, 0 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 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;
@@ -140,6 +142,31 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
}
@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");
execution.setVariable("isRollbackComplete", true);
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
@@ -328,6 +328,51 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ 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);
+ 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<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) 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);
execution.setVariable("handlingCode", "RollbackToCreated");