use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.
the class IntegrationBusShould method dispatch_rejections_from_one_BC_to_external_subscribers_of_another_BC.
@Test
public void dispatch_rejections_from_one_BC_to_external_subscribers_of_another_BC() {
final InMemoryTransportFactory transportFactory = InMemoryTransportFactory.newInstance();
final BoundedContext sourceContext = contextWithTransport(transportFactory);
contextWithExternalSubscribers(transportFactory);
assertNull(ProjectRejectionsExtSubscriber.getExternalRejection());
assertNull(ProjectCountAggregate.getExternalRejection());
assertNull(ProjectWizard.getExternalRejection());
final Rejection rejection = cannotStartArchivedProject();
sourceContext.getRejectionBus().post(rejection);
final Message rejectionMessage = AnyPacker.unpack(rejection.getMessage());
assertEquals(rejectionMessage, ProjectRejectionsExtSubscriber.getExternalRejection());
assertEquals(rejectionMessage, ProjectCountAggregate.getExternalRejection());
assertEquals(rejectionMessage, ProjectWizard.getExternalRejection());
}
use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.
the class IntegrationBusShould method avoid_dispatching_events_from_one_BC_to_domestic_entity_subscribers_of_another_BC.
@Test
public void avoid_dispatching_events_from_one_BC_to_domestic_entity_subscribers_of_another_BC() {
final InMemoryTransportFactory transportFactory = InMemoryTransportFactory.newInstance();
final BoundedContext sourceContext = contextWithTransport(transportFactory);
final BoundedContext destContext = contextWithExtEntitySubscribers(transportFactory);
assertNull(ProjectDetails.getDomesticEvent());
final Event event = projectStarted();
sourceContext.getEventBus().post(event);
assertNotEquals(AnyPacker.unpack(event.getMessage()), ProjectDetails.getDomesticEvent());
assertNull(ProjectDetails.getDomesticEvent());
destContext.getEventBus().post(event);
assertEquals(AnyPacker.unpack(event.getMessage()), ProjectDetails.getDomesticEvent());
}
use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.
the class IntegrationBusTestEnv method contextWithProjectCreatedNeeds.
public static BoundedContext contextWithProjectCreatedNeeds(TransportFactory factory) {
final BoundedContext result = contextWithTransport(factory);
result.getIntegrationBus().register(new ProjectEventsSubscriber());
return result;
}
use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.
the class IntegrationBusTestEnv method contextWithContextAwareEntitySubscriber.
public static BoundedContext contextWithContextAwareEntitySubscriber(TransportFactory transportFactory) {
final BoundedContext boundedContext = contextWithTransport(transportFactory);
boundedContext.register(new ContextAwareProjectDetailsRepository());
return boundedContext;
}
use of io.spine.server.BoundedContext in project core-java by SpineEventEngine.
the class IntegrationBusTestEnv method contextWithProjectStartedNeeds.
public static BoundedContext contextWithProjectStartedNeeds(TransportFactory factory) {
final BoundedContext result = contextWithTransport(factory);
result.getIntegrationBus().register(new ProjectStartedExtSubscriber());
return result;
}
Aggregations