use of org.activiti.api.process.model.events.BPMNErrorReceivedEvent in project Activiti by Activiti.
the class ToErrorReceivedConverterTest method fromShouldReturnConvertedEventAndSetProcessInstanceIdAndProcessDefinitionId.
@Test
public void fromShouldReturnConvertedEventAndSetProcessInstanceIdAndProcessDefinitionId() {
// given
ActivitiErrorEvent internalEvent = mock(ActivitiErrorEvent.class);
given(internalEvent.getProcessDefinitionId()).willReturn("procDefId");
given(internalEvent.getProcessInstanceId()).willReturn("procInstId");
BPMNErrorImpl bpmnError = new BPMNErrorImpl("myError");
given(bpmnErrorConverter.convertToBPMNError(internalEvent)).willReturn(bpmnError);
// when
BPMNErrorReceivedEvent errorEvent = toErrorReceivedConverter.from(internalEvent).orElse(null);
// then
assertThat(errorEvent).isNotNull();
assertThat(errorEvent.getProcessInstanceId()).isEqualTo("procInstId");
assertThat(errorEvent.getProcessDefinitionId()).isEqualTo("procDefId");
assertThat(errorEvent.getEntity()).isEqualTo(bpmnError);
}
use of org.activiti.api.process.model.events.BPMNErrorReceivedEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNErrorReceivedIT method should_CatchCallActivityBoundaryErrorEvent_When_ErrorEndEvenThrown.
@Test
public void should_CatchCallActivityBoundaryErrorEvent_When_ErrorEndEvenThrown() {
securityUtil.logInAs("user");
ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey(ERROR_BOUNDARY_EVENT_CALLACTIVITY).build());
assertThat(processInstance).isNotNull();
checkProcessAndTask(processInstance.getId(), "Task");
assertThat(listener.getErrorReceivedEvents()).isNotEmpty().extracting(BPMNErrorReceivedEvent::getEventType, BPMNErrorReceivedEvent::getProcessDefinitionId, BPMNErrorReceivedEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getElementId(), event -> event.getEntity().getActivityName(), event -> event.getEntity().getActivityType(), event -> event.getEntity().getErrorId(), event -> event.getEntity().getErrorCode()).contains(Tuple.tuple(BPMNErrorReceivedEvent.ErrorEvents.ERROR_RECEIVED, processInstance.getProcessDefinitionId(), processInstance.getId(), processInstance.getProcessDefinitionId(), processInstance.getId(), "catchError", null, null, "errorId", "123"));
}
use of org.activiti.api.process.model.events.BPMNErrorReceivedEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNErrorReceivedIT method should_StartSubProcess_When_ErrorEndEvenThrown.
@Test
public void should_StartSubProcess_When_ErrorEndEvenThrown() {
securityUtil.logInAs("user");
ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey(ERROR_START_EVENT_SUBPROCESS).build());
assertThat(processInstance).isNotNull();
checkProcessAndTask(processInstance.getId(), "Task");
assertThat(listener.getErrorReceivedEvents()).isNotEmpty().extracting(BPMNErrorReceivedEvent::getEventType, BPMNErrorReceivedEvent::getProcessDefinitionId, BPMNErrorReceivedEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getElementId(), event -> event.getEntity().getActivityName(), event -> event.getEntity().getActivityType(), event -> event.getEntity().getErrorId(), event -> event.getEntity().getErrorCode()).contains(Tuple.tuple(BPMNErrorReceivedEvent.ErrorEvents.ERROR_RECEIVED, processInstance.getProcessDefinitionId(), processInstance.getId(), processInstance.getProcessDefinitionId(), processInstance.getId(), "subStart1", null, null, "errorId", "123"));
}
use of org.activiti.api.process.model.events.BPMNErrorReceivedEvent in project Activiti by Activiti.
the class ProcessRuntimeBPMNErrorReceivedIT method should_CatchSubProcessBoundaryErrorEvent_When_ErrorEndEvenThrown.
@Test
public void should_CatchSubProcessBoundaryErrorEvent_When_ErrorEndEvenThrown() {
securityUtil.logInAs("user");
ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder.start().withProcessDefinitionKey(ERROR_BOUNDARY_EVENT_SUBPROCESS).build());
assertThat(processInstance).isNotNull();
checkProcessAndTask(processInstance.getId(), "Task");
assertThat(listener.getErrorReceivedEvents()).isNotEmpty().extracting(BPMNErrorReceivedEvent::getEventType, BPMNErrorReceivedEvent::getProcessDefinitionId, BPMNErrorReceivedEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getElementId(), event -> event.getEntity().getActivityName(), event -> event.getEntity().getActivityType(), event -> event.getEntity().getErrorId(), event -> event.getEntity().getErrorCode()).contains(Tuple.tuple(BPMNErrorReceivedEvent.ErrorEvents.ERROR_RECEIVED, processInstance.getProcessDefinitionId(), processInstance.getId(), processInstance.getProcessDefinitionId(), processInstance.getId(), "catchError", null, null, "errorId", "123"));
}
Aggregations