@Test void testLoad_FirstEventIsSnapshot() { String identifier = UUID.randomUUID().toString(); TestAggregate aggregate = new TestAggregate(identifier); when(mockEventStore.readEvents(identifier)).thenReturn( DomainEventStream.of(new GenericDomainEventMessage<>("type", identifier, 10, aggregate))); assertSame(aggregate, testSubject.load(identifier).getWrappedAggregate().getAggregateRoot()); }
protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } protected  EventSourcingRepository(Builder<T> builder); }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } protected  EventSourcingRepository(Builder<T> builder); static Builder<T> builder(Class<T> aggregateType); AggregateFactory<T> getAggregateFactory(); }
EventSourcingRepository extends LockingRepository<T, EventSourcedAggregate<T>> { protected DomainEventStream readEvents(String aggregateIdentifier) { DomainEventStream fullStream = eventStore.readEvents(aggregateIdentifier); return eventStreamFilter != null ? fullStream.filter(eventStreamFilter) : fullStream; } protected  EventSourcingRepository(Builder<T> builder); static Builder<T> builder(Class<T> aggregateType); AggregateFactory<T> getAggregateFactory();  }