Search in sources :

Example 1 with TestEventFactory

use of io.spine.test.TestEventFactory in project core-java by SpineEventEngine.

the class AggregateStorageShould method generateEvent.

private static Event generateEvent() {
    final TestEventFactory eventFactory = newInstance(AggregateStorageShould.class);
    final Event result = eventFactory.createEvent(EventMessage.projectCreated());
    return result;
}
Also used : TestEventFactory(io.spine.test.TestEventFactory) Event(io.spine.base.Event)

Example 2 with TestEventFactory

use of io.spine.test.TestEventFactory in project core-java by SpineEventEngine.

the class ProjectionRepositoryShould method ensureCatchesUpFromEventStorage.

private void ensureCatchesUpFromEventStorage(ProjectionRepository<ProjectId, TestProjection, Project> repo) {
    final EventStore eventStore = boundedContext.getEventBus().getEventStore();
    final TestEventFactory eventFactory = newEventFactory(PRODUCER_ID);
    // Put events into the EventStore.
    final ProjectCreated projectCreated = ProjectCreated.newBuilder().setProjectId(ID).build();
    final Event projectCreatedEvent = eventFactory.createEvent(projectCreated);
    appendEvent(eventStore, projectCreatedEvent);
    final TaskAdded taskAdded = TaskAdded.newBuilder().setProjectId(ID).build();
    final Event taskAddedEvent = eventFactory.createEvent(taskAdded);
    appendEvent(eventStore, taskAddedEvent);
    final ProjectStarted projectStarted = ProjectStarted.newBuilder().setProjectId(ID).build();
    final Event projectStartedEvent = eventFactory.createEvent(projectStarted);
    appendEvent(eventStore, projectStartedEvent);
    repo.catchUp();
    assertTrue(TestProjection.processed(projectCreated));
    assertTrue(TestProjection.processed(taskAdded));
    assertTrue(TestProjection.processed(projectStarted));
}
Also used : EventStore(io.spine.server.event.EventStore) TestEventFactory(io.spine.test.TestEventFactory) ProjectStarted(io.spine.test.projection.event.ProjectStarted) TaskAdded(io.spine.test.projection.event.TaskAdded) Event(io.spine.base.Event) ProjectCreated(io.spine.test.projection.event.ProjectCreated)

Example 3 with TestEventFactory

use of io.spine.test.TestEventFactory in project core-java by SpineEventEngine.

the class EventEnricherShould method createEvent.

private static Event createEvent(Message msg) {
    final TestEventFactory eventFactory = newInstance(EventEnricherShould.class);
    final Event event = eventFactory.createEvent(msg);
    return event;
}
Also used : TestEventFactory(io.spine.test.TestEventFactory) Event(io.spine.base.Event)

Aggregations

Event (io.spine.base.Event)3 TestEventFactory (io.spine.test.TestEventFactory)3 EventStore (io.spine.server.event.EventStore)1 ProjectCreated (io.spine.test.projection.event.ProjectCreated)1 ProjectStarted (io.spine.test.projection.event.ProjectStarted)1 TaskAdded (io.spine.test.projection.event.TaskAdded)1