use of io.spine.server.rejection.RejectionSubscriber in project core-java by SpineEventEngine.
the class IntegrationBusTestEnv method contextWithExternalSubscribers.
public static BoundedContext contextWithExternalSubscribers(TransportFactory transportFactory) {
final BoundedContext boundedContext = contextWithTransport(transportFactory);
final EventSubscriber eventSubscriber = new ProjectEventsSubscriber();
boundedContext.getIntegrationBus().register(eventSubscriber);
boundedContext.getEventBus().register(eventSubscriber);
final RejectionSubscriber rejectionSubscriber = new ProjectRejectionsExtSubscriber();
boundedContext.getRejectionBus().register(rejectionSubscriber);
boundedContext.getIntegrationBus().register(rejectionSubscriber);
boundedContext.register(new ProjectCountAggregateRepository());
boundedContext.register(new ProjectWizardRepository());
return boundedContext;
}
use of io.spine.server.rejection.RejectionSubscriber in project core-java by SpineEventEngine.
the class IntegrationBusShould method throw_on_mismatch_of_external_attribute_during_dispatching.
@Test
public void throw_on_mismatch_of_external_attribute_during_dispatching() {
final InMemoryTransportFactory transportFactory = InMemoryTransportFactory.newInstance();
final BoundedContext sourceContext = contextWithTransport(transportFactory);
final RejectionSubscriber rejectionSubscriber = new ExternalMismatchSubscriber();
sourceContext.getRejectionBus().register(rejectionSubscriber);
sourceContext.getIntegrationBus().register(rejectionSubscriber);
final Rejection rejection = cannotStartArchivedProject();
try {
sourceContext.getRejectionBus().post(rejection);
fail("An exception is expected.");
} catch (Exception e) {
final String exceptionMsg = e.getMessage();
assertContains("external", exceptionMsg);
}
}
Aggregations