Package org.apache.avro.generic

Examples of org.apache.avro.generic.GenericRequestor


    } else {
      err.println("One of -data or -file must be specified.");
      return 1;
    }

    GenericRequestor client = makeClient(protocol, uri);
    Object response = client.request(message.getName(), datum);
    dumpJson(out, message.getResponse(), response);
    return 0;
  }
View Full Code Here


  private GenericRequestor makeClient(Protocol protocol, URI uri)
  throws IOException {
    HttpTransceiver transceiver =
      new HttpTransceiver(uri.toURL());
    GenericRequestor requestor = new GenericRequestor(protocol, transceiver);
    return requestor;
  }
View Full Code Here

    protected V deserializeValue(ByteBuffer bb) {
        return bb == null ? null : _valueSerializer.deserialize(bb.array());
    }
   
    protected Object send(String msg, Object request) throws IOException {
        GenericRequestor requestor = new GenericRequestor(_protocol, _transceiverFactory.newTransceiver());
        return requestor.request(msg, request);
    }
View Full Code Here

    fileChannel = new FileInputStream(file).getChannel();

    server = new SocketServer(new TestResponder(), new InetSocketAddress(0));
    client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    requestor = new GenericRequestor(PROTOCOL, client);

  }
View Full Code Here

  @BeforeClass
  public void testStartServer() throws Exception {
    server = new SocketServer(new TestResponder(), new InetSocketAddress(0));
    client = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    requestor = new GenericRequestor(PROTOCOL, client);
  }
View Full Code Here

                             Schema.createUnion(new ArrayList<Schema>()));
    protocol.getMessages().put("hello", message);
    Transceiver t
      = new SocketTransceiver(new InetSocketAddress(server.getPort()));
    try {
      Requestor r = new GenericRequestor(protocol, t);
      GenericRecord params = new GenericData.Record(message.getRequest());
      params.put("extra", Boolean.TRUE);
      params.put("greeting", new Utf8("bob"));
      Utf8 response = (Utf8)r.request("hello", params);
      assertEquals(new Utf8("goodbye"), response);
    } finally {
      t.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.generic.GenericRequestor

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.