Search in sources :

Example 1 with PmProjectStarted

use of io.spine.test.procman.event.PmProjectStarted in project core-java by SpineEventEngine.

the class PmMessageDeliveryShould method postpone_events_dispatched_to_reactor_method.

@Test
public void postpone_events_dispatched_to_reactor_method() {
    assertNull(ReactingProjectWizard.getEventReceived());
    final Event event = projectStarted();
    boundedContext.getEventBus().post(event);
    assertNull(ReactingProjectWizard.getEventReceived());
    final EventEnvelope expectedEnvelope = EventEnvelope.of(event);
    final PostponingEventDelivery delivery = repository.getEventEndpointDelivery();
    final Map<ProjectId, EventEnvelope> postponedEvents = delivery.getPostponedEvents();
    assertTrue(postponedEvents.size() == 1 && postponedEvents.containsValue(expectedEnvelope));
    final ProjectId projectId = postponedEvents.keySet().iterator().next();
    delivery.deliverNow(projectId, postponedEvents.get(projectId));
    final PmProjectStarted deliveredEventMsg = ReactingProjectWizard.getEventReceived();
    assertNotNull(deliveredEventMsg);
    assertEquals(Events.getMessage(event), deliveredEventMsg);
}
Also used : EventEnvelope(io.spine.core.EventEnvelope) ProjectId(io.spine.test.procman.ProjectId) Event(io.spine.core.Event) PmProjectStarted(io.spine.test.procman.event.PmProjectStarted) PostponingEventDelivery(io.spine.server.procman.given.PmMessageDeliveryTestEnv.PostponingEventDelivery) Test(org.junit.Test)

Example 2 with PmProjectStarted

use of io.spine.test.procman.event.PmProjectStarted in project core-java by SpineEventEngine.

the class PmMessageDeliveryTestEnv method projectStarted.

public static Event projectStarted() {
    final ProjectId projectId = projectId();
    final TestEventFactory eventFactory = TestEventFactory.newInstance(AnyPacker.pack(projectId), PmMessageDeliveryTestEnv.class);
    final PmProjectStarted msg = PmProjectStarted.newBuilder().setProjectId(projectId).build();
    final Event result = eventFactory.createEvent(msg);
    return result;
}
Also used : TestEventFactory(io.spine.server.command.TestEventFactory) ProjectId(io.spine.test.procman.ProjectId) Event(io.spine.core.Event) PmProjectStarted(io.spine.test.procman.event.PmProjectStarted)

Aggregations

Event (io.spine.core.Event)2 ProjectId (io.spine.test.procman.ProjectId)2 PmProjectStarted (io.spine.test.procman.event.PmProjectStarted)2 EventEnvelope (io.spine.core.EventEnvelope)1 TestEventFactory (io.spine.server.command.TestEventFactory)1 PostponingEventDelivery (io.spine.server.procman.given.PmMessageDeliveryTestEnv.PostponingEventDelivery)1 Test (org.junit.Test)1