Search in sources :

Example 6 with BoundedContextName

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());
}
Also used : TypeUrl(io.spine.type.TypeUrl) BoundedContextName(io.spine.core.BoundedContextName) Test(org.junit.Test)

Example 7 with BoundedContextName

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());
}
Also used : BoundedContextName(io.spine.core.BoundedContextName) Test(org.junit.Test)

Example 8 with BoundedContextName

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());
}
Also used : Ack(io.spine.core.Ack) InMemoryTransportFactory(io.spine.server.integration.memory.InMemoryTransportFactory) Event(io.spine.core.Event) Error(io.spine.base.Error) BoundedContext(io.spine.server.BoundedContext) 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