test_class.declarator: context
test_class.modifier: private
test_class.original_string: private BoundedContext context;
test_class.type: BoundedContext
test_class.var_name: context
test_class.declarator: eventStore
test_class.modifier: private
test_class.original_string: private EventStore eventStore;
test_class.type: EventStore
test_class.var_name: eventStore
test_class.declarator: executor
test_class.modifier: private
test_class.original_string: private ExecutorService executor;
test_class.type: ExecutorService
test_class.var_name: executor
test_class.file: server/src/test/java/io/spine/server/event/store/DefaultEventStoreTest.java
test_class.identifier: DefaultEventStoreTest
test_case.body: @Test
      @DisplayName("fail to store events of different tenants in single operation")
      void rejectEventsFromDifferentTenants() {
          TenantId firstTenantId = TenantId
                  .newBuilder()
                  .setValue("abc")
                  .buildPartial();
          TenantId secondTenantId = TenantId
                  .newBuilder()
                  .setValue("xyz")
                  .buildPartial();
          ActorContext firstTenantActor = ActorContext
                  .newBuilder()
                  .setTenantId(firstTenantId)
                  .buildPartial();
          ActorContext secondTenantActor = ActorContext
                  .newBuilder()
                  .setTenantId(secondTenantId)
                  .buildPartial();
          Origin firstTenantOrigin = Origin
                  .newBuilder()
                  .setActorContext(firstTenantActor)
                  .buildPartial();
          Origin secondTenantOrigin = Origin
                  .newBuilder()
                  .setActorContext(secondTenantActor)
                  .buildPartial();
          EventContext firstTenantContext = EventContext
                  .newBuilder()
                  .setPastMessage(firstTenantOrigin)
                  .buildPartial();
          EventContext secondTenantContext = EventContext
                  .newBuilder()
                  .setPastMessage(secondTenantOrigin)
                  .buildPartial();
          Event firstTenantEvent = Event
                  .newBuilder()
                  .setContext(firstTenantContext)
                  .buildPartial();
          Event secondTenantEvent = Event
                  .newBuilder()
                  .setContext(secondTenantContext)
                  .buildPartial();
          Collection<Event> event = ImmutableSet.of(firstTenantEvent, secondTenantEvent);
  
          assertThrows(IllegalArgumentException.class, () -> eventStore.appendAll(event));
      }
test_case.class_method_signature: DefaultEventStoreTest.rejectEventsFromDifferentTenants()
test_case.full_signature: @Test @DisplayName("fail to store events of different tenants in single operation") void rejectEventsFromDifferentTenants()
test_case.identifier: rejectEventsFromDifferentTenants
test_case.invocations: buildPartial setValue newBuilder buildPartial setValue newBuilder buildPartial setTenantId newBuilder buildPartial setTenantId newBuilder buildPartial setActorContext newBuilder buildPartial setActorContext newBuilder buildPartial setPastMessage newBuilder buildPartial setPastMessage newBuilder buildPartial setContext newBuilder buildPartial setContext newBuilder of assertThrows appendAll
test_case.modifiers: @Test @DisplayName("fail to store events of different tenants in single operation")
test_case.parameters: ()
test_case.return: void
test_case.signature: void rejectEventsFromDifferentTenants()
focal_class.declarator: TENANT_MISMATCH_ERROR_MSG =
              "Events, that target different tenants, cannot be stored in a single operation. " +
                      System.lineSeparator() +
                      "Observed tenants are: %s."
focal_class.modifier: private static final
focal_class.original_string: private static final String TENANT_MISMATCH_ERROR_MSG =
              "Events, that target different tenants, cannot be stored in a single operation. " +
                      System.lineSeparator() +
                      "Observed tenants are: %s.";
