Package org.apache.avro.ipc.generic

Examples of org.apache.avro.ipc.generic.GenericRequestor.request()


    try {
      GenericRequestor 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


    protocol.getMessages().put("ack", message);

    // call a server over a stateless protocol that has a one-way "ack"
    GenericRequestor requestor =
      new GenericRequestor(protocol, createTransceiver());
    requestor.request("ack", new GenericData.Record(message.getRequest()));

    // make the request again, to better test handshakes w/ differing protocols
    requestor.request("ack", new GenericData.Record(message.getRequest()));
  }
View Full Code Here

    GenericRequestor requestor =
      new GenericRequestor(protocol, createTransceiver());
    requestor.request("ack", new GenericData.Record(message.getRequest()));

    // make the request again, to better test handshakes w/ differing protocols
    requestor.request("ack", new GenericData.Record(message.getRequest()));
  }

}
View Full Code Here

    try {
      GenericRequestor 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

      rec.put("hash", new GenericData.Fixed
              (PROTOCOL.getType("MD5"),
               new byte[]{0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5}));
      rec.put("extra", Boolean.TRUE);
      args.put("record", rec);
      GenericRecord response = (GenericRecord)r.request("echo", args);
      assertEquals(rec, response);
    } finally {
      t.close();
    }
  }
View Full Code Here

      GenericRequestor r = new GenericRequestor(protocol, t);
      addRpcPlugins(r);
      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();
      server.close();
    }
View Full Code Here

      new SaslSocketTransceiver(new InetSocketAddress(s.getPort()));
    GenericRequestor requestor = new GenericRequestor(PROTOCOL, c);
    GenericRecord params =
      new GenericData.Record(PROTOCOL.getMessages().get("hello").getRequest());
    params.put("greeting", "bob");
    Utf8 response = (Utf8)requestor.request("hello", params);
    assertEquals(new Utf8("goodbye"), response);
    s.close();
    c.close();
  }
View Full Code Here

      (new InetSocketAddress(server.getPort()), saslClient);
    GenericRequestor requestor = new GenericRequestor(PROTOCOL, c);
    GenericRecord params =
      new GenericData.Record(PROTOCOL.getMessages().get("hello").getRequest());
    params.put("greeting", "bob");
    Utf8 response = (Utf8)requestor.request("hello", params);
    assertEquals(new Utf8("goodbye"), response);
    s.close();
    c.close();
  }
View Full Code Here

        "m").getRequest());
    params.put("x", new Utf8("hello"));
    GenericRequestor r = new GenericRequestor(protocol, t);
   
    for(int x = 0; x < 5; x++)
      assertEquals(new Utf8("there"), r.request("m", params));
  }

}
View Full Code Here

      new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
    GenericRequestor requestor = new GenericRequestor(NULL_PROTOCOL, t);

    long now = System.nanoTime();
    for (int i = 0; i < COUNT; ++i) {
      requestor.request("null", null);
    }
    long elapsed = System.nanoTime() - now;
    t.close();
    server.close();
    return elapsed;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.