use of io.spine.test.projection.event.TaskAdded 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));
}
Aggregations