Search in sources :

Example 1 with BoundedContextName

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

the class BoundedContext method newName.

/**
 * Creates a new value object for a bounded context name.
 *
 * <p>The {@code name} argument value must not be {@code null} or empty.
 *
 * <p>This method, however, does not check for the uniqueness of the value passed.
 *
 * @param name the unique string name of the {@code BoundedContext}
 * @return a newly created name
 */
public static BoundedContextName newName(String name) {
    checkNotEmptyOrBlank(name, "name");
    final BoundedContextName result = BoundedContextName.newBuilder().setValue(name).build();
    return result;
}
Also used : BoundedContextName(io.spine.core.BoundedContextName)

Example 2 with BoundedContextName

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

the class AbstractChannelObserver method onNext.

@Override
public final void onNext(ExternalMessage message) {
    checkNotNull(message);
    final BoundedContextName source = message.getBoundedContextName();
    if (this.boundedContextName.equals(source)) {
        return;
    }
    handle(message);
}
Also used : BoundedContextName(io.spine.core.BoundedContextName)

Example 3 with BoundedContextName

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

the class ConfigurationChangeObserver method handle.

@Override
public void handle(ExternalMessage value) {
    final RequestForExternalMessages request = AnyPacker.unpack(value.getOriginalMessage());
    final BoundedContextName origin = value.getBoundedContextName();
    addNewSubscriptions(request.getRequestedMessageTypesList(), origin);
    clearStaleSubscriptions(request.getRequestedMessageTypesList(), origin);
}
Also used : BoundedContextName(io.spine.core.BoundedContextName)

Example 4 with BoundedContextName

use of io.spine.core.BoundedContextName 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)

Example 5 with BoundedContextName

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

the class StorageSpecShould method provide_equals_based_on_values.

@Test
public void provide_equals_based_on_values() {
    final BoundedContextName bcName = newName(getClass().getName());
    new EqualsTester().addEqualityGroup(StorageSpec.of(bcName, TypeUrl.of(StringValue.class), String.class), StorageSpec.of(bcName, TypeUrl.of(StringValue.class), String.class)).addEqualityGroup(StorageSpec.of(bcName, TypeUrl.of(Timestamp.class), Integer.class), StorageSpec.of(bcName, TypeUrl.of(Timestamp.class), Integer.class)).testEquals();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) Timestamp(com.google.protobuf.Timestamp) BoundedContextName(io.spine.core.BoundedContextName) Test(org.junit.Test)

Aggregations

BoundedContextName (io.spine.core.BoundedContextName)8 Test (org.junit.Test)5 Event (io.spine.core.Event)2 BoundedContext (io.spine.server.BoundedContext)2 InMemoryTransportFactory (io.spine.server.integration.memory.InMemoryTransportFactory)2 EqualsTester (com.google.common.testing.EqualsTester)1 Timestamp (com.google.protobuf.Timestamp)1 Error (io.spine.base.Error)1 Ack (io.spine.core.Ack)1 TypeUrl (io.spine.type.TypeUrl)1