focal_class.type: String
focal_class.var_name: TENANT_MISMATCH_ERROR_MSG
focal_class.declarator: log
focal_class.modifier: private final
focal_class.original_string: private final Log log;
focal_class.type: Log
focal_class.var_name: log
focal_class.file: server/src/main/java/io/spine/server/event/store/DefaultEventStore.java
focal_class.identifier: DefaultEventStore
focal_class.interfaces: implements EventStore
focal_class.class_method_signature: DefaultEventStore.DefaultEventStore()
focal_class.full_signature: public  DefaultEventStore()
focal_class.identifier: DefaultEventStore
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  DefaultEventStore()
focal_class.class_method_signature: DefaultEventStore.registerWith(BoundedContext context)
focal_class.full_signature: @Override @SuppressWarnings({"OverridingMethodsMustInvokeSuper", "MissingSuperCall"}) // see impl. note public void registerWith(BoundedContext context)
focal_class.identifier: registerWith
focal_class.modifiers: @Override @SuppressWarnings({"OverridingMethodsMustInvokeSuper", "MissingSuperCall"}) // see impl. note public
focal_class.parameters: (BoundedContext context)
focal_class.return: void
focal_class.signature: void registerWith(BoundedContext context)
focal_class.class_method_signature: DefaultEventStore.append(Event event)
focal_class.full_signature: @Override public void append(Event event)
focal_class.identifier: append
focal_class.modifiers: @Override public
focal_class.parameters: (Event event)
focal_class.return: void
focal_class.signature: void append(Event event)
focal_class.class_method_signature: DefaultEventStore.appendAll(Iterable<Event> events)
focal_class.full_signature: @Override public void appendAll(Iterable<Event> events)
focal_class.identifier: appendAll
focal_class.modifiers: @Override public
focal_class.parameters: (Iterable<Event> events)
focal_class.return: void
focal_class.signature: void appendAll(Iterable<Event> events)
focal_class.class_method_signature: DefaultEventStore.ensureSameTenant(ImmutableList<Event> events)
focal_class.full_signature: private static void ensureSameTenant(ImmutableList<Event> events)
focal_class.identifier: ensureSameTenant
focal_class.modifiers: private static
focal_class.parameters: (ImmutableList<Event> events)
focal_class.return: void
focal_class.signature: void ensureSameTenant(ImmutableList<Event> events)
focal_class.class_method_signature: DefaultEventStore.read(EventStreamQuery request, StreamObserver<Event> responseObserver)
focal_class.full_signature: @Override public void read(EventStreamQuery request, StreamObserver<Event> responseObserver)
focal_class.identifier: read
focal_class.modifiers: @Override public
focal_class.parameters: (EventStreamQuery request, StreamObserver<Event> responseObserver)
focal_class.return: void
focal_class.signature: void read(EventStreamQuery request, StreamObserver<Event> responseObserver)
focal_class.class_method_signature: DefaultEventStore.iterator(EventStreamQuery query)
focal_class.full_signature: private Iterator<Event> iterator(EventStreamQuery query)
focal_class.identifier: iterator
focal_class.modifiers: private
focal_class.parameters: (EventStreamQuery query)
focal_class.return: Iterator<Event>
focal_class.signature: Iterator<Event> iterator(EventStreamQuery query)
focal_class.class_method_signature: DefaultEventStore.isTypeSupplier()
focal_class.full_signature: @Override protected boolean isTypeSupplier()
focal_class.identifier: isTypeSupplier
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isTypeSupplier()
focal_class.class_method_signature: DefaultEventStore.find(EventStreamQuery query)
focal_class.full_signature: private Iterator<EEntity> find(EventStreamQuery query)
focal_class.identifier: find
focal_class.modifiers: private
focal_class.parameters: (EventStreamQuery query)
focal_class.return: Iterator<EEntity>
focal_class.signature: Iterator<EEntity> find(EventStreamQuery query)
focal_class.class_method_signature: DefaultEventStore.formatFrom(EventStreamQuery query)
focal_class.full_signature: private static ResponseFormat formatFrom(EventStreamQuery query)
focal_class.identifier: formatFrom
focal_class.modifiers: private static
focal_class.parameters: (EventStreamQuery query)
focal_class.return: ResponseFormat
focal_class.signature: ResponseFormat formatFrom(EventStreamQuery query)
focal_class.class_method_signature: DefaultEventStore.store(Event event)
focal_class.full_signature: private void store(Event event)
focal_class.identifier: store
focal_class.modifiers: private
focal_class.parameters: (Event event)
focal_class.return: void
focal_class.signature: void store(Event event)
focal_class.class_method_signature: DefaultEventStore.store(Iterable<Event> events)
focal_class.full_signature: private void store(Iterable<Event> events)
focal_class.identifier: store
focal_class.modifiers: private
focal_class.parameters: (Iterable<Event> events)
focal_class.return: void
focal_class.signature: void store(Iterable<Event> events)
focal_class.superclass: extends DefaultRecordBasedRepository<EventId, EEntity, Event>
focal_method.body: @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()) { // If multitenant context
                      ensureSameTenant(eventList);
                  }
                  store(eventList);
              }
          };
          op.execute();
  
          log.stored(events);
      }
focal_method.class_method_signature: DefaultEventStore.appendAll(Iterable<Event> events)
focal_method.full_signature: @Override public void appendAll(Iterable<Event> events)
focal_method.identifier: appendAll
focal_method.invocations: checkNotNull collect filter stream toImmutableList isEmpty get isTenantSet ensureSameTenant store execute stored
focal_method.modifiers: @Override public
focal_method.parameters: (Iterable<Event> events)
focal_method.return: void
focal_method.signature: void appendAll(Iterable<Event> events)