Search in sources :

Example 1 with ProjectRejectionsExtSubscriber

use of io.spine.server.integration.given.IntegrationBusTestEnv.ProjectRejectionsExtSubscriber in project core-java by SpineEventEngine.

the class IntegrationBusShould method not_dispatch_rejections_to_domestic_subscribers_if_they_requested_external.

@Test
public void not_dispatch_rejections_to_domestic_subscribers_if_they_requested_external() {
    final InMemoryTransportFactory transportFactory = InMemoryTransportFactory.newInstance();
    final BoundedContext sourceContext = contextWithExtEntitySubscribers(transportFactory);
    final ProjectRejectionsExtSubscriber standaloneSubscriber = new ProjectRejectionsExtSubscriber();
    final RejectionBus rejectionBus = sourceContext.getRejectionBus();
    rejectionBus.register(standaloneSubscriber);
    assertNull(ProjectRejectionsExtSubscriber.getExternalRejection());
    assertNull(ProjectWizard.getExternalRejection());
    assertNull(ProjectCountAggregate.getExternalRejection());
    final Rejection rejection = cannotStartArchivedProject();
    rejectionBus.post(rejection);
    assertNull(ProjectRejectionsExtSubscriber.getExternalRejection());
    assertNull(ProjectWizard.getExternalRejection());
    assertNull(ProjectCountAggregate.getExternalRejection());
}
Also used : Rejection(io.spine.core.Rejection) InMemoryTransportFactory(io.spine.server.integration.memory.InMemoryTransportFactory) BoundedContext(io.spine.server.BoundedContext) RejectionBus(io.spine.server.rejection.RejectionBus) ProjectRejectionsExtSubscriber(io.spine.server.integration.given.IntegrationBusTestEnv.ProjectRejectionsExtSubscriber) Test(org.junit.Test)

Aggregations

Rejection (io.spine.core.Rejection)1 BoundedContext (io.spine.server.BoundedContext)1 ProjectRejectionsExtSubscriber (io.spine.server.integration.given.IntegrationBusTestEnv.ProjectRejectionsExtSubscriber)1 InMemoryTransportFactory (io.spine.server.integration.memory.InMemoryTransportFactory)1 RejectionBus (io.spine.server.rejection.RejectionBus)1 Test (org.junit.Test)1