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