Search in sources :

Example 1 with BPMNTimerScheduledEventImpl

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);
}
Also used : BPMNTimerScheduledEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl)

Example 2 with BPMNTimerScheduledEventImpl

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));
}
Also used : CloudRuntimeEventImpl(org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl) BPMNTimerImpl(org.activiti.api.runtime.model.impl.BPMNTimerImpl) CloudBPMNTimerScheduledEvent(org.activiti.cloud.api.process.model.events.CloudBPMNTimerScheduledEvent) BPMNTimerScheduledEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl) TimerPayload(org.activiti.api.process.model.payloads.TimerPayload) Test(org.junit.jupiter.api.Test)

Example 3 with BPMNTimerScheduledEventImpl

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);
}
Also used : ActivitiEntityEvent(org.activiti.engine.delegate.event.ActivitiEntityEvent) BPMNTimerScheduledEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl) Test(org.junit.jupiter.api.Test)

Example 4 with BPMNTimerScheduledEventImpl

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);
}
Also used : CloudBPMNTimerFiredEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFiredEventImpl) CloudBPMNTimerScheduledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerScheduledEventImpl) BPMNTimerImpl(org.activiti.api.runtime.model.impl.BPMNTimerImpl) BPMNTimerScheduledEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl) CloudBPMNTimerScheduledEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerScheduledEventImpl) BPMNTimerFiredEventImpl(org.activiti.api.runtime.event.impl.BPMNTimerFiredEventImpl) CloudBPMNTimerFiredEventImpl(org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFiredEventImpl) Test(org.junit.jupiter.api.Test)

Aggregations

BPMNTimerScheduledEventImpl (org.activiti.api.runtime.event.impl.BPMNTimerScheduledEventImpl)4 Test (org.junit.jupiter.api.Test)3 BPMNTimerImpl (org.activiti.api.runtime.model.impl.BPMNTimerImpl)2 TimerPayload (org.activiti.api.process.model.payloads.TimerPayload)1 BPMNTimerFiredEventImpl (org.activiti.api.runtime.event.impl.BPMNTimerFiredEventImpl)1 CloudRuntimeEventImpl (org.activiti.cloud.api.model.shared.impl.events.CloudRuntimeEventImpl)1 CloudBPMNTimerScheduledEvent (org.activiti.cloud.api.process.model.events.CloudBPMNTimerScheduledEvent)1 CloudBPMNTimerFiredEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerFiredEventImpl)1 CloudBPMNTimerScheduledEventImpl (org.activiti.cloud.api.process.model.impl.events.CloudBPMNTimerScheduledEventImpl)1 ActivitiEntityEvent (org.activiti.engine.delegate.event.ActivitiEntityEvent)1