use of org.onap.so.bpmn.common.DelegateExecutionImpl in project so by onap.
the class OrchestrationStatusValidatorUnitTest method skipValidationTest.
@Test
public void skipValidationTest() {
BuildingBlockDetail bbDetail = new BuildingBlockDetail();
bbDetail.setBuildingBlockName("customBB");
bbDetail.setResourceType(ResourceType.NO_VALIDATE);
bbDetail.setTargetAction(OrchestrationAction.CUSTOM);
when(catalogDbClient.getBuildingBlockDetail("customBB")).thenReturn(bbDetail);
BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
execution.setVariable("flowToBeCalled", "customBB");
execution.setVariable("aLaCarte", false);
validator.validateOrchestrationStatus(execution);
assertThat(execution.getVariable("orchestrationStatusValidationResult"), equalTo(OrchestrationStatusValidationDirective.VALIDATION_SKIPPED));
}
use of org.onap.so.bpmn.common.DelegateExecutionImpl in project so by onap.
the class MultiStageSkipListenerTest method testTrigger.
@Test
public void testTrigger() {
BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
execution.setVariable(BBConstants.G_ALACARTE, true);
assertTrue("should be triggered", multiStageSkipListener.shouldRunFor("AssignVfModuleBB", true, execution));
execution.setVariable(BBConstants.G_ALACARTE, false);
assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor("AssignVfModuleBB", true, execution));
execution.setVariable(BBConstants.G_ALACARTE, true);
assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor("AssignVfModuleBB2", true, execution));
execution.setVariable("multiStageDesign", true);
assertTrue("should be triggered", multiStageSkipListener.shouldRunFor(execution));
execution.setVariable("multiStageDesign", false);
assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution));
execution.setVariable("multiStageDesign", null);
assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution));
}
use of org.onap.so.bpmn.common.DelegateExecutionImpl in project so by onap.
the class MultiStageSkipListenerTest method testProcessMultiStageSkip.
@Test
public void testProcessMultiStageSkip() {
String vfModuleId = "vfModuleId";
String vnfId = "vnfId";
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
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());
BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
vfModule.setVfModuleId(vfModuleId);
org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
vnf.setModelCustomizationId("modelCustomizationUUID");
VnfResourceCustomization vnfCust = new VnfResourceCustomization();
vnfCust.setModelCustomizationUUID("modelCustomizationUUID");
vnfCust.setMultiStageDesign("true");
when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId())).thenReturn(vnfCust);
when(bbInputSetupUtils.getAAIVfModule(eq(vnfId), eq(vfModuleId))).thenReturn(null);
when(bbInputSetupUtils.getAAIGenericVnf(eq(vnfId))).thenReturn(vnf);
multiStageSkipListener.run(flowsToExecute, flowsToExecute.get(0), execution);
assertEquals("Flows should only have Assign", flowsToExecute.size(), 1);
assertEquals("Flows should only have Assign", flowsToExecute.get(0).getBuildingBlock().getBpmnFlowName(), "AssignVfModuleBB");
}
use of org.onap.so.bpmn.common.DelegateExecutionImpl in project so by onap.
the class MultiStageSkipListenerTest method postCompletionRequestsDbListenerTest.
@Test
public void postCompletionRequestsDbListenerTest() {
InfraActiveRequests request = new InfraActiveRequests();
BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
multiStageSkipListener.run(request, execution);
assertEquals("Successfully completed Assign Building Block only due to multi-stage-design VNF", request.getFlowStatus());
}
Aggregations