Search in sources :

Example 1 with RejectionBus

use of io.spine.server.rejection.RejectionBus in project core-java by SpineEventEngine.

the class IntegrationBusBuilderShould method return_previously_set_RejectionBus.

@Test
public void return_previously_set_RejectionBus() {
    final RejectionBus mock = mock(RejectionBus.class);
    assertEquals(mock, builder().setRejectionBus(mock).getRejectionBus().get());
}
Also used : RejectionBus(io.spine.server.rejection.RejectionBus) Test(org.junit.Test)

Example 2 with RejectionBus

use of io.spine.server.rejection.RejectionBus 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)

Example 3 with RejectionBus

use of io.spine.server.rejection.RejectionBus in project core-java by SpineEventEngine.

the class MultiTenantCommandBusShould method allow_to_specify_rejection_bus_via_builder.

@Test
public void allow_to_specify_rejection_bus_via_builder() {
    final RejectionBus expectedRejectionBus = mock(RejectionBus.class);
    final CommandBus commandBus = CommandBus.newBuilder().setCommandStore(commandStore).setRejectionBus(expectedRejectionBus).build();
    assertNotNull(commandBus);
    final RejectionBus actualRejectionBus = commandBus.rejectionBus();
    assertEquals(expectedRejectionBus, actualRejectionBus);
}
Also used : RejectionBus(io.spine.server.rejection.RejectionBus) Test(org.junit.Test)

Example 4 with RejectionBus

use of io.spine.server.rejection.RejectionBus in project core-java by SpineEventEngine.

the class CommandBusBuilderShould method allow_to_specify_rejeciton_bus.

@Test
public void allow_to_specify_rejeciton_bus() {
    final RejectionBus expectedRejectionBus = mock(RejectionBus.class);
    final CommandBus.Builder builder = builder().setCommandStore(commandStore).setRejectionBus(expectedRejectionBus);
    assertEquals(expectedRejectionBus, builder.getRejectionBus().get());
}
Also used : RejectionBus(io.spine.server.rejection.RejectionBus) TenantAwareTest(io.spine.server.tenant.TenantAwareTest) Test(org.junit.Test)

Aggregations

RejectionBus (io.spine.server.rejection.RejectionBus)4 Test (org.junit.Test)4 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 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)1