Package com.linkedin.r2.message.rpc

Examples of com.linkedin.r2.message.rpc.RpcRequest


    client.restRequest(restRequest, restCallback);

    assertNull(restCallback.e);
    assertNotNull(restCallback.t);

    RpcRequest rpcRequest = new RpcRequestBuilder(uri).build();
    TestCallback<RpcResponse> rpcCallback = new TestCallback<RpcResponse>();

    client.rpcRequest(rpcRequest, rpcCallback);

    assertNotNull(rpcCallback.e);
View Full Code Here


  @Test
  @SuppressWarnings("deprecation")
  public void testSimpleRpcReq() throws IOException
  {
    final RpcRequest expected = new RpcRequestBuilder(URI.create("http://localhost:1234"))
            .build();
    assertMsgEquals(expected, _serializer.readRpcRequest(getResource("simple-rpc-req.txt")));
  }
View Full Code Here

  @Test
  @SuppressWarnings("deprecation")
  public void testRpcReqWithEntity() throws IOException
  {
    final RpcRequest expected = new RpcRequestBuilder(URI.create("http://localhost:1234"))
            .setEntity(ByteString.copyString("This is a simple entity!", "ASCII"))
            .build();
    assertMsgEquals(expected, _serializer.readRpcRequest(getResource("rpc-req-with-entity.txt")));
  }
View Full Code Here

  }

  @Test
  public void testRpcRequestReversible1() throws IOException
  {
    final RpcRequest req = createRpcRequest();
    assertMsgEquals(req, readRpcReq(writeReq(req)));
  }
View Full Code Here

  @Test
  @SuppressWarnings("deprecation")
  public void testRpcRequestReversible2() throws IOException
  {
    final RpcRequest req = createRpcRequest().builder()
            .setEntity(new byte[] {1,2,3,4})
            .build();
    assertMsgEquals(req, readRpcReq(writeReq(req)));
  }
View Full Code Here

{
  @Test
  @SuppressWarnings("deprecation")
  public void testChainBuildRpcRequestFromRpcRequestBuilder()
  {
    final RpcRequest req = new RpcRequestBuilder(URI.create("test"))
            .setEntity(new byte[] {1,2,3,4})
            .build()
            .builder()
              .setEntity(new byte[] {5,6,7,8})
              .setURI(URI.create("anotherURI"))
              .build();

    Assert.assertEquals(new byte[] {5,6,7,8}, req.getEntity().copyBytes());
    Assert.assertEquals(URI.create("anotherURI"), req.getURI());
  }
View Full Code Here

      }

      String service = _services[index];
      URI uri = URI.create("d2://" + service);

      RpcRequest req =
          new RpcRequestBuilder(uri).setEntity("hi there".getBytes("UTF-8")).build();

      try
      {
        Future<RpcResponse> response = client.rpcRequest(req);
View Full Code Here

      try
      {
        if (! requestType.equalsIgnoreCase("rest"))
        {
          RpcRequest req =
            new RpcRequestBuilder(uri).setEntity("".getBytes("UTF-8")).build();
          Future<RpcResponse> response = client.rpcRequest(req);
          responseString = response.get().getEntity().asString("UTF-8");
        }
        else
View Full Code Here

      try
      {
        if (! requestType.equalsIgnoreCase("rest"))
        {
          RpcRequest req =
            new RpcRequestBuilder(uri).setEntity(request.getBytes("UTF-8")).build();
          Future<RpcResponse> response = client.rpcRequest(req);
          responseString = response.get().getEntity().asString("UTF-8");
        }
        else
View Full Code Here

      {
        _total.incrementAndGet();

        URI uri = getRandomServiceUrn();

        RpcRequest req =
            new RpcRequestBuilder(uri).setEntity(BYTES).build();

        _client.rpcRequest(req).get();
        _success.incrementAndGet();
      }
View Full Code Here

TOP

Related Classes of com.linkedin.r2.message.rpc.RpcRequest

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.