use of io.spine.server.integration.memory.InMemoryTransportFactory 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.integration.memory.InMemoryTransportFactory 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());
}
Aggregations