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());
}
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());
}
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());
}
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);
}
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());
}
Aggregations