Search in sources :

Example 1 with BoundedContext

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

the class BoundedContextShould method set_storage_factory_for_EventBus.

@Test
public void set_storage_factory_for_EventBus() {
    final BoundedContext bc = BoundedContext.newBuilder().setEventBus(EventBus.newBuilder()).build();
    assertNotNull(bc.getEventBus());
}
Also used : BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Example 2 with BoundedContext

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

the class BoundedContextShould method do_not_set_storage_factory_if_EventStore_is_set.

@Test
public void do_not_set_storage_factory_if_EventStore_is_set() {
    final EventStore eventStore = mock(EventStore.class);
    final BoundedContext bc = BoundedContext.newBuilder().setEventBus(EventBus.newBuilder().setEventStore(eventStore)).build();
    assertEquals(eventStore, bc.getEventBus().getEventStore());
}
Also used : EventStore(io.spine.server.event.EventStore) BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Example 3 with BoundedContext

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

the class BoundedContextShould method set_same_multitenancy_in_Stand.

@Test
public void set_same_multitenancy_in_Stand() {
    BoundedContext bc = BoundedContext.newBuilder().setMultitenant(true).build();
    assertEquals(bc.isMultitenant(), bc.getStand().isMultitenant());
    bc = BoundedContext.newBuilder().setMultitenant(false).build();
    assertEquals(bc.isMultitenant(), bc.getStand().isMultitenant());
}
Also used : BoundedContext(io.spine.server.BoundedContext) Test(org.junit.Test)

Example 4 with BoundedContext

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

the class EventBusBuilderShould method setUp.

@Before
public void setUp() {
    final BoundedContext bc = BoundedContext.newBuilder().setMultitenant(true).build();
    this.storageFactory = bc.getStorageFactory();
}
Also used : BoundedContext(io.spine.server.BoundedContext) Before(org.junit.Before)

Example 5 with BoundedContext

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

the class IntegrationBusShould method dispatch_events_from_one_BC_to_entities_with_ext_subscribers_of_multiple_BCs.

@Test
public void dispatch_events_from_one_BC_to_entities_with_ext_subscribers_of_multiple_BCs() {
    final InMemoryTransportFactory transportFactory = InMemoryTransportFactory.newInstance();
    final Set<BoundedContextName> destinationNames = newHashSet();
    final BoundedContext sourceContext = contextWithTransport(transportFactory);
    for (int i = 0; i < 42; i++) {
        final BoundedContext destinationCtx = contextWithContextAwareEntitySubscriber(transportFactory);
        final BoundedContextName name = destinationCtx.getName();
        destinationNames.add(name);
    }
    assertTrue(ContextAwareProjectDetails.getExternalContexts().isEmpty());
    final Event event = projectCreated();
    sourceContext.getEventBus().post(event);
    assertEquals(destinationNames.size(), ContextAwareProjectDetails.getExternalContexts().size());
    assertEquals(destinationNames.size(), ContextAwareProjectDetails.getExternalEvents().size());
}
Also used : InMemoryTransportFactory(io.spine.server.integration.memory.InMemoryTransportFactory) Event(io.spine.core.Event) BoundedContext(io.spine.server.BoundedContext) BoundedContextName(io.spine.core.BoundedContextName) Test(org.junit.Test)

Aggregations

BoundedContext (io.spine.server.BoundedContext)58 Test (org.junit.Test)34 Event (io.spine.core.Event)12 InMemoryTransportFactory (io.spine.server.integration.memory.InMemoryTransportFactory)12 Before (org.junit.Before)9 Rejection (io.spine.core.Rejection)6 Ack (io.spine.core.Ack)5 Message (com.google.protobuf.Message)4 Error (io.spine.base.Error)4 TypeUrl (io.spine.type.TypeUrl)4 Any (com.google.protobuf.Any)3 StringValue (com.google.protobuf.StringValue)3 Command (io.spine.core.Command)3 CommandEnvelope (io.spine.core.CommandEnvelope)3 TenantId (io.spine.core.TenantId)3 CustomerAggregateRepository (io.spine.server.Given.CustomerAggregateRepository)3 EventBus (io.spine.server.event.EventBus)3 StandTestProjectionRepository (io.spine.server.stand.Given.StandTestProjectionRepository)3 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)3 NullPointerTester (com.google.common.testing.NullPointerTester)2