Search in sources :

Example 1 with ExceptionBuilder

use of org.onap.so.client.exception.ExceptionBuilder in project so by onap.

the class WorkflowActionBBTasks method sendErrorSyncAck.

public void sendErrorSyncAck(DelegateExecution execution) {
    final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
    try {
        ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
        String errorMsg = (String) execution.getVariable("WorkflowActionErrorMessage");
        if (errorMsg == null) {
            errorMsg = "WorkflowAction failed unexpectedly.";
        }
        String processKey = exceptionBuilder.getProcessKey(execution);
        String buildworkflowException = "<aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>" + errorMsg + "</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException>";
        WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
        callbackResponse.setStatusCode(500);
        callbackResponse.setMessage("Fail");
        callbackResponse.setResponse(buildworkflowException);
        WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId, callbackResponse);
        execution.setVariable("sentSyncResponse", true);
    } catch (Exception ex) {
        logger.error(" Sending Sync Error Activity Failed. {}", ex.getMessage(), ex);
    }
}
Also used : WorkflowCallbackResponse(org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse) EntityNotFoundException(javax.persistence.EntityNotFoundException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder)

Example 2 with ExceptionBuilder

use of org.onap.so.client.exception.ExceptionBuilder in project so by onap.

the class VnfEBBLoaderTest method setup.

@Before
public void setup() {
    serviceId = "service123";
    vnfId = "vnf123";
    vfModuleId = "vfModule123";
    serviceInstanceAAI = mock(org.onap.aai.domain.yang.ServiceInstance.class);
    serviceInstanceMSO = mock(ServiceInstance.class);
    bbInputSetupUtils = mock(BBInputSetupUtils.class);
    bbInputSetup = mock(BBInputSetup.class);
    workflowActionUtils = mock(WorkflowActionExtractResourcesAAI.class);
    exceptionBuilder = mock(ExceptionBuilder.class);
    delegateExecution = new DelegateExecutionFake();
}
Also used : BBInputSetupUtils(org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils) BBInputSetup(org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder) Before(org.junit.Before)

Aggregations

ExceptionBuilder (org.onap.so.client.exception.ExceptionBuilder)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 EntityNotFoundException (javax.persistence.EntityNotFoundException)1 DelegateExecutionFake (org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)1 Before (org.junit.Before)1 WorkflowCallbackResponse (org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse)1 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)1 BBInputSetup (org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup)1 BBInputSetupUtils (org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils)1