Search in sources :

Example 36 with StringValue

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

the class EventFactory method toEventContext.

private static EventContext toEventContext(IntegrationEventContext value) {
    final StringValue producerId = Wrapper.forString(value.getBoundedContextName());
    final Timestamp timestamp = value.getTimestamp();
    final Any producerAny = pack(producerId);
    return EventContext.newBuilder().setTimestamp(timestamp).setProducerId(producerAny).build();
}
Also used : StringValue(com.google.protobuf.StringValue) Timestamp(com.google.protobuf.Timestamp) Any(com.google.protobuf.Any) Messages.toAny(io.spine.protobuf.Messages.toAny)

Example 37 with StringValue

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

the class ValidateShould method check_if_message_is_in_default.

@Test(expected = IllegalStateException.class)
public void check_if_message_is_in_default() {
    final StringValue nonDefault = newUuidValue();
    checkDefault(nonDefault);
}
Also used : StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 38 with StringValue

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

the class ValidateShould method return_non_default_value_on_check.

@Test
public void return_non_default_value_on_check() {
    final StringValue nonDefault = newUuidValue();
    assertEquals(nonDefault, checkNotDefault(nonDefault));
    assertEquals(nonDefault, checkNotDefault(nonDefault, "with error message"));
}
Also used : StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 39 with StringValue

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

the class JsonShould method print_to_json.

@Test
public void print_to_json() {
    final StringValue value = Wrapper.forString("print_to_json");
    assertFalse(toJson(value).isEmpty());
}
Also used : StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 40 with StringValue

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

the class AnyPackerShould method have_unpacking_func.

@Test
public void have_unpacking_func() {
    final StringValue value = newUuidValue();
    assertEquals(value, AnyPacker.unpackFunc().apply(Any.pack(value)));
}
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