@Test void testSendDeliversMessageAtDescribedAggregateInstance() throws Exception { String testAggregateId = "some-identifier"; DeadlineMessage<DeadlinePayload> testMsg = GenericDeadlineMessage.asDeadlineMessage("deadline-name", new DeadlinePayload(), Instant.now()); AggregateScopeDescriptor testDescriptor = new AggregateScopeDescriptor(StubAggregate.class.getSimpleName(), testAggregateId); Repository<StubAggregate> testRepository = testSubject.createRepository(mockEventStore, new GenericAggregateFactory<>(StubAggregate.class), snapshotTriggerDefinition, ClasspathParameterResolverFactory.forClass(StubAggregate.class)); when(mockEventStore.readEvents(any())) .thenReturn(DomainEventStream.of(new GenericDomainEventMessage<>( StubAggregate.class.getSimpleName(), testAggregateId, 0, testAggregateId ))); commandHandlingEntry.start(); try { testRepository.send(testMsg, testDescriptor); } finally { commandHandlingEntry.pause(); } assertEquals(1, messageHandlingCounter.get()); }
@SuppressWarnings("unchecked") public <T> Repository<T> createRepository(EventStore eventStore, AggregateFactory<T> aggregateFactory, SnapshotTriggerDefinition snapshotTriggerDefinition, ParameterResolverFactory parameterResolverFactory) { return createRepository(eventStore, null, aggregateFactory, snapshotTriggerDefinition, parameterResolverFactory, ClasspathHandlerDefinition.forClass(aggregateFactory.getAggregateType())); }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @SuppressWarnings("unchecked") public <T> Repository<T> createRepository(EventStore eventStore, AggregateFactory<T> aggregateFactory, SnapshotTriggerDefinition snapshotTriggerDefinition, ParameterResolverFactory parameterResolverFactory) { return createRepository(eventStore, null, aggregateFactory, snapshotTriggerDefinition, parameterResolverFactory, ClasspathHandlerDefinition.forClass(aggregateFactory.getAggregateType())); } }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @SuppressWarnings("unchecked") public <T> Repository<T> createRepository(EventStore eventStore, AggregateFactory<T> aggregateFactory, SnapshotTriggerDefinition snapshotTriggerDefinition, ParameterResolverFactory parameterResolverFactory) { return createRepository(eventStore, null, aggregateFactory, snapshotTriggerDefinition, parameterResolverFactory, ClasspathHandlerDefinition.forClass(aggregateFactory.getAggregateType())); } CommandHandlerInvoker(Cache cache, int segmentId); }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @SuppressWarnings("unchecked") public <T> Repository<T> createRepository(EventStore eventStore, AggregateFactory<T> aggregateFactory, SnapshotTriggerDefinition snapshotTriggerDefinition, ParameterResolverFactory parameterResolverFactory) { return createRepository(eventStore, null, aggregateFactory, snapshotTriggerDefinition, parameterResolverFactory, ClasspathHandlerDefinition.forClass(aggregateFactory.getAggregateType())); } CommandHandlerInvoker(Cache cache, int segmentId); @SuppressWarnings("unchecked") static DisruptorRepository<T> getRepository(Class<?> type); @Override void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              RepositoryProvider repositoryProvider,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory,
                                              HandlerDefinition handlerDefinition); @Override void onStart(); @Override void onShutdown(); }
CommandHandlerInvoker implements EventHandler<CommandHandlingEntry>, LifecycleAware { @SuppressWarnings("unchecked") public <T> Repository<T> createRepository(EventStore eventStore, AggregateFactory<T> aggregateFactory, SnapshotTriggerDefinition snapshotTriggerDefinition, ParameterResolverFactory parameterResolverFactory) { return createRepository(eventStore, null, aggregateFactory, snapshotTriggerDefinition, parameterResolverFactory, ClasspathHandlerDefinition.forClass(aggregateFactory.getAggregateType())); } CommandHandlerInvoker(Cache cache, int segmentId); @SuppressWarnings("unchecked") static DisruptorRepository<T> getRepository(Class<?> type); @Override void onEvent(CommandHandlingEntry entry, long sequence, boolean endOfBatch); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory); @SuppressWarnings("unchecked") Repository<T> createRepository(EventStore eventStore,
                                              RepositoryProvider repositoryProvider,
                                              AggregateFactory<T> aggregateFactory,
                                              SnapshotTriggerDefinition snapshotTriggerDefinition,
                                              ParameterResolverFactory parameterResolverFactory,
                                              HandlerDefinition handlerDefinition); @Override void onStart(); @Override void onShutdown();  }