@Test public void buildDescriptorMultipleNoDefinedName() { thrown.expect(RuntimeException.class); ProtobufUtils.buildDescriptor(ProtobufUtils.class.getResource(MULTIPLE_EXAMPLE).getPath()); }
public static Descriptors.Descriptor buildDescriptor(String filePath, String messageName) { Descriptors.FileDescriptor fileDescriptor = parseFileDescriptor(filePath); Descriptors.Descriptor result = null; for (Descriptors.Descriptor descriptor : fileDescriptor.getMessageTypes()) { if (descriptor.getName().equals(messageName)) { result = descriptor; } } if (null == result) { throw new RuntimeException("Unable to locate Message '" + messageName + "' in Descriptor"); } return result; }
ProtobufUtils { public static Descriptors.Descriptor buildDescriptor(String filePath, String messageName) { Descriptors.FileDescriptor fileDescriptor = parseFileDescriptor(filePath); Descriptors.Descriptor result = null; for (Descriptors.Descriptor descriptor : fileDescriptor.getMessageTypes()) { if (descriptor.getName().equals(messageName)) { result = descriptor; } } if (null == result) { throw new RuntimeException("Unable to locate Message '" + messageName + "' in Descriptor"); } return result; } }
ProtobufUtils { public static Descriptors.Descriptor buildDescriptor(String filePath, String messageName) { Descriptors.FileDescriptor fileDescriptor = parseFileDescriptor(filePath); Descriptors.Descriptor result = null; for (Descriptors.Descriptor descriptor : fileDescriptor.getMessageTypes()) { if (descriptor.getName().equals(messageName)) { result = descriptor; } } if (null == result) { throw new RuntimeException("Unable to locate Message '" + messageName + "' in Descriptor"); } return result; }  }
ProtobufUtils { public static Descriptors.Descriptor buildDescriptor(String filePath, String messageName) { Descriptors.FileDescriptor fileDescriptor = parseFileDescriptor(filePath); Descriptors.Descriptor result = null; for (Descriptors.Descriptor descriptor : fileDescriptor.getMessageTypes()) { if (descriptor.getName().equals(messageName)) { result = descriptor; } } if (null == result) { throw new RuntimeException("Unable to locate Message '" + messageName + "' in Descriptor"); } return result; }  static List<Object> buildRowValues(Descriptors.Descriptor dsc, Message msg, StructType schema); static StructType buildSchema(Descriptors.Descriptor descriptor); static Descriptors.Descriptor buildDescriptor(String filePath, String messageName); static Descriptors.Descriptor buildDescriptor(String filePath); static boolean isGzipped(InputStream inputStream); }
ProtobufUtils { public static Descriptors.Descriptor buildDescriptor(String filePath, String messageName) { Descriptors.FileDescriptor fileDescriptor = parseFileDescriptor(filePath); Descriptors.Descriptor result = null; for (Descriptors.Descriptor descriptor : fileDescriptor.getMessageTypes()) { if (descriptor.getName().equals(messageName)) { result = descriptor; } } if (null == result) { throw new RuntimeException("Unable to locate Message '" + messageName + "' in Descriptor"); } return result; }  static List<Object> buildRowValues(Descriptors.Descriptor dsc, Message msg, StructType schema); static StructType buildSchema(Descriptors.Descriptor descriptor); static Descriptors.Descriptor buildDescriptor(String filePath, String messageName); static Descriptors.Descriptor buildDescriptor(String filePath); static boolean isGzipped(InputStream inputStream);  }