Package com.linkedin.r2.message.rest

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


  }

  @Test
  public void testRestReqWithEntity() throws IOException
  {
    final RestRequest expected = new RestRequestBuilder(URI.create("http://localhost:1234"))
            .setEntity(ByteString.copyString("This is a simple entity!", "ASCII"))
            .setHeader("field-name1", "field-val1")
            .setHeader("field-name2", "field-val2")
            .build();
    assertMsgEquals(expected, _serializer.readRestRequest(getResource("rest-req-with-entity.txt")));
View Full Code Here


  public void testRoutingDetailsSimplePartialUpdate(ProtocolVersion version, String uri) throws Exception
  {
    Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(TrendingResource.class);
    _router = new RestLiRouter(pathRootResourceMap);

    RestRequest request = createRequest(uri, "POST", version);

    RoutingResult result = _router.process(request, new RequestContext());
    assertNotNull(result);

    ResourceMethodDescriptor resourceMethodDescriptor = result.getResourceMethod();
View Full Code Here

  }

  @Test
  public void testRpcReqWithEmptyHeaderValue() throws IOException
  {
    final RestRequest expected = new RestRequestBuilder(URI.create("http://localhost:1234"))
            .setHeader("field-name1", "")
            .build();
    assertMsgEquals(expected, _serializer.readRestRequest(getResource("rest-req-with-empty-header-value.txt")));
  }
View Full Code Here

  @Test
  public void testRestReqWithUppercaseHeaderNames() throws IOException
  {
    // Note that we're using lowercase field names here. We expect that canonicalization will
    // treat these the same
    final RestRequest expected = new RestRequestBuilder(URI.create("http://localhost:1234"))
            .setHeader("field-name1", "field-val1")
            .setHeader("field-name2", "field-val2")
            .build();
    assertMsgEquals(expected, _serializer.readRestRequest(getResource("rest-req-with-uppercase-header-names.txt")));
  }
View Full Code Here

  }

  @Test
  public void testRestReqWithMultilineHeader() throws IOException
  {
    final RestRequest expected = new RestRequestBuilder(URI.create("http://localhost:1234"))
            .setHeader("field-name1", "field-val1\ncontinuation-of-last-field:abc")
            .build();

    assertMsgEquals(expected, _serializer.readRestRequest(getResource("rest-req-with-multiline-header.txt")));
  }
View Full Code Here

  }

  @Test
  public void testRestRequestReversible1() throws IOException
  {
    final RestRequest req = createRestRequest();
    assertMsgEquals(req, readRestReq(writeReq(req)));
  }
View Full Code Here

  public void testRoutingDetailsSimpleDelete(ProtocolVersion version, String uri) throws Exception
  {
    Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(TrendingResource.class);
    _router = new RestLiRouter(pathRootResourceMap);

    RestRequest request = createRequest(uri, "DELETE", version);

    RoutingResult result = _router.process(request, new RequestContext());
    assertNotNull(result);

    ResourceMethodDescriptor resourceMethodDescriptor = result.getResourceMethod();
View Full Code Here

  }

  @Test
  public void testRestRequestReversible2() throws IOException
  {
    final RestRequest req = createRestRequest().builder()
            .setMethod(RestMethod.POST)
            .build();
    assertMsgEquals(req, readRestReq(writeReq(req)));
  }
View Full Code Here

  }

  @Test
  public void testRestRequestReversible3() throws IOException
  {
    final RestRequest req = createRestRequest().builder()
            .setEntity(new byte[] {1,2,3,4})
            .build();
    assertMsgEquals(req, readRestReq(writeReq(req)));
  }
View Full Code Here

  }

  @Test
  public void testRestRequestReversible4() throws IOException
  {
    final RestRequest req = createRestRequest().builder()
            .setHeader("field-key1", "field-val1")
            .setHeader("field-key2", "field-val2")
            .build();
    assertMsgEquals(req, readRestReq(writeReq(req)));
  }
View Full Code Here

TOP

Related Classes of com.linkedin.r2.message.rest.RestRequest

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.