use of io.spine.envelope.EventEnvelope in project core-java by SpineEventEngine.
the class EventBusShould method deliver_postponed_event_to_dispatcher_using_configured_executor.
@Test
public void deliver_postponed_event_to_dispatcher_using_configured_executor() {
final BareDispatcher dispatcher = new BareDispatcher();
eventBusWithPosponedExecution.register(dispatcher);
final Event event = Given.AnEvent.projectCreated();
eventBusWithPosponedExecution.post(event);
final Set<EventEnvelope> postponedEvents = postponedDispatcherDelivery.getPostponedEvents();
final EventEnvelope postponedEvent = postponedEvents.iterator().next();
verify(delegateDispatcherExecutor, never()).execute(any(Runnable.class));
postponedDispatcherDelivery.deliverNow(postponedEvent, dispatcher.getClass());
assertTrue(dispatcher.isDispatchCalled());
verify(delegateDispatcherExecutor).execute(any(Runnable.class));
}
use of io.spine.envelope.EventEnvelope in project core-java by SpineEventEngine.
the class EventEnricher method enrich.
/**
* Enriches the passed event.
*
* @throws IllegalArgumentException if the passed event cannot be enriched
* @see #canBeEnriched(Event)
*/
public Event enrich(Event event) {
checkTypeRegistered(event);
checkEnabled(event);
final EventEnvelope envelope = EventEnvelope.of(event);
final Action action = new Action(this, envelope);
final Event result = action.perform();
return result;
}
Aggregations