Search in sources :

Example 6 with DelegateExecutionImpl

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

the class AbstractVnfCDSRequestProviderTest method createBuildingBlockExecution.

protected BuildingBlockExecution createBuildingBlockExecution() {
    DelegateExecution execution = new DelegateExecutionFake();
    execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
    return new DelegateExecutionImpl(execution);
}
Also used : DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)

Example 7 with DelegateExecutionImpl

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

the class ConfigAssignVnfTest method createBuildingBlockExecution.

private BuildingBlockExecution createBuildingBlockExecution(Object serviceJson) {
    DelegateExecution execution = new DelegateExecutionFake();
    execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock(serviceJson));
    return new DelegateExecutionImpl(execution);
}
Also used : DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)

Example 8 with DelegateExecutionImpl

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

the class GenericCDSProcessingBBTest method createBuildingBlockExecution.

private BuildingBlockExecution createBuildingBlockExecution() {
    DelegateExecution execution = new DelegateExecutionFake();
    execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
    return new DelegateExecutionImpl(execution);
}
Also used : DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)

Example 9 with DelegateExecutionImpl

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

the class PrepareSdncUpgradePreCheckPnfBBTest method prepareBuildingBlockExecution.

private BuildingBlockExecution prepareBuildingBlockExecution(String payload) {
    DelegateExecution execution = new DelegateExecutionFake();
    execution.setVariable("payload", payload);
    return new DelegateExecutionImpl(execution);
}
Also used : DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)

Example 10 with DelegateExecutionImpl

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

the class BBInputSetup method execute.

/**
 * This method is used for executing the building block.
 *
 * It will get the BB from the execution object by checking if the aLaCarte and homing is true.
 *
 * Then it will get the GBB and execute it.
 *
 * @param execution
 * @throws Exception
 * @return
 */
@Override
public void execute(DelegateExecution execution) throws Exception {
    try {
        GeneralBuildingBlock outputBB = null;
        ExecuteBuildingBlock executeBB = this.getExecuteBBFromExecution(execution);
        String resourceId = executeBB.getResourceId();
        String requestAction = executeBB.getRequestAction();
        String vnfType = executeBB.getVnfType();
        boolean aLaCarte = Boolean.TRUE.equals(executeBB.isaLaCarte());
        boolean homing = Boolean.TRUE.equals(executeBB.isHoming());
        Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
        outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType);
        ObjectMapper mapper = new ObjectMapper();
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
        logger.debug("GeneralBB: " + mapper.writeValueAsString(outputBB));
        setHomingFlag(outputBB, homing, lookupKeyMap);
        execution.setVariable(FLOW_VAR_NAME, executeBB.getBuildingBlock().getBpmnFlowName());
        execution.setVariable(GBB_INPUT_VAR_NAME, outputBB);
        execution.setVariable(LOOKUP_KEY_MAP_VAR_NAME, lookupKeyMap);
        if (outputBB.getRequestContext().getIsHelm()) {
            execution.setVariable("isHelm", true);
        } else {
            execution.setVariable("isHelm", false);
        }
        BuildingBlockExecution gBuildingBlockExecution = new DelegateExecutionImpl(execution);
        execution.setVariable("gBuildingBlockExecution", gBuildingBlockExecution);
        execution.setVariable("RetryCount", 1);
        execution.setVariable("handlingCode", "Success");
    } catch (Exception e) {
        logger.error("Exception occurred", e);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage());
    }
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) HashMap(java.util.HashMap) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ServiceModelNotFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException) NoServiceInstanceFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException) ResourceNotFoundException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ResourceNotFoundException) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)

Aggregations

DelegateExecutionImpl (org.onap.so.bpmn.common.DelegateExecutionImpl)29 DelegateExecutionFake (org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)17 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)11 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)9 Before (org.junit.Before)9 Test (org.junit.Test)9 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)8 ExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl)6 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)6 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 EntityNotFoundException (javax.persistence.EntityNotFoundException)3 BpmnError (org.camunda.bpm.engine.delegate.BpmnError)2 WorkflowException (org.onap.so.bpmn.core.WorkflowException)2 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)2 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)2 ExtractPojosForBB (org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB)2