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);
}
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");
}
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));
}
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));
}
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));
}
Aggregations