Search in sources :

Example 21 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 22 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)

Example 23 with StringValue

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

the class AnyPackerShould method unpack_google_message_from_Any.

@Test
public void unpack_google_message_from_Any() {
    final Any any = Any.pack(googleMsg);
    final StringValue actual = AnyPacker.unpack(any);
    assertEquals(googleMsg, actual);
}
Also used : StringValue(com.google.protobuf.StringValue) Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 24 with StringValue

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

the class WrappersShould method format.

@Test
public void format() {
    final StringValue str = Wrappers.format("%d %d %d", 1, 2, 3);
    assertEquals(str.getValue(), "1 2 3");
}
Also used : StringValue(com.google.protobuf.StringValue) Test(org.junit.Test)

Example 25 with StringValue

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

the class RecordBasedRepositoryShould method find_entities_by_query.

@Test
public void find_entities_by_query() {
    final I id1 = createId(271);
    final I id2 = createId(314);
    final Class<E> entityClass = repository.getEntityClass();
    final E entity1 = Given.entityOfClass(entityClass).withId(id1).build();
    final E entity2 = Given.entityOfClass(entityClass).withId(id2).build();
    repository.store(entity1);
    repository.store(entity2);
    final String fieldPath = "idString";
    final StringValue fieldValue = StringValue.newBuilder().setValue(id1.toString()).build();
    final EntityFilters filters = EntityFilters.newBuilder().putColumnFilter(fieldPath, AnyPacker.pack(fieldValue)).build();
    final Collection<E> found = repository.find(filters, FieldMask.getDefaultInstance());
    assertSize(1, found);
    assertContains(entity1, found);
    assertNotContains(entity2, found);
}
Also used : EntityFilters(io.spine.client.EntityFilters) StringValue(com.google.protobuf.StringValue) TenantAwareTest(io.spine.server.tenant.TenantAwareTest) Test(org.junit.Test)

Aggregations

StringValue (com.google.protobuf.StringValue)47 Test (org.junit.Test)41 Command (io.spine.base.Command)7 Timestamp (com.google.protobuf.Timestamp)5 Any (com.google.protobuf.Any)4 Event (io.spine.base.Event)4 Identifiers.idToString (io.spine.base.Identifiers.idToString)4 Wrapper.forString (io.spine.protobuf.Wrapper.forString)4 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)4 CommandContext (io.spine.base.CommandContext)3 EventFactory (io.spine.server.command.EventFactory)3 CommandBus (io.spine.server.commandbus.CommandBus)3 Version (io.spine.base.Version)2 EntityStateEnvelope (io.spine.server.entity.EntityStateEnvelope)2 TestActorRequestFactory (io.spine.test.TestActorRequestFactory)2 Before (org.junit.Before)2 EqualsTester (com.google.common.testing.EqualsTester)1 FieldMask (com.google.protobuf.FieldMask)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 Message (com.google.protobuf.Message)1