use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.
the class WorkflowActionBBTasksTest method selectBBTest.
@Test
public void selectBBTest() {
String vnfCustomizationUUID = "1234567";
String modelUuid = "1234567";
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);
ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd);
flowsToExecute.add(ebb);
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);
execution.setVariable("flowsToExecute", flowsToExecute);
workflowActionBBTasks.selectBB(execution);
boolean success = (boolean) execution.getVariable("completed");
int currentSequence = (int) execution.getVariable("gCurrentSequence");
assertFalse(success);
assertEquals(1, currentSequence);
}
use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.
the class SkipCDSBuildingBlockListenerTest method before.
@Before
public void before() {
executeBuildingBlock = new ExecuteBuildingBlock();
buildingBlock = new BuildingBlock();
ArrayList<Resource> resources = new ArrayList<>();
Resource service = new Resource(WorkflowType.SERVICE, SERVICE_MODEL_VERSION_ID, false, null);
service.setModelVersionId(SERVICE_MODEL_VERSION_ID);
resources.add(service);
Resource vnf = new Resource(WorkflowType.VNF, VNF_MODEL_CUSTOMIZATION_ID, false, null);
vnf.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_ID);
resources.add(vnf);
Resource vfModule = new Resource(WorkflowType.VFMODULE, VF_MODULE_CUSTOMIZATION_ID, false, null);
vfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_ID);
resources.add(vfModule);
Resource pnf = new Resource(WorkflowType.PNF, PNF_CUSTOMIZATION_ID, false, null);
pnf.setModelCustomizationId(PNF_CUSTOMIZATION_ID);
resources.add(pnf);
buildingBlockExecution.setVariable("resources", resources);
vnfCust = new VnfResourceCustomization();
vfCust = new VfModuleCustomization();
pnfResourceCustomization = new PnfResourceCustomization();
}
use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.
the class ExecuteBuildingBlockBuilderTest method verifyLackOfNullPointerExceptionForNullResource.
@Test
public void verifyLackOfNullPointerExceptionForNullResource() {
ExecuteBuildingBlock result = null;
try {
result = executeBBBuilder.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null, false, null, null, null, false, null, null, true, null);
} catch (NullPointerException e) {
fail("NullPointerException should not be thrown when 'resource' is null");
}
assertNotNull(result);
}
use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.
the class WorkflowActionBBTasksTest method rollbackExecutionPathUnfinishedFlowTest.
@Test
public void rollbackExecutionPathUnfinishedFlowTest() {
execution.setVariable("handlingCode", "Rollback");
execution.setVariable("isRollback", false);
execution.setVariable("requestAction", EMPTY_STRING);
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
execution.setVariable("gCurrentSequence", 2);
doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
workflowActionBBTasks.rollbackExecutionPath(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "DeleteVfModuleBB");
assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "UnassignVfModuleBB");
assertEquals(0, execution.getVariable("gCurrentSequence"));
assertEquals(0, execution.getVariable("retryCount"));
}
use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.
the class WorkflowActionBBTasksTest method rollbackExecutionRollbackToCreatedTest.
@Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
execution.setVariable("requestAction", EMPTY_STRING);
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
execution.setVariable("gCurrentSequence", 3);
workflowActionBBTasks.rollbackExecutionPath(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEquals("DeactivateVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
assertEquals(0, execution.getVariable("gCurrentSequence"));
assertEquals(1, ebbs.size());
}
Aggregations