use of org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl in project Activiti by Activiti.
the class ToTimerScheduledConverter method from.
@Override
public Optional<BPMNTimerScheduledEvent> from(ActivitiEvent internalEvent) {
BPMNTimerScheduledEventImpl event = null;
if (bpmnTimerConverter.isTimerRelatedEvent(internalEvent)) {
event = new BPMNTimerScheduledEventImpl(bpmnTimerConverter.convertToBPMNTimer((ActivitiEntityEvent) internalEvent));
event.setProcessInstanceId(internalEvent.getProcessInstanceId());
event.setProcessDefinitionId(internalEvent.getProcessDefinitionId());
}
return Optional.ofNullable(event);
}
use of org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl in project activiti-cloud by Activiti.
the class ToCloudProcessRuntimeTimerEventsConverterTest method shouldConvertBPMNTimerScheduledEventToCloudBPMNTimerScheduledEvent.
@Test
public void shouldConvertBPMNTimerScheduledEventToCloudBPMNTimerScheduledEvent() {
// given
BPMNTimerImpl timer = new BPMNTimerImpl("entityId");
timer.setProcessInstanceId("procInstId");
timer.setProcessDefinitionId("procDefId");
TimerPayload timerPayload = new TimerPayload();
timer.setTimerPayload(timerPayload);
BPMNTimerScheduledEventImpl timerFiredEvent = new BPMNTimerScheduledEventImpl(timer);
// when
CloudBPMNTimerScheduledEvent 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.BPMNTimerScheduledEventImpl in project Activiti by Activiti.
the class TimerScheduledListenerDelegateTest method shouldCallRegisteredListenersWhenConvertedEventIsNotEmpty.
@Test
public void shouldCallRegisteredListenersWhenConvertedEventIsNotEmpty() {
// given
ActivitiEntityEvent internalEvent = mock(ActivitiEntityEvent.class);
BPMNTimerScheduledEventImpl convertedEvent = new BPMNTimerScheduledEventImpl();
given(converter.from(internalEvent)).willReturn(Optional.of(convertedEvent));
// when
listenerDelegate.onEvent(internalEvent);
// then
verify(listener).onEvent(convertedEvent);
}
use of org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl in project activiti-cloud by Activiti.
the class CloudTimerProducerTest method onEventShouldConvertEventToCloudEventAndAddToAggregator.
@Test
public void onEventShouldConvertEventToCloudEventAndAddToAggregator() {
// given
BPMNTimerFiredEventImpl eventFired = new BPMNTimerFiredEventImpl(new BPMNTimerImpl());
CloudBPMNTimerFiredEventImpl cloudEventFired = new CloudBPMNTimerFiredEventImpl();
given(eventConverter.from(eventFired)).willReturn(cloudEventFired);
// when
cloudTimerFiredProducer.onEvent(eventFired);
// then
verify(eventsAggregator).add(cloudEventFired);
BPMNTimerScheduledEventImpl eventScheduled = new BPMNTimerScheduledEventImpl(new BPMNTimerImpl());
CloudBPMNTimerScheduledEventImpl cloudEventScheduled = new CloudBPMNTimerScheduledEventImpl();
given(eventConverter.from(eventScheduled)).willReturn(cloudEventScheduled);
// when
cloudTimerScheduledProducer.onEvent(eventScheduled);
// then
verify(eventsAggregator).add(cloudEventScheduled);
}
Aggregations