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));
}
}
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));
}
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);
}
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();
}
Aggregations