Search in sources :

Example 26 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class CommandTestShould method create_command_with_custom_Timestamp.

@Test
public void create_command_with_custom_Timestamp() {
    final StringValue commandMessage = newUuidValue();
    final Timestamp timestamp = TimeTests.Past.minutesAgo(5);
    final Command command = commandTest.createCommand(commandMessage, timestamp);
    assertEquals(timestamp, command.getContext().getActorContext().getTimestamp());
}
Also used : Command(io.spine.core.Command) StringValue(com.google.protobuf.StringValue) Timestamp(com.google.protobuf.Timestamp) Test(org.junit.Test)

Example 27 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class CommandTestShould method stores_command_after_creation.

// This test verifies that Optionals
@SuppressWarnings("OptionalGetWithoutIsPresent")
// are initialized.
@Test
public void stores_command_after_creation() {
    final StringValue commandMessage = newUuidValue();
    final Command command = commandTest.createCommand(commandMessage);
    assertEquals(commandMessage, commandTest.commandMessage().get());
    assertEquals(command.getContext(), commandTest.commandContext().get());
    assertEquals(command, commandTest.command().get());
}
Also used : Command(io.spine.core.Command) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 28 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class TypeUrlShould method obtain_type_of_command.

@Test
public void obtain_type_of_command() {
    final ActorRequestFactory factory = TestActorRequestFactory.newInstance(TypeUrlShould.class);
    final StringValue message = Wrapper.forString(newUuid());
    final Command command = factory.command().create(message);
    final TypeUrl typeUrl = TypeUrl.ofCommand(command);
    assertIsStringValueUrl(typeUrl);
}
Also used : Command(io.spine.base.Command) ActorRequestFactory(io.spine.client.ActorRequestFactory) TestActorRequestFactory(io.spine.test.TestActorRequestFactory) TypeUrl.composeTypeUrl(io.spine.type.TypeUrl.composeTypeUrl) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 29 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class ProjectionRepositoryShould method throw_exception_if_dispatch_unknown_event.

@Test(expected = RuntimeException.class)
public void throw_exception_if_dispatch_unknown_event() {
    final StringValue unknownEventMessage = StringValue.getDefaultInstance();
    final Event event = EventTests.createContextlessEvent(unknownEventMessage);
    repository().dispatch(event);
}
Also used : Event(io.spine.base.Event) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 30 with StringValue

use of com.google.protobuf.StringValue in project core-java by SpineEventEngine.

the class ProcessManagerRepositoryShould method throw_exception_if_dispatch_unknown_event.

@Test(expected = IllegalArgumentException.class)
public void throw_exception_if_dispatch_unknown_event() {
    final StringValue unknownEventMessage = StringValue.getDefaultInstance();
    final Event event = createEvent(unknownEventMessage);
    repository.dispatch(event);
}
Also used : Event(io.spine.base.Event) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Aggregations

StringValue (com.google.protobuf.StringValue)75 Test (org.junit.Test)65 Timestamp (com.google.protobuf.Timestamp)8 Command (io.spine.base.Command)5 Command (io.spine.core.Command)5 Any (com.google.protobuf.Any)4 BoolValue (com.google.protobuf.BoolValue)4 Identifiers.idToString (io.spine.base.Identifiers.idToString)4 CommandContext (io.spine.core.CommandContext)4 Event (io.spine.core.Event)4 Wrapper.forString (io.spine.protobuf.Wrapper.forString)4 CommandBus (io.spine.server.commandbus.CommandBus)4 EventFactory (io.spine.server.event.EventFactory)4 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)4 Before (org.junit.Before)4 Optional (com.google.common.base.Optional)3 Message (com.google.protobuf.Message)3 Event (io.spine.base.Event)3 TestActorRequestFactory (io.spine.client.TestActorRequestFactory)3 CommandEnvelope (io.spine.core.CommandEnvelope)3