use of io.spine.core.BoundedContextName in project core-java by SpineEventEngine.
the class StorageSpecShould method create_new_instances.
@Test
public void create_new_instances() {
final BoundedContextName bcName = newName(getClass().getName());
final TypeUrl stateUrl = TypeUrl.of(StringValue.class);
final Class<Long> idClass = Long.class;
final StorageSpec<Long> spec = StorageSpec.of(bcName, stateUrl, idClass);
assertEquals(bcName, spec.getBoundedContextName());
assertEquals(stateUrl, spec.getEntityStateUrl());
assertEquals(idClass, spec.getIdClass());
}
use of io.spine.core.BoundedContextName in project core-java by SpineEventEngine.
the class IntegrationBusBuilderShould method return_previously_set_BoundedContextName.
@Test
public void return_previously_set_BoundedContextName() {
final BoundedContextName name = BoundedContext.newName("Name that is expected back from the Builder");
assertEquals(name, builder().setBoundedContextName(name).getBoundedContextName().get());
}
use of io.spine.core.BoundedContextName in project core-java by SpineEventEngine.
the class IntegrationBusShould method emit_unsupported_external_message_exception_if_message_type_is_unknown.
@Test
public void emit_unsupported_external_message_exception_if_message_type_is_unknown() {
final InMemoryTransportFactory transportFactory = InMemoryTransportFactory.newInstance();
final BoundedContext boundedContext = contextWithTransport(transportFactory);
final Event event = projectCreated();
final BoundedContextName boundedContextName = BoundedContext.newName("External context ID");
final ExternalMessage externalMessage = ExternalMessages.of(event, boundedContextName);
final MemoizingObserver<Ack> observer = StreamObservers.memoizingObserver();
boundedContext.getIntegrationBus().post(externalMessage, observer);
final Error error = observer.firstResponse().getStatus().getError();
assertFalse(Validate.isDefault(error));
assertEquals(ExternalMessageValidationError.getDescriptor().getFullName(), error.getType());
assertTrue(UNSUPPORTED_EXTERNAL_MESSAGE.getNumber() == error.getCode());
}
Aggregations