Package com.google.protobuf.DescriptorProtos

Examples of com.google.protobuf.DescriptorProtos.FileDescriptorProto


      assertTrue(e.getMessage().indexOf("is not defined") != -1);
    }
  }

  public void testPublicDependency() throws Exception {
    FileDescriptorProto barProto = FileDescriptorProto.newBuilder()
        .setName("bar.proto")
        .addMessageType(DescriptorProto.newBuilder().setName("Bar"))
        .build();
    FileDescriptorProto forwardProto = FileDescriptorProto.newBuilder()
        .setName("forward.proto")
        .addDependency("bar.proto")
        .addPublicDependency(0)
        .build();
    FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
        .setName("foo.proto")
        .addDependency("forward.proto")
        .addMessageType(DescriptorProto.newBuilder()
            .setName("Foo")
            .addField(FieldDescriptorProto.newBuilder()
View Full Code Here


  /**
   * Tests the translate/crosslink for an example with a more complex namespace
   * referencing.
   */
  public void testComplexNamespacePublicDependency() throws Exception {
    FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
        .setName("bar.proto")
        .setPackage("a.b.c.d.bar.shared")
        .addEnumType(EnumDescriptorProto.newBuilder()
            .setName("MyEnum")
            .addValue(EnumValueDescriptorProto.newBuilder()
                .setName("BLAH")
                .setNumber(1)))
        .build();
    FileDescriptorProto barProto = FileDescriptorProto.newBuilder()
        .setName("foo.proto")
        .addDependency("bar.proto")
        .setPackage("a.b.c.d.foo.shared")
        .addMessageType(DescriptorProto.newBuilder()
            .setName("MyMessage")
View Full Code Here

    assertFalse(TestMultipleExtensionRanges.getDescriptor().isExtensionNumber(4142));
    assertTrue(TestMultipleExtensionRanges.getDescriptor().isExtensionNumber(4143));
  }

  public void testPackedEnumField() throws Exception {
    FileDescriptorProto fileDescriptorProto = FileDescriptorProto.newBuilder()
        .setName("foo.proto")
        .addEnumType(EnumDescriptorProto.newBuilder()
          .setName("Enum")
          .addValue(EnumValueDescriptorProto.newBuilder()
            .setName("FOO")
View Full Code Here

            if (group == null)
                throw new NoSuchGroupException(groupName);
            StorageDescription storage = group.getStorageDescription();
            if (!(storage instanceof ProtobufStorageDescription))
                throw new InvalidParameterValueException("group does not use STORAGE_FORMAT protobuf");
            FileDescriptorProto fileProto = ((ProtobufStorageDescription)storage).getFileProto();
            try {
                tempFile = File.createTempFile("group", ".proto");
                try (FileWriter writer = new FileWriter(tempFile)) {
                    new ProtobufDecompiler(writer).decompile(fileProto);
                }
View Full Code Here

TOP

Related Classes of com.google.protobuf.DescriptorProtos.FileDescriptorProto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.