Search in sources :

Example 36 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class FlowManipulatorListenerRunner method modifyFlows.

public void modifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) {
    int sequenceBeforeFlowManipulator;
    do {
        sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
        if (sequenceBeforeFlowManipulator >= flowsToExecute.size()) {
            break;
        }
        ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
        List<PreFlowManipulator> filtered = filterListeners(flowManipulators, (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(), execution.getCurrentSequence() == 0, execution)));
        logger.info("Running pre flow manipulators:\n{}", filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
        filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
    } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution));
}
Also used : Logger(org.slf4j.Logger) BBConstants(org.onap.so.bpmn.common.BBConstants) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) List(java.util.List) ListenerRunner(org.onap.so.listener.ListenerRunner) Component(org.springframework.stereotype.Component) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)

Example 37 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class AbstractCDSProcessingBBUtilsTest method sendRequestToCDSClientBBTest.

@Test
public void sendRequestToCDSClientBBTest() {
    BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
    when(execution.getVariable("executionServiceInput")).thenReturn(abstractCDSPropertiesBean);
    abstractCDSProcessingBBUtils.sendRequestToCDSClientBB(execution);
    verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), anyInt(), any(Exception.class));
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) Test(org.junit.Test)

Example 38 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class GenericCDSProcessingBB method prepare.

@Override
public void prepare(ControllerContext<BuildingBlockExecution> context) {
    BuildingBlockExecution buildingBlockExecution = context.getExecution();
    try {
        AbstractCDSPropertiesBean abstractCDSPropertiesBean = generatePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution);
        buildingBlockExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean);
    } catch (Exception ex) {
        logger.error("An exception occurred when creating payload for CDS request", ex);
        exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, ex);
    }
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) AbstractCDSPropertiesBean(org.onap.so.client.cds.beans.AbstractCDSPropertiesBean)

Example 39 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class GenericPnfCDSControllerRunnableBB method run.

@Override
public void run(ControllerContext<BuildingBlockExecution> controllerContext) {
    BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution();
    abstractCDSProcessingBBUtils.constructExecutionServiceInputObjectBB(buildingBlockExecution);
    abstractCDSProcessingBBUtils.sendRequestToCDSClientBB(buildingBlockExecution);
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution)

Aggregations

BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)39 Test (org.junit.Test)27 HashMap (java.util.HashMap)10 DelegateExecutionImpl (org.onap.so.bpmn.common.DelegateExecutionImpl)10 DelegateExecutionFake (org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)7 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)6 ArrayList (java.util.ArrayList)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Resource (org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)4 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)4 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)4 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)4 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)4 List (java.util.List)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)3 AbstractCDSPropertiesBean (org.onap.so.client.cds.beans.AbstractCDSPropertiesBean)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3