Examples of RestRequest


Examples of com.linkedin.r2.message.rest.RestRequest

    assertEquals(client.getUri(), uri);
    assertEquals(client.getServiceName(), serviceName);
    assertEquals(client.getWrappedClient(), wrappedClient);

    RestRequest restRequest = new RestRequestBuilder(URI.create("d2://" + serviceName + path)).build();
    Map<String, String> restWireAttrs = new HashMap<String, String>();
    TestTransportCallback<RestResponse> restCallback =
        new TestTransportCallback<RestResponse>();

    client.restRequest(restRequest, new RequestContext(), restWireAttrs, restCallback);

    assertFalse(restCallback.response.hasError());
    assertEquals(wrappedClient.restRequest.getHeaders(), restRequest.getHeaders());
    assertEquals(wrappedClient.restRequest.getEntity(), restRequest.getEntity());
    assertEquals(wrappedClient.restRequest.getMethod(), restRequest.getMethod());
    assertEquals(wrappedClient.restRequest.getURI(), URI.create(hostUri + path));

  }
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

    assertEquals(client.getUri(), uri);
    assertEquals(client.getServiceName(), serviceName);
    assertEquals(client.getWrappedClient(), wrappedClient);

    RestRequest restRequest = new RestRequestBuilder(URI.create("d2://HistoryService/getCube?bar=baz#fragId")).build();
    Map<String, String> restWireAttrs = new HashMap<String, String>();
    TestTransportCallback<RestResponse> restCallback =
        new TestTransportCallback<RestResponse>();

    client.restRequest(restRequest, new RequestContext(), restWireAttrs, restCallback);

    assertFalse(restCallback.response.hasError());
    assertEquals(wrappedClient.restRequest.getHeaders(), restRequest.getHeaders());
    assertEquals(wrappedClient.restRequest.getEntity(), restRequest.getEntity());
    assertEquals(wrappedClient.restRequest.getMethod(), restRequest.getMethod());
    assertEquals(wrappedClient.restRequest.getURI(), URI.create("http://username:password@test.linkedin.com:9876/test/getCube?bar=baz#fragId"));
  }
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

    assertEquals(client.getUri(), uri);
    assertEquals(client.getServiceName(), serviceName);
    assertEquals(client.getWrappedClient(), wrappedClient);

    RestRequest restRequest;
    Map<String, String> restWireAttrs = new HashMap<String, String>();
    TestTransportCallback<RestResponse> restCallback =
            new TestTransportCallback<RestResponse>();

    restRequest = new RestRequestBuilder(URI.create("d2://HistoryService")).build();
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

    assertEquals(client.getUri(), uri);
    Double clientWeight = client.getPartitionWeight(DefaultPartitionAccessor.DEFAULT_PARTITION_ID);
    assertEquals(clientWeight, weight);
    assertEquals(client.getWrappedClient(), wrappedClient);

    RestRequest restRequest = new RestRequestBuilder(uri).build();
    Map<String, String> restWireAttrs = new HashMap<String, String>();
    TestTransportCallback<RestResponse> restCallback =
        new TestTransportCallback<RestResponse>();

    client.restRequest(restRequest, new RequestContext(), restWireAttrs, restCallback);
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

    _client = client;
  }

  public void echo(String msg, Callback<String> callback)
  {
    final RestRequest req = new RestRequestBuilder(_uri)
            .setEntity(ByteString.copyString(msg, RestEchoServer.CHARSET))
            .setMethod(RestMethod.POST)
            .build();
    _client.restRequest(req, new CallbackAdapter<String, RestResponse>(callback) {
      @Override
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

    KeyMapperProvider keyMapperProvider = new TestKeyMapperProvider();
    ClientFactoryProvider clientFactoryProvider = new TestClientFactoryProvider();
    Facilities facilities = new DelegatingFacilities(dirProvider, keyMapperProvider, clientFactoryProvider);
    DynamicClient client = new DynamicClient(balancer, facilities);
    URI uri = URI.create("d2://test");
    RestRequest restRequest = new RestRequestBuilder(uri).build();
    TestCallback<RestResponse> restCallback = new TestCallback<RestResponse>();

    client.restRequest(restRequest, restCallback);

    assertNull(restCallback.e);
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

  public void testUnavailable() throws URISyntaxException
  {
    TestLoadBalancer balancer = new TestLoadBalancer(true);
    DynamicClient client = new DynamicClient(balancer, null);
    URI uri = URI.create("d2://test");
    RestRequest restRequest = new RestRequestBuilder(uri).build();
    TestCallback<RestResponse> restCallback = new TestCallback<RestResponse>();

    client.restRequest(restRequest, restCallback);

    assertNotNull(restCallback.e);
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

                                             Object body,
                                             ResourceMethod method,
                                             Map<String, String> headers,
                                             ProtocolVersion protocolVersion) throws Exception
  {
    RestRequest req = buildRequest(path, headers, protocolVersion);
    RoutingResult routing = buildRoutingResult(method, req, headers);
    return _responseHandler.buildResponse(req, routing, body);
  }
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

                                             Object result,
                                             Map<String, String> headers,
                                             ProtocolVersion protocolVersion)
          throws IOException, URISyntaxException, RestLiSyntaxException
  {
    RestRequest request = buildRequest(uri, headers, protocolVersion);
    ServerResourceContext context = new ResourceContextImpl(new PathKeysImpl(), request, new RequestContext());
    RestUtils.validateRequestHeadersAndUpdateResourceContext(headers, context);
    RoutingResult routingResult = new RoutingResult(context, methodDescriptor);
    RestResponse response;
    response = _responseHandler.buildResponse(request,
View Full Code Here

Examples of com.linkedin.r2.message.rest.RestRequest

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "statusActionData")
  public void testActions(AcceptTypeData acceptTypeData, String response1, String response2,
                          ProtocolVersion protocolVersion,
                          String errorResponseHeaderName) throws Exception
  {
    final RestRequest request = buildRequest(acceptTypeData.acceptHeaders, protocolVersion);
    RestResponse response;

    // #1 simple record template
    response = _responseHandler.buildResponse(request,
                                              buildRoutingResultAction(Status.class, request, acceptTypeData.acceptHeaders),
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.