Search in sources :

Example 1 with BPMNTimerRetriesDecrementedEventImpl

use of org.activiti.api.runtime.event.impl.BPMNTimerRetriesDecrementedEventImpl in project Activiti by Activiti.

the class ToTimerRetriesDecrementedConverter method from.

@Override
public Optional<BPMNTimerRetriesDecrementedEvent> from(ActivitiEvent internalEvent) {
    BPMNTimerRetriesDecrementedEventImpl event = null;
    if (bpmnTimerConverter.isTimerRelatedEvent(internalEvent)) {
        event = new BPMNTimerRetriesDecrementedEventImpl(bpmnTimerConverter.convertToBPMNTimer((ActivitiEntityEvent) internalEvent));
        event.setProcessInstanceId(internalEvent.getProcessInstanceId());
        event.setProcessDefinitionId(internalEvent.getProcessDefinitionId());
    }
    return Optional.ofNullable(event);
}
Also used : BPMNTimerRetriesDecrementedEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerRetriesDecrementedEventImpl)

Example 2 with BPMNTimerRetriesDecrementedEventImpl

use of org.activiti.api.runtime.event.impl.BPMNTimerRetriesDecrementedEventImpl in project activiti-cloud by Activiti.

the class ToCloudProcessRuntimeTimerEventsConverterTest method shouldConvertBPMNTimerRetriesDecrementedEventToCloudBPMNTimerRetriesDecrementedEvent.

@Test
public void shouldConvertBPMNTimerRetriesDecrementedEventToCloudBPMNTimerRetriesDecrementedEvent() {
    // given
    BPMNTimerImpl timer = new BPMNTimerImpl("entityId");
    timer.setProcessInstanceId("procInstId");
    timer.setProcessDefinitionId("procDefId");
    TimerPayload timerPayload = new TimerPayload();
    timer.setTimerPayload(timerPayload);
    BPMNTimerRetriesDecrementedEventImpl timerFiredEvent = new BPMNTimerRetriesDecrementedEventImpl(timer);
    // when
    CloudBPMNTimerRetriesDecrementedEvent cloudEvent = converter.from(timerFiredEvent);
    assertThat(cloudEvent.getEntity()).isEqualTo(timer);
    assertThat(cloudEvent.getProcessDefinitionId()).isEqualTo("procDefId");
    assertThat(cloudEvent.getProcessInstanceId()).isEqualTo("procInstId");
    // then
    verify(runtimeBundleInfoAppender).appendRuntimeBundleInfoTo(any(CloudRuntimeEventImpl.class));
}
Also used : CloudRuntimeEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl) BPMNTimerRetriesDecrementedEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerRetriesDecrementedEventImpl) BPMNTimerImpl(org.activiti.api.runtime.model.impl.BPMNTimerImpl) CloudBPMNTimerRetriesDecrementedEvent(org.activiti.cloud.api.process.model.events.CloudBPMNTimerRetriesDecrementedEvent) TimerPayload(org.activiti.api.process.model.payloads.TimerPayload) Test(org.junit.jupiter.api.Test)

Example 3 with BPMNTimerRetriesDecrementedEventImpl

use of org.activiti.api.runtime.event.impl.BPMNTimerRetriesDecrementedEventImpl in project Activiti by Activiti.

the class TimerRetriesDecrementedListenerDelegateTest method shouldCallRegisteredListenersWhenConvertedEventIsNotEmpty.

@Test
public void shouldCallRegisteredListenersWhenConvertedEventIsNotEmpty() {
    // given
    ActivitiEntityEvent internalEvent = mock(ActivitiEntityEvent.class);
    BPMNTimerRetriesDecrementedEventImpl convertedEvent = new BPMNTimerRetriesDecrementedEventImpl();
    given(converter.from(internalEvent)).willReturn(Optional.of(convertedEvent));
    // when
    listenerDelegate.onEvent(internalEvent);
    // then
    verify(listener).onEvent(convertedEvent);
}
Also used : BPMNTimerRetriesDecrementedEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerRetriesDecrementedEventImpl) ActivitiEntityEvent(org.activiti.engine.delegate.event.ActivitiEntityEvent) Test(org.junit.jupiter.api.Test)

Aggregations

BPMNTimerRetriesDecrementedEventImpl (org.activiti.api.runtime.event.impl.BPMNTimerRetriesDecrementedEventImpl)3 Test (org.junit.jupiter.api.Test)2 TimerPayload (org.activiti.api.process.model.payloads.TimerPayload)1 BPMNTimerImpl (org.activiti.api.runtime.model.impl.BPMNTimerImpl)1 CloudRuntimeEventImpl (org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl)1 CloudBPMNTimerRetriesDecrementedEvent (org.activiti.cloud.api.process.model.events.CloudBPMNTimerRetriesDecrementedEvent)1 ActivitiEntityEvent (org.activiti.engine.delegate.event.ActivitiEntityEvent)1