Search in sources :

Example 11 with ProtocolStringList

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

the class QueryFactoryShould method verifyMultiplePathsInQuery.

private static void verifyMultiplePathsInQuery(String[] paths, Query readAllWithPathFilteringQuery) {
    final FieldMask fieldMask = readAllWithPathFilteringQuery.getFieldMask();
    assertEquals(paths.length, fieldMask.getPathsCount());
    final ProtocolStringList pathsList = fieldMask.getPathsList();
    for (String expectedPath : paths) {
        assertTrue(pathsList.contains(expectedPath));
    }
}
Also used : FieldMask(com.google.protobuf.FieldMask) ProtocolStringList(com.google.protobuf.ProtocolStringList)

Example 12 with ProtocolStringList

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

the class MessageValidatorShould method assertFieldPathIs.

private static void assertFieldPathIs(ConstraintViolation violation, String... expectedFields) {
    final FieldPath path = violation.getFieldPath();
    final ProtocolStringList actualFields = path.getFieldNameList();
    assertEquals(expectedFields.length, actualFields.size());
    assertEquals(copyOf(expectedFields), copyOf(actualFields));
}
Also used : FieldPath(io.spine.base.FieldPath) ProtocolStringList(com.google.protobuf.ProtocolStringList)

Example 13 with ProtocolStringList

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

the class AssignLookup method removeDuplicates.

/**
 * Cleans the currently built commandHandlers from the duplicates.
 *
 * <p>Calling this method will cause the {@linkplain #commandHandlers current commandHandlers}
 * not to contain duplicate entries in any {@code repeated} field.
 */
private void removeDuplicates() {
    final ProtocolStringList handlingTypesList = commandHandlers.getCommandHandlingTypesList();
    final Set<String> commandHandlingTypes = newTreeSet(handlingTypesList);
    commandHandlers.clearCommandHandlingTypes().addAllCommandHandlingTypes(commandHandlingTypes);
}
Also used : ProtocolStringList(com.google.protobuf.ProtocolStringList)

Example 14 with ProtocolStringList

use of com.google.protobuf.ProtocolStringList in project java-function-invoker by projectriff.

the class MessageConversionUtils method fromGrpc.

public static Message<byte[]> fromGrpc(io.projectriff.grpc.function.FunctionProtos.Message input) {
    MessageBuilder<byte[]> builder = MessageBuilder.withPayload(input.getPayload().toByteArray());
    for (Entry<String, HeaderValue> entry : input.getHeadersMap().entrySet()) {
        HeaderValue header = entry.getValue();
        if (header.getValuesCount() > 0) {
            Object value;
            ProtocolStringList list = header.getValuesList();
            if (list.size() == 1) {
                value = list.get(0);
            } else {
                value = list;
            }
            builder.setHeader(entry.getKey(), value);
        }
    }
    return builder.build();
}
Also used : HeaderValue(io.projectriff.grpc.function.FunctionProtos.Message.HeaderValue) ByteString(com.google.protobuf.ByteString) ProtocolStringList(com.google.protobuf.ProtocolStringList)

Aggregations

ProtocolStringList (com.google.protobuf.ProtocolStringList)14 ByteString (com.google.protobuf.ByteString)8 CIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CIdeInfo)7 TargetIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo)7 Test (org.junit.Test)7 CToolchainIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CToolchainIdeInfo)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ArtifactLocation (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation)1 FieldMask (com.google.protobuf.FieldMask)1 Message (com.google.protobuf.Message)1 Impression (com.xrtb.pojo.Impression)1 HeaderValue (io.projectriff.grpc.function.FunctionProtos.Message.HeaderValue)1 FieldPath (io.spine.base.FieldPath)1 LinkedList (java.util.LinkedList)1 Nonnull (javax.annotation.Nonnull)1