Package org.infinispan.protostream

Examples of org.infinispan.protostream.FileDescriptorSource$ProgressCallback


      String file1 = "package testPackage;\n" +
            "enum somePackage.E1 {\n" +
            "  VAL = 1;\n" +
            "}";

      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("file1.proto", file1);

      parseAndResolve(fileDescriptorSource);
   }
View Full Code Here


      String file3 = "import \"file2.proto\";\n" +
            "message M3 {\n" +
            "  required M1 a = 1;\n" +
            "}";

      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("file1.proto", file1);
      fileDescriptorSource.addProtoFile("file2.proto", file2);
      fileDescriptorSource.addProtoFile("file3.proto", file3);

      Map<String, FileDescriptor> descriptors = parseAndResolve(fileDescriptorSource);
      assertEquals(3, descriptors.size());
      assertTrue(descriptors.containsKey("file1.proto"));
      assertTrue(descriptors.containsKey("file2.proto"));
View Full Code Here

      String file3 = "import \"file2.proto\";\n" +
            "message M3 {\n" +
            "  required M1 a = 1;\n" +
            "}";

      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("file1.proto", file1);
      fileDescriptorSource.addProtoFile("file2.proto", file2);
      fileDescriptorSource.addProtoFile("file3.proto", file3);

      parseAndResolve(fileDescriptorSource);
   }
View Full Code Here

            "import \"file1.proto\";\n" +
            "message B {\n" +
            "   required p.A ma = 1;\n" +
            "}";

      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("file1.proto", file1);
      fileDescriptorSource.addProtoFile("file2.proto", file2);

      Map<String, FileDescriptor> descriptors = parseAndResolve(fileDescriptorSource);
      assertEquals(2, descriptors.size());
      assertTrue(descriptors.containsKey("file1.proto"));
      assertTrue(descriptors.containsKey("file2.proto"));
View Full Code Here

   public static final String QUERY_PROTO_RES = "/org/infinispan/query/remote/client/query.proto";
   public static final String MESSAGE_PROTO_RES = "/org/infinispan/protostream/message-wrapping.proto";

   public static void registerMarshallers(SerializationContext ctx) throws IOException, DescriptorParserException {
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile(QUERY_PROTO_RES, MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES));
      fileDescriptorSource.addProtoFile(MESSAGE_PROTO_RES, MarshallerRegistration.class.getResourceAsStream(MESSAGE_PROTO_RES));
      ctx.registerProtoFiles(fileDescriptorSource);
      ctx.registerMarshaller(new QueryRequestMarshaller());
      ctx.registerMarshaller(new QueryResponseMarshaller());
   }
View Full Code Here

   @Test
   public void testInputFromFile() throws Exception {
      File f1 = asFile("org/infinispan/protostream/lib/base.proto");
      File f2 = asFile("org/infinispan/protostream/lib/base2.proto");
      FileDescriptorSource fileDescriptorSource = FileDescriptorSource.fromFiles(f1, f2);
      Map<String, FileDescriptor> parseResult = new SquareProtoParser().parse(fileDescriptorSource);
      assertThat(parseResult).isNotEmpty();
   }
View Full Code Here

              " import test.proto;\n" +
                      " message M2 {\n" +
                      "    required string a = 1;\n" +
                      "}";

      FileDescriptorSource source = new FileDescriptorSource();
      source.addProtoFile("test.proto", file1);
      source.addProtoFile("test2.proto", file2);

      new SquareProtoParser().parse(source);

   }
View Full Code Here

   }

   @Test
   public void testTransform() throws Exception {

      FileDescriptorSource fileDescriptorSource = FileDescriptorSource.fromResources(
              "org/infinispan/protostream/test/message.proto",
              "org/infinispan/protostream/lib/base.proto",
              "org/infinispan/protostream/lib/base2.proto");

      Map<String, FileDescriptor> files = new SquareProtoParser().parse(fileDescriptorSource);
View Full Code Here

      if (registryListener == null) {
         synchronized (this) {
            if (registryListener == null) {
               registryListener = new ProtobufMetadataRegistryListener();
               clusterRegistry.addListener(REGISTRY_SCOPE, registryListener);
               FileDescriptorSource descriptorSource = getFileDescriptorSource();
               if (!descriptorSource.getFileDescriptors().isEmpty()) {
                  try {
                     serCtx.registerProtoFiles(descriptorSource);
                  } catch (Exception e) {
                     log.error(e);
                  }
View Full Code Here

   public void registerProtofiles(@Parameter(name = "fileNames", description = "names of the protofiles") String[] names,
                                  @Parameter(name = "fileContents", description = "content of the files") String[] contents)
           throws Exception {
      if (names.length != contents.length)
         throw new MBeanException(new IllegalArgumentException("invalid parameter sizes"));
      FileDescriptorSource fileDescriptorSource = getFileDescriptorSource();
      for (int i = 0; i < names.length; i++) {
         fileDescriptorSource.addProtoFile(names[i], contents[i]);
      }
      clusterRegistry.put(REGISTRY_SCOPE, REGISTRY_KEY, fileDescriptorSource);
   }
View Full Code Here

TOP

Related Classes of org.infinispan.protostream.FileDescriptorSource$ProgressCallback

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.