Examples of BsonClientCodecFactory


Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

    Util.stopRealGoServer();
  }

  @Test
  public void testStreaming() throws GoRpcException, IOException, ApplicationException {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    Map<String, Long> args = new HashMap<>();
    args.put("A", 10L);
    args.put("Count", 20L);
    args.put("ErrorAt", -1L);
    args.put("BadTypeAt", -1L);
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

  }

  @Test
  public void testStreamingErrorInTheMiddle() throws GoRpcException, IOException,
      ApplicationException {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    Map<String, Long> args = new HashMap<>();
    args.put("A", 10L);
    args.put("Count", 20L);
    args.put("ErrorAt", 5L);
    args.put("BadTypeAt", -1L);
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

    client.close();
  }

  @Test
  public void testStreamingBadTypeError() throws GoRpcException, IOException, ApplicationException {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    Map<String, Long> args = new HashMap<>();
    args.put("A", 10L);
    args.put("Count", 20L);
    args.put("ErrorAt", -1L);
    args.put("BadTypeAt", 4L);
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

   * Ensure new requests are not allowed while streaming is in progress
   */
  @Test
  public void testNewRequestWhileStreaming() throws GoRpcException, IOException,
      ApplicationException {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    Map<String, Long> args = new HashMap<>();
    args.put("A", 10L);
    args.put("Count", 3L);
    args.put("ErrorAt", -1L);
    args.put("BadTypeAt", -1L);
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

   * Ensure error is raised for fetching after stream has ended
   */
  @Test
  public void testFetchNextAfterStreamEnded() throws GoRpcException, IOException,
      ApplicationException {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    Map<String, Long> args = new HashMap<>();
    args.put("A", 10L);
    args.put("Count", 3L);
    args.put("ErrorAt", -1L);
    args.put("BadTypeAt", -1L);
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

public class RpcClientFactory {
  public static RpcClient get(String address, int timeoutMs) throws ConnectionException {
    try {
      HostAndPort hostAndPort = HostAndPort.fromString(address);
      Client client = Client.dialHttp(hostAndPort.getHostText(), hostAndPort.getPort(),
          GoRpcClient.BSON_RPC_PATH, timeoutMs, new BsonClientCodecFactory());
      return new GoRpcClient(client);
    } catch (GoRpcException e) {
      GoRpcClient.LOGGER.error("vtgate connection exception: ", e);
      throw new ConnectionException(e.getMessage());
    }
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

  @Override
  public void tearDown() throws IOException {}

  @Test
  public void testDivide() throws GoRpcException, IOException, ApplicationException {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    BSONObject mArgs = new BasicBSONObject();
    mArgs.put("A", 10L);
    mArgs.put("B", 3L);
    Response response = client.call("Arith.Divide", mArgs);
    BSONObject result = (BSONObject) response.getReply();
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

    client.close();
  }

  @Test
  public void testDivideError() throws GoRpcException, IOException, ApplicationException {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    BSONObject mArgs = new BasicBSONObject();
    mArgs.put("A", 10L);
    mArgs.put("B", 0L);
    try {
      client.call("Arith.Divide", mArgs);
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

  /**
   * Test no exception raised for client with timeouts disabled
   */
  @Test
  public void testNoTimeoutCase() throws Exception {
    Client client = Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, new BsonClientCodecFactory());
    timeoutCheck(client, 500, false);
    client.close();
  }
View Full Code Here

Examples of com.youtube.vitess.gorpc.codecs.bson.BsonClientCodecFactory

  @Test
  public void testTimeout() throws Exception {
    int clientTimeoutMs = 100;
    Client client =
        Client.dialHttp(Util.HOST, Util.PORT, Util.PATH, clientTimeoutMs,
            new BsonClientCodecFactory());
    timeoutCheck(client, clientTimeoutMs / 2, false);
    timeoutCheck(client, clientTimeoutMs * 2, true);
    client.close();
  }
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.