@Test @DisplayName("do nothing when appending empty iterable") void processEmptyIterable() { eventStore.appendAll(Collections.emptySet()); }
@Override public void appendAll(Iterable<Event> events) { checkNotNull(events); ImmutableList<Event> eventList = Streams.stream(events) .filter(Objects::nonNull) .collect(toImmutableList()); if (eventList.isEmpty()) { return; } Event event = eventList.get(0); TenantAwareOperation op = new EventOperation(event) { @Override public void run() { if (isTenantSet()) { ensureSameTenant(eventList); } store(eventList); } }; op.execute(); log.stored(events); }
DefaultEventStore extends DefaultRecordBasedRepository<EventId, EEntity, Event> implements EventStore { @Override public void appendAll(Iterable<Event> events) { checkNotNull(events); ImmutableList<Event> eventList = Streams.stream(events) .filter(Objects::nonNull) .collect(toImmutableList()); if (eventList.isEmpty()) { return; } Event event = eventList.get(0); TenantAwareOperation op = new EventOperation(event) { @Override public void run() { if (isTenantSet()) { ensureSameTenant(eventList); } store(eventList); } }; op.execute(); log.stored(events); } }
DefaultEventStore extends DefaultRecordBasedRepository<EventId, EEntity, Event> implements EventStore { @Override public void appendAll(Iterable<Event> events) { checkNotNull(events); ImmutableList<Event> eventList = Streams.stream(events) .filter(Objects::nonNull) .collect(toImmutableList()); if (eventList.isEmpty()) { return; } Event event = eventList.get(0); TenantAwareOperation op = new EventOperation(event) { @Override public void run() { if (isTenantSet()) { ensureSameTenant(eventList); } store(eventList); } }; op.execute(); log.stored(events); } DefaultEventStore(); }
DefaultEventStore extends DefaultRecordBasedRepository<EventId, EEntity, Event> implements EventStore { @Override public void appendAll(Iterable<Event> events) { checkNotNull(events); ImmutableList<Event> eventList = Streams.stream(events) .filter(Objects::nonNull) .collect(toImmutableList()); if (eventList.isEmpty()) { return; } Event event = eventList.get(0); TenantAwareOperation op = new EventOperation(event) { @Override public void run() { if (isTenantSet()) { ensureSameTenant(eventList); } store(eventList); } }; op.execute(); log.stored(events); } DefaultEventStore(); @Override @SuppressWarnings({"OverridingMethodsMustInvokeSuper", "MissingSuperCall"}) // see impl. note void registerWith(BoundedContext context); @Override void append(Event event); @Override void appendAll(Iterable<Event> events); @Override void read(EventStreamQuery request, StreamObserver<Event> responseObserver); }
DefaultEventStore extends DefaultRecordBasedRepository<EventId, EEntity, Event> implements EventStore { @Override public void appendAll(Iterable<Event> events) { checkNotNull(events); ImmutableList<Event> eventList = Streams.stream(events) .filter(Objects::nonNull) .collect(toImmutableList()); if (eventList.isEmpty()) { return; } Event event = eventList.get(0); TenantAwareOperation op = new EventOperation(event) { @Override public void run() { if (isTenantSet()) { ensureSameTenant(eventList); } store(eventList); } }; op.execute(); log.stored(events); } DefaultEventStore(); @Override @SuppressWarnings({"OverridingMethodsMustInvokeSuper", "MissingSuperCall"}) // see impl. note void registerWith(BoundedContext context); @Override void append(Event event); @Override void appendAll(Iterable<Event> events); @Override void read(EventStreamQuery request, StreamObserver<Event> responseObserver);  }