Search in sources :

Example 16 with BoundedContext

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

the class BoundedContextBuilderShould method create_both_CommandBus_and_EventBus_if_not_set.

@Test
public void create_both_CommandBus_and_EventBus_if_not_set() {
    final BoundedContext boundedContext = builder.build();
    assertNotNull(boundedContext.getCommandBus());
    assertNotNull(boundedContext.getEventBus());
}
Also used : BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Example 17 with BoundedContext

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

the class BoundedContextBuilderShould method create_EventBus_if_it_was_not_set.

@Test
public void create_EventBus_if_it_was_not_set() {
    // Pass CommandBus.Builder to builder initialization, and do NOT pass EventBus.
    final BoundedContext boundedContext = builder.setMultitenant(true).setCommandBus(CommandBus.newBuilder()).build();
    assertNotNull(boundedContext.getEventBus());
}
Also used : BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Example 18 with BoundedContext

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

the class BoundedContextBuilderShould method create_CommandBus_if_it_was_not_set.

@Test
public void create_CommandBus_if_it_was_not_set() {
    // Pass EventBus to builder initialization, and do NOT pass CommandBus.
    final BoundedContext boundedContext = builder.setEventBus(EventBus.newBuilder()).build();
    assertNotNull(boundedContext.getCommandBus());
}
Also used : BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Example 19 with BoundedContext

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

the class BoundedContextShould method not_notify_integration_event_subscriber_if_event_is_invalid.

@Test
public void not_notify_integration_event_subscriber_if_event_is_invalid() {
    final BoundedContext boundedContext = TestBoundedContextFactory.MultiTenant.newBoundedContext();
    final TestEventSubscriber sub = new TestEventSubscriber();
    boundedContext.getEventBus().register(sub);
    final Any invalidMsg = AnyPacker.pack(ProjectCreated.getDefaultInstance());
    final IntegrationEvent event = Given.AnIntegrationEvent.projectCreated().toBuilder().setMessage(invalidMsg).build();
    boundedContext.notify(event, new TestResponseObserver());
    assertNull(sub.eventHandled);
}
Also used : IntegrationEvent(io.spine.server.integration.IntegrationEvent) BoundedContext(io.spine.server.BoundedContext) Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 20 with BoundedContext

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

the class BoundedContextShould method tell_if_set_multitenant.

@Test
public void tell_if_set_multitenant() {
    final BoundedContext bc = BoundedContext.newBuilder().setMultitenant(true).build();
    assertTrue(bc.isMultitenant());
}
Also used : BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Aggregations

BoundedContext (io.spine.server.BoundedContext)26 Test (org.junit.Test)16 Before (org.junit.Before)5 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)4 StreamObserver (io.grpc.stub.StreamObserver)3 MemoizingObserver (io.spine.io.StreamObservers.MemoizingObserver)3 StreamObservers.memoizingObserver (io.spine.io.StreamObservers.memoizingObserver)3 StreamObservers.noOpObserver (io.spine.io.StreamObservers.noOpObserver)3 StandTestProjectionRepository (io.spine.server.stand.Given.StandTestProjectionRepository)3 NullPointerTester (com.google.common.testing.NullPointerTester)2 Any (com.google.protobuf.Any)2 Version (io.spine.base.Version)2 CommandEnvelope (io.spine.envelope.CommandEnvelope)2 CommandBus (io.spine.server.commandbus.CommandBus)2 EventStore (io.spine.server.event.EventStore)2 ProjectionRepository (io.spine.server.projection.ProjectionRepository)2 ProjectId (io.spine.test.projection.ProjectId)2 MultiTenant.newBoundedContext (io.spine.testdata.TestBoundedContextFactory.MultiTenant.newBoundedContext)2 TypeUrl (io.spine.type.TypeUrl)2 Executor (java.util.concurrent.Executor)2