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