Search in sources :

Example 31 with StringValue

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

the class CommandsShould method extract_message_from_command.

@Test
public void extract_message_from_command() {
    final StringValue message = Wrapper.forString("extract_message_from_command");
    final Command command = requestFactory.createCommand(message);
    assertEquals(message, Commands.getMessage(command));
}
Also used : TestCommand(io.spine.test.commands.TestCommand) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 32 with StringValue

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

the class IdentifiersShould method unpack_passed_Any.

@Test
public void unpack_passed_Any() {
    final StringValue id = newUuidValue();
    assertEquals(id.getValue(), Identifiers.idToString(AnyPacker.pack(id)));
}
Also used : StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 33 with StringValue

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

the class IdentifiersShould method convert_to_string_message_id_with_message_field.

@Test
public void convert_to_string_message_id_with_message_field() {
    final StringValue value = forString(TEST_ID);
    final NestedMessageId idToConvert = NestedMessageId.newBuilder().setId(value).build();
    final String result = idToString(idToConvert);
    assertEquals(TEST_ID, result);
}
Also used : NestedMessageId(io.spine.test.identifiers.NestedMessageId) Identifiers.idToString(io.spine.base.Identifiers.idToString) Wrapper.forString(io.spine.protobuf.Wrapper.forString) StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 34 with StringValue

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

the class CommandAttributeShould method set_and_get_message_attribute.

@Test
public void set_and_get_message_attribute() {
    final CommandAttribute<StringValue> attr = new CommandAttribute<StringValue>("str-val") {
    };
    final StringValue value = Wrapper.forString(getClass().getName());
    assertSetGet(attr, value);
}
Also used : StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 35 with StringValue

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

the class EventsShould method get_producer_from_event_context.

@Test
public void get_producer_from_event_context() {
    final StringValue msg = unpack(context.getProducerId());
    final String id = getProducer(context);
    assertEquals(msg.getValue(), id);
}
Also used : 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