use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.
the class ProjectionRepositoryShould method skip_all_the_events_after_catch_up_outdated.
// Due to mockito matcher usage
@SuppressWarnings("unchecked")
@Test
public void skip_all_the_events_after_catch_up_outdated() throws InterruptedException {
// Set up bounded context
final BoundedContext boundedContext = TestBoundedContextFactory.MultiTenant.newBoundedContext();
final int eventsCount = 10;
final EventStore eventStore = boundedContext.getEventBus().getEventStore();
for (int i = 0; i < eventsCount; i++) {
final ProjectId projectId = ProjectId.newBuilder().setId(valueOf(i)).build();
final Message eventMessage = ProjectCreated.newBuilder().setProjectId(projectId).build();
final Event event = createEvent(pack(projectId), eventMessage);
appendEvent(eventStore, event);
}
// Set up repository
final Duration duration = Durations2.nanos(1L);
final ProjectionRepository repository = spy(new ManualCatchupProjectionRepository(boundedContext, duration));
repository.initStorage(storageFactory());
repository.catchUp();
// Check bulk write
verify(repository, never()).store(any(Projection.class));
}
Aggregations