Search in sources :

Example 76 with Any

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

the class DoubleMismatch method unpackActual.

/**
     * Obtains actual double value from the passed mismatch.
     *
     * @throws RuntimeException if the passed instance represent a mismatch of non-double values
     */
public static double unpackActual(ValueMismatch mismatch) {
    checkNotNull(mismatch);
    final Any actual = mismatch.getActual();
    return unpacked(actual);
}
Also used : Any(com.google.protobuf.Any)

Example 77 with Any

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

the class FloatMismatch method unpackNewValue.

/**
     * Obtains new float value from the passed mismatch.
     *
     * @throws RuntimeException if the passed instance represent a mismatch of non-float values
     */
public static float unpackNewValue(ValueMismatch mismatch) {
    checkNotNull(mismatch);
    final Any newValue = mismatch.getNewValue();
    return unpacked(newValue);
}
Also used : Any(com.google.protobuf.Any)

Example 78 with Any

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

the class PackingIteratorShould method implement_next.

@Test
public void implement_next() throws Exception {
    while (packer.hasNext()) {
        final Any packed = packer.next();
        assertNotNull(packed);
        assertFalse(isDefault(unpack(packed)));
    }
}
Also used : Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 79 with Any

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

the class AnyPackerShould method return_Any_if_it_is_passed_to_pack.

@Test
public void return_Any_if_it_is_passed_to_pack() {
    final Any any = Any.pack(googleMsg);
    assertSame(any, AnyPacker.pack(any));
}
Also used : Any(com.google.protobuf.Any) Test(org.junit.Test)

Example 80 with Any

use of com.google.protobuf.Any 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)

Aggregations

Any (com.google.protobuf.Any)117 Test (org.junit.Test)40 Message (com.google.protobuf.Message)25 EntityRecord (io.spine.server.entity.EntityRecord)19 Version (io.spine.base.Version)13 Customer (io.spine.test.commandservice.customer.Customer)13 TypeUrl (io.spine.type.TypeUrl)13 StandStorage (io.spine.server.stand.StandStorage)12 Query (io.spine.client.Query)10 TenantAwareTest (io.spine.server.tenant.TenantAwareTest)10 CustomerId (io.spine.test.commandservice.customer.CustomerId)10 Map (java.util.Map)8 FieldMask (com.google.protobuf.FieldMask)7 EntityFilters (io.spine.client.EntityFilters)7 EntityId (io.spine.client.EntityId)7 Target (io.spine.client.Target)7 Maps.newHashMap (com.google.common.collect.Maps.newHashMap)6 Identifiers.idToAny (io.spine.base.Identifiers.idToAny)6 QueryResponse (io.spine.client.QueryResponse)6 EntityIdFilter (io.spine.client.EntityIdFilter)5