@Test public void orderInEventStore() { configuration.commandGateway().sendAndWait(command); assertEquals(expectedDescriptions(command), configuration.eventStore() .readEvents(aggregateIdentifier) .asStream() .map(Message::getPayload) .map(MyEvent.class::cast) .map(MyEvent::getDescription) .collect(Collectors.toList())); }
@Test public void testDeadlineWithSpecifiedDeadlineNameOnSaga() { String expectedDeadlinePayload = "deadlinePayload"; configuration.eventStore().publish(asEventMessage(new SagaStartingEvent(IDENTIFIER, CANCEL_BEFORE_DEADLINE))); configuration.eventStore().publish(asEventMessage( new ScheduleSpecificDeadline(IDENTIFIER, expectedDeadlinePayload)) ); assertPublishedEvents(new SagaStartingEvent(IDENTIFIER, CANCEL_BEFORE_DEADLINE), new ScheduleSpecificDeadline(IDENTIFIER, expectedDeadlinePayload), new SpecificDeadlineOccurredEvent(expectedDeadlinePayload)); }
@Test public void testDeadlineWithoutPayloadOnSaga() { configuration.eventStore().publish(asEventMessage(new SagaStartingEvent(IDENTIFIER, CANCEL_BEFORE_DEADLINE))); configuration.eventStore().publish(asEventMessage(new ScheduleSpecificDeadline(IDENTIFIER, null))); assertPublishedEvents(new SagaStartingEvent(IDENTIFIER, CANCEL_BEFORE_DEADLINE), new ScheduleSpecificDeadline(IDENTIFIER, null), new SpecificDeadlineOccurredEvent(null)); }
@Test public void testDeadlineCancellationOnSaga() { configuration.eventStore().publish(asEventMessage(new SagaStartingEvent(IDENTIFIER, CANCEL_BEFORE_DEADLINE))); assertPublishedEvents(new SagaStartingEvent(IDENTIFIER, CANCEL_BEFORE_DEADLINE)); }
@Test public void testDeadlineOnSaga() { EventMessage<Object> testEventMessage = asEventMessage(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE)); configuration.eventStore().publish(testEventMessage); assertPublishedEvents(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE), new DeadlineOccurredEvent(new DeadlinePayload(IDENTIFIER))); }
return ((DisruptorCommandBus) c.commandBus()).createRepository(c.eventStore(), aggregateFactory.get(), snapshotTriggerDefinition.get(), .aggregateModel(metaModel.get()) .aggregateFactory(aggregateFactory.get()) .eventStore(c.eventStore()) .snapshotTriggerDefinition(snapshotTriggerDefinition.get()) .repositoryProvider(c::repository)
@Test public void testDispatchInterceptorOnSaga() { EventMessage<Object> testEventMessage = asEventMessage(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE)); configuration.deadlineManager().registerDispatchInterceptor(messages -> (i, m) -> GenericDeadlineMessage.asDeadlineMessage(m.getDeadlineName(), new DeadlinePayload("fakeId"))); configuration.eventStore().publish(testEventMessage); assertPublishedEvents(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE), new DeadlineOccurredEvent(new DeadlinePayload("fakeId"))); }
@Test public void testHandlerInterceptorOnSaga() { EventMessage<Object> testEventMessage = asEventMessage(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE)); configuration.deadlineManager().registerHandlerInterceptor((uow, chain) -> { uow.transformMessage(deadlineMessage -> GenericDeadlineMessage .asDeadlineMessage(deadlineMessage.getDeadlineName(), new DeadlinePayload("fakeId"))); return chain.proceed(); }); configuration.eventStore().publish(testEventMessage); assertPublishedEvents(new SagaStartingEvent(IDENTIFIER, DO_NOT_CANCEL_BEFORE_DEADLINE), new DeadlineOccurredEvent(new DeadlinePayload("fakeId"))); }
aggregate.toString()); if (c.commandBus() instanceof DisruptorCommandBus) { return ((DisruptorCommandBus) c.commandBus()).createRepository(c.eventStore(), aggregateFactory.get(), snapshotTriggerDefinition.get(), c.eventStore(), snapshotTriggerDefinition.get(), c::repository);
return ((DisruptorCommandBus) c.commandBus()).createRepository(c.eventStore(), aggregateFactory.get(), snapshotTriggerDefinition.get(), .aggregateModel(metaModel.get()) .aggregateFactory(aggregateFactory.get()) .eventStore(c.eventStore()) .snapshotTriggerDefinition(snapshotTriggerDefinition.get()) .repositoryProvider(c::repository)