Search in sources :

Example 1 with BPMNErrorReceivedEvent

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);
}
Also used : ActivitiErrorEvent(org.activiti.engine.delegate.event.ActivitiErrorEvent) BPMNErrorReceivedEvent(org.activiti.api.process.model.events.BPMNErrorReceivedEvent) BPMNErrorImpl(org.activiti.api.runtime.model.impl.BPMNErrorImpl) Test(org.junit.jupiter.api.Test)

Example 2 with BPMNErrorReceivedEvent

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"));
}
Also used : ProcessInstance(org.activiti.api.process.model.ProcessInstance) BeforeEach(org.junit.jupiter.api.BeforeEach) Pageable(org.activiti.api.runtime.shared.query.Pageable) Tuple(org.assertj.core.groups.Tuple) GetTasksPayloadBuilder(org.activiti.api.task.model.builders.GetTasksPayloadBuilder) Task(org.activiti.api.task.model.Task) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SecurityUtil(org.activiti.spring.boot.security.util.SecurityUtil) Autowired(org.springframework.beans.factory.annotation.Autowired) Import(org.springframework.context.annotation.Import) Page(org.activiti.api.runtime.shared.query.Page) ProcessPayloadBuilder(org.activiti.api.process.model.builders.ProcessPayloadBuilder) GetTasksPayload(org.activiti.api.task.model.payloads.GetTasksPayload) ProcessRuntime(org.activiti.api.process.runtime.ProcessRuntime) Test(org.junit.jupiter.api.Test) AfterEach(org.junit.jupiter.api.AfterEach) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) ProcessCleanUpUtil(org.activiti.spring.boot.test.util.ProcessCleanUpUtil) BPMNErrorReceivedEvent(org.activiti.api.process.model.events.BPMNErrorReceivedEvent) DummyBPMNErrorReceivedListener(org.activiti.spring.boot.process.listener.DummyBPMNErrorReceivedListener) TaskRuntime(org.activiti.api.task.runtime.TaskRuntime) ProcessInstance(org.activiti.api.process.model.ProcessInstance) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with BPMNErrorReceivedEvent

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"));
}
Also used : ProcessInstance(org.activiti.api.process.model.ProcessInstance) BeforeEach(org.junit.jupiter.api.BeforeEach) Pageable(org.activiti.api.runtime.shared.query.Pageable) Tuple(org.assertj.core.groups.Tuple) GetTasksPayloadBuilder(org.activiti.api.task.model.builders.GetTasksPayloadBuilder) Task(org.activiti.api.task.model.Task) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SecurityUtil(org.activiti.spring.boot.security.util.SecurityUtil) Autowired(org.springframework.beans.factory.annotation.Autowired) Import(org.springframework.context.annotation.Import) Page(org.activiti.api.runtime.shared.query.Page) ProcessPayloadBuilder(org.activiti.api.process.model.builders.ProcessPayloadBuilder) GetTasksPayload(org.activiti.api.task.model.payloads.GetTasksPayload) ProcessRuntime(org.activiti.api.process.runtime.ProcessRuntime) Test(org.junit.jupiter.api.Test) AfterEach(org.junit.jupiter.api.AfterEach) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) ProcessCleanUpUtil(org.activiti.spring.boot.test.util.ProcessCleanUpUtil) BPMNErrorReceivedEvent(org.activiti.api.process.model.events.BPMNErrorReceivedEvent) DummyBPMNErrorReceivedListener(org.activiti.spring.boot.process.listener.DummyBPMNErrorReceivedListener) TaskRuntime(org.activiti.api.task.runtime.TaskRuntime) ProcessInstance(org.activiti.api.process.model.ProcessInstance) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with BPMNErrorReceivedEvent

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"));
}
Also used : ProcessInstance(org.activiti.api.process.model.ProcessInstance) BeforeEach(org.junit.jupiter.api.BeforeEach) Pageable(org.activiti.api.runtime.shared.query.Pageable) Tuple(org.assertj.core.groups.Tuple) GetTasksPayloadBuilder(org.activiti.api.task.model.builders.GetTasksPayloadBuilder) Task(org.activiti.api.task.model.Task) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SecurityUtil(org.activiti.spring.boot.security.util.SecurityUtil) Autowired(org.springframework.beans.factory.annotation.Autowired) Import(org.springframework.context.annotation.Import) Page(org.activiti.api.runtime.shared.query.Page) ProcessPayloadBuilder(org.activiti.api.process.model.builders.ProcessPayloadBuilder) GetTasksPayload(org.activiti.api.task.model.payloads.GetTasksPayload) ProcessRuntime(org.activiti.api.process.runtime.ProcessRuntime) Test(org.junit.jupiter.api.Test) AfterEach(org.junit.jupiter.api.AfterEach) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) ProcessCleanUpUtil(org.activiti.spring.boot.test.util.ProcessCleanUpUtil) BPMNErrorReceivedEvent(org.activiti.api.process.model.events.BPMNErrorReceivedEvent) DummyBPMNErrorReceivedListener(org.activiti.spring.boot.process.listener.DummyBPMNErrorReceivedListener) TaskRuntime(org.activiti.api.task.runtime.TaskRuntime) ProcessInstance(org.activiti.api.process.model.ProcessInstance) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

BPMNErrorReceivedEvent (org.activiti.api.process.model.events.BPMNErrorReceivedEvent)4 Test (org.junit.jupiter.api.Test)4 ProcessInstance (org.activiti.api.process.model.ProcessInstance)3 ProcessPayloadBuilder (org.activiti.api.process.model.builders.ProcessPayloadBuilder)3 ProcessRuntime (org.activiti.api.process.runtime.ProcessRuntime)3 Page (org.activiti.api.runtime.shared.query.Page)3 Pageable (org.activiti.api.runtime.shared.query.Pageable)3 Task (org.activiti.api.task.model.Task)3 GetTasksPayloadBuilder (org.activiti.api.task.model.builders.GetTasksPayloadBuilder)3 GetTasksPayload (org.activiti.api.task.model.payloads.GetTasksPayload)3 TaskRuntime (org.activiti.api.task.runtime.TaskRuntime)3 DummyBPMNErrorReceivedListener (org.activiti.spring.boot.process.listener.DummyBPMNErrorReceivedListener)3 SecurityUtil (org.activiti.spring.boot.security.util.SecurityUtil)3 ProcessCleanUpUtil (org.activiti.spring.boot.test.util.ProcessCleanUpUtil)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Tuple (org.assertj.core.groups.Tuple)3 AfterEach (org.junit.jupiter.api.AfterEach)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3