Search in sources :

Example 1 with BPMNErrorImpl

use of org.activiti.api.runtime.model.impl.BPMNErrorImpl 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 BPMNErrorImpl

use of org.activiti.api.runtime.model.impl.BPMNErrorImpl in project Activiti by Activiti.

the class BPMNErrorConverter method convertToBPMNError.

public BPMNErrorImpl convertToBPMNError(ActivitiErrorEvent internalEvent) {
    BPMNErrorImpl bpmnError = new BPMNErrorImpl(internalEvent.getActivityId(), internalEvent.getActivityName(), internalEvent.getActivityType());
    bpmnError.setProcessDefinitionId(internalEvent.getProcessDefinitionId());
    bpmnError.setProcessInstanceId(internalEvent.getProcessInstanceId());
    bpmnError.setExecutionId(internalEvent.getExecutionId());
    bpmnError.setErrorId(internalEvent.getErrorId());
    bpmnError.setErrorCode(internalEvent.getErrorCode());
    return bpmnError;
}
Also used : BPMNErrorImpl(org.activiti.api.runtime.model.impl.BPMNErrorImpl)

Example 3 with BPMNErrorImpl

use of org.activiti.api.runtime.model.impl.BPMNErrorImpl in project Activiti by Activiti.

the class BPMNErrorConverterTest method convertShouldReturnBPMNError.

@Test
public void convertShouldReturnBPMNError() {
    ActivitiErrorEvent internalEvent = mock(ActivitiErrorEvent.class);
    given(internalEvent.getErrorId()).willReturn("errorId");
    given(internalEvent.getErrorCode()).willReturn("errorCode");
    given(internalEvent.getActivityName()).willReturn("activityName");
    given(internalEvent.getActivityType()).willReturn("activityType");
    given(internalEvent.getProcessDefinitionId()).willReturn("procDefId");
    given(internalEvent.getProcessInstanceId()).willReturn("procInstId");
    BPMNErrorImpl bpmnError = bpmnErrorConverter.convertToBPMNError(internalEvent);
    // then
    assertThat(bpmnError).isNotNull();
    assertThat(bpmnError.getProcessInstanceId()).isEqualTo("procInstId");
    assertThat(bpmnError.getProcessDefinitionId()).isEqualTo("procDefId");
    assertThat(bpmnError.getErrorId()).isEqualTo("errorId");
    assertThat(bpmnError.getErrorCode()).isEqualTo("errorCode");
    assertThat(bpmnError.getActivityName()).isEqualTo("activityName");
    assertThat(bpmnError.getActivityType()).isEqualTo("activityType");
}
Also used : ActivitiErrorEvent(org.activiti.engine.delegate.event.ActivitiErrorEvent) BPMNErrorImpl(org.activiti.api.runtime.model.impl.BPMNErrorImpl) Test(org.junit.jupiter.api.Test)

Aggregations

BPMNErrorImpl (org.activiti.api.runtime.model.impl.BPMNErrorImpl)3 ActivitiErrorEvent (org.activiti.engine.delegate.event.ActivitiErrorEvent)2 Test (org.junit.jupiter.api.Test)2 BPMNErrorReceivedEvent (org.activiti.api.process.model.events.BPMNErrorReceivedEvent)1