use of org.onap.so.bpmn.common.BuildingBlockExecution 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.BuildingBlockExecution 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());
}
use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.
the class UpgradePreWorkflowValidatorTest method validateModelInvariantMismatch.
@Test
public void validateModelInvariantMismatch() throws JsonProcessingException {
ServiceInstancesRequest sir = new ServiceInstancesRequest();
sir.setRequestDetails(new RequestDetails());
sir.getRequestDetails().setModelInfo(new ModelInfo());
sir.getRequestDetails().getModelInfo().setModelInvariantId(UUID.randomUUID().toString());
Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
String aaiModelInvariantId = UUID.randomUUID().toString();
serviceResource.setModelInvariantId(aaiModelInvariantId);
BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource));
Optional<String> message = validator.validate(execution);
assertTrue(message.isPresent());
assertTrue(message.get().startsWith("Request service modelInvariantId"));
}
use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.
the class UpgradePreWorkflowValidatorTest method validateNoVnfsInAAI.
@Test
public void validateNoVnfsInAAI() throws JsonProcessingException {
ServiceInstancesRequest sir = new ServiceInstancesRequest();
sir.setRequestDetails(new RequestDetails());
sir.getRequestDetails().setModelInfo(new ModelInfo());
String modelInvariantId = UUID.randomUUID().toString();
sir.getRequestDetails().getModelInfo().setModelInvariantId(modelInvariantId);
Resource serviceResource = new Resource(WorkflowType.SERVICE, "", false, null);
serviceResource.setModelInvariantId(modelInvariantId);
BuildingBlockExecution execution = createExecution(sir, Arrays.asList(serviceResource));
Optional<String> message = validator.validate(execution);
assertThat(message).isEmpty();
}
use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.
the class HomingV2Test method whenHomingSolutionSetToOofShouldCallOof.
@Test
public void whenHomingSolutionSetToOofShouldCallOof() {
HashMap<String, Object> userParams = new HashMap<>();
userParams.put(HOMING_SOLUTION, HOMING_OOF);
BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
OofHomingV2 oofHoming = mock(OofHomingV2.class);
SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
homingV2.callHoming(givenExecution);
then(oofHoming).should().callOof(givenExecution);
then(sniroHoming).shouldHaveZeroInteractions();
}
Aggregations