Search in sources :

Example 26 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class ExceptionBuilder method buildWorkflowException.

public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
    String processKey = getProcessKey(execution);
    logger.info("Building a WorkflowException");
    WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
    execution.setVariable("WorkflowException", exception);
    execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
    logger.info("Outgoing WorkflowException is {}", exception);
}
Also used : WorkflowException(org.onap.so.bpmn.core.WorkflowException)

Example 27 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class ExecuteBuildingBlockRainyDayUnitTest method setup.

@Before
public void setup() {
    exception = new WorkflowException("Test exception", 7000, "", "", ONAPComponents.SDNC);
    noExtSystemErrorSourceException = new WorkflowException("Test exception without extsystemErrorSource", 7000, "", "");
    execution = new DelegateExecutionFake();
    execution.setVariable("mso-request-id", "ef7c004b-829f-4773-a7d8-4de29feef5b1");
    executionNullisRollback = new DelegateExecutionFake();
    executionNullisRollback.setVariable("mso-request-id", "ef7c004b-829f-4773-a7d8-4de29feef5b1");
}
Also used : WorkflowException(org.onap.so.bpmn.core.WorkflowException) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) Before(org.junit.Before)

Example 28 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class WorkflowActionBBFailureTest method updateRequestRollbackErrorStatusMessageTest.

@Test
public void updateRequestRollbackErrorStatusMessageTest() {
    String reqId = "reqId123";
    execution.setVariable("mso-request-id", reqId);
    WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case");
    execution.setVariable("WorkflowException", we);
    execution.setVariable("isRollback", true);
    doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
    workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
    Mockito.verify(reqMock, Mockito.times(0)).setStatusMessage("Error Case");
    Mockito.verify(reqMock, Mockito.times(1)).setRollbackStatusMessage("Error Case");
    Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
    Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
    Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class));
}
Also used : WorkflowException(org.onap.so.bpmn.core.WorkflowException) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Timestamp(java.sql.Timestamp) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 29 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class WorkflowActionBBFailureTest method updateRequestStatusToFailed_Null_Rollback.

@Test
public void updateRequestStatusToFailed_Null_Rollback() {
    String reqId = "reqId123";
    execution.setVariable("mso-request-id", reqId);
    execution.setVariable("retryCount", 3);
    execution.setVariable("handlingCode", "Success");
    execution.setVariable("gCurrentSequence", 1);
    WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case");
    execution.setVariable("WorkflowException", we);
    doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
    workflowActionBBFailure.updateRequestStatusToFailed(execution);
    Mockito.verify(reqMock, Mockito.times(1)).setStatusMessage("Error Case");
    Mockito.verify(reqMock, Mockito.times(1)).setRequestStatus("FAILED");
    Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
    Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
    Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class));
}
Also used : WorkflowException(org.onap.so.bpmn.core.WorkflowException) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Timestamp(java.sql.Timestamp) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 30 with WorkflowException

use of org.onap.so.bpmn.core.WorkflowException in project so by onap.

the class WorkflowActionBBFailureTest method updateRequestNotRollbackErrorStatusMessageTest.

@Test
public void updateRequestNotRollbackErrorStatusMessageTest() {
    String reqId = "reqId123";
    execution.setVariable("mso-request-id", reqId);
    WorkflowException we = new WorkflowException("WorkflowAction", 1231, "Error Case");
    execution.setVariable("WorkflowException", we);
    execution.setVariable("isRollback", false);
    doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId);
    workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
    Mockito.verify(reqMock, Mockito.times(1)).setStatusMessage("Error Case");
    Mockito.verify(reqMock, Mockito.times(0)).setRollbackStatusMessage("Error Case");
    Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100));
    Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN");
    Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class));
}
Also used : WorkflowException(org.onap.so.bpmn.core.WorkflowException) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Timestamp(java.sql.Timestamp) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

WorkflowException (org.onap.so.bpmn.core.WorkflowException)75 Test (org.junit.Test)61 HashMap (java.util.HashMap)49 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)45 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)10 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)9 AllottedResource (org.onap.so.bpmn.core.domain.AllottedResource)8 HomingSolution (org.onap.so.bpmn.core.domain.HomingSolution)8 NetworkResource (org.onap.so.bpmn.core.domain.NetworkResource)8 Resource (org.onap.so.bpmn.core.domain.Resource)8 ServiceDecomposition (org.onap.so.bpmn.core.domain.ServiceDecomposition)8 VnfResource (org.onap.so.bpmn.core.domain.VnfResource)8 BpmnError (org.camunda.bpm.engine.delegate.BpmnError)7 Timestamp (java.sql.Timestamp)4 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)4 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)4 DelegateExecutionFake (org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)3 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)3 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)3