.map(this::fromEsEvent) .collect(new ImmutableListCollector<>()); return new EventReadResult<>( events, eventsSlice.fromEventNumber,
maxEventsPerRead); if (readResult == null || readResult.getEvents().isEmpty()) { .getEvents() .stream() .map(EventRecord::getEvent) state = projection.apply(aggregateId, state, events); if (readResult.isEndOfStream()) { return DefaultImmutableAggregate.fromExisting( projection, aggregateId, readResult.getLastVersion(), state); currentStreamPosition = readResult.getNextVersion();
maxEventsPerRead); if (readResult == null || readResult.getEvents().isEmpty()) { .getEvents() .stream() .map(EventRecord::getEvent) state = projection.apply(aggregateId, state, events); if (readResult.isEndOfStream()) { return DefaultImmutableAggregate.fromExisting( projection, aggregateId, readResult.getLastVersion(), state); currentStreamPosition = readResult.getNextVersion();
@Test public void readReturnsEmptyOnEmptyStream() throws Exception { returnsAggregateWithEmptyStateOn( new EventReadResult( ImmutableList.of(), 0, 10, 11, false)); }
.map(this::fromEsEvent) .collect(new ImmutableListCollector<>()); return new EventReadResult<>( events, version,
.map(this::fromEsEvent) .collect(new ImmutableListCollector<>()); return new EventReadResult<>( events, version,
new EventReadResult<>(batch1Events, 0, 1, 2, false); EventReadResult<TestEvent> repositoryResult2 = new EventReadResult<>(batch2Events, 2, 2, 3, true); TestState expectedState = new TestState("state1");
AGGREGATE_ID_1, 4, 1, "test1", UUID.randomUUID(), Instant.now(), ImmutableMap.of(), testEvent2)); EventReadResult repositoryResult = new EventReadResult<>(events, 0, 1, 2, true); List<TestEvent> expectedEvents = ImmutableList.of(testEvent1, testEvent2); TestState expectedState = new TestState("state1");