Search in sources :

Example 56 with RestRequest

use of com.linkedin.r2.message.rest.RestRequest in project rest.li by linkedin.

the class TestDebugRequestHandlers method testParseqTraceDebugPutRequestHandlerTracevis.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testParseqTraceDebugPutRequestHandlerTracevis(RootBuilderWrapper<Long, Greeting> builders) throws URISyntaxException, ExecutionException, InterruptedException, RemoteInvocationException {
    Long newId = createNewGreetingOnTheServer(builders);
    RestRequest request = new RestRequestBuilder(new URI(URI_PREFIX + "greetingsPromise/" + newId + "/__debug/parseqtrace/tracevis")).setMethod("PUT").setEntity(createNewGreetingBytes(newId)).build();
    sendRequestAndVerifyParseqTracevisResponse(request);
}
Also used : RestRequest(com.linkedin.r2.message.rest.RestRequest) RestRequestBuilder(com.linkedin.r2.message.rest.RestRequestBuilder) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 57 with RestRequest

use of com.linkedin.r2.message.rest.RestRequest in project rest.li by linkedin.

the class TestDebugRequestHandlers method testParseqTraceDebugPostRequestHandlerRaw.

@Test
public void testParseqTraceDebugPostRequestHandlerRaw() throws URISyntaxException, ExecutionException, InterruptedException {
    RestRequest request = new RestRequestBuilder(new URI(URI_PREFIX + "greetingsPromise/__debug/parseqtrace/raw")).setMethod("POST").setEntity(createNewGreetingBytes(444L)).build();
    sendRequestAndVerifyParseqTraceRaw(request);
}
Also used : RestRequest(com.linkedin.r2.message.rest.RestRequest) RestRequestBuilder(com.linkedin.r2.message.rest.RestRequestBuilder) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 58 with RestRequest

use of com.linkedin.r2.message.rest.RestRequest in project rest.li by linkedin.

the class TestDebugRequestHandlers method testParseqTraceDebugPostRequestHandlerTracevis.

@Test
public void testParseqTraceDebugPostRequestHandlerTracevis() throws URISyntaxException, ExecutionException, InterruptedException {
    RestRequest request = new RestRequestBuilder(new URI(URI_PREFIX + "greetingsPromise/__debug/parseqtrace/tracevis")).setMethod("POST").setEntity(createNewGreetingBytes(444L)).build();
    sendRequestAndVerifyParseqTracevisResponse(request);
}
Also used : RestRequest(com.linkedin.r2.message.rest.RestRequest) RestRequestBuilder(com.linkedin.r2.message.rest.RestRequestBuilder) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 59 with RestRequest

use of com.linkedin.r2.message.rest.RestRequest in project rest.li by linkedin.

the class TestDebugRequestHandlers method testParseqTraceDebugPutRequestHandlerRaw.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testParseqTraceDebugPutRequestHandlerRaw(RootBuilderWrapper<Long, Greeting> builders) throws URISyntaxException, ExecutionException, InterruptedException, RemoteInvocationException {
    Long newId = createNewGreetingOnTheServer(builders);
    RestRequest request = new RestRequestBuilder(new URI(URI_PREFIX + "greetingsPromise/" + newId + "/__debug/parseqtrace/raw")).setMethod("PUT").setEntity(createNewGreetingBytes(newId)).build();
    sendRequestAndVerifyParseqTraceRaw(request);
}
Also used : RestRequest(com.linkedin.r2.message.rest.RestRequest) RestRequestBuilder(com.linkedin.r2.message.rest.RestRequestBuilder) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 60 with RestRequest

use of com.linkedin.r2.message.rest.RestRequest in project rest.li by linkedin.

the class TestDebugRequestHandlers method sendRequestAndVerifyParseqTracevisResponse.

private void sendRequestAndVerifyParseqTracevisResponse(RestRequest request) throws InterruptedException, ExecutionException {
    Future<RestResponse> restResponseFuture = getDefaultTransportClient().restRequest(request);
    RestResponse restResponse = restResponseFuture.get();
    Assert.assertEquals(restResponse.getStatus(), 200);
    List<String> contentTypeValues = restResponse.getHeaderValues(RestConstants.HEADER_CONTENT_TYPE);
    Assert.assertTrue(contentTypeValues.size() == 1);
    Assert.assertEquals(contentTypeValues.get(0), HEADER_VALUE_TEXT_HTML);
}
Also used : RestResponse(com.linkedin.r2.message.rest.RestResponse)

Aggregations

RestRequest (com.linkedin.r2.message.rest.RestRequest)293 Test (org.testng.annotations.Test)243 RestRequestBuilder (com.linkedin.r2.message.rest.RestRequestBuilder)174 RequestContext (com.linkedin.r2.message.RequestContext)154 RestResponse (com.linkedin.r2.message.rest.RestResponse)147 URI (java.net.URI)124 ByteString (com.linkedin.data.ByteString)65 RoutingResult (com.linkedin.restli.internal.server.RoutingResult)62 FutureCallback (com.linkedin.common.callback.FutureCallback)50 RestException (com.linkedin.r2.message.rest.RestException)49 ResourceMethodDescriptor (com.linkedin.restli.internal.server.model.ResourceMethodDescriptor)44 ExecutionException (java.util.concurrent.ExecutionException)43 StreamResponse (com.linkedin.r2.message.stream.StreamResponse)38 ResourceModel (com.linkedin.restli.internal.server.model.ResourceModel)36 HashMap (java.util.HashMap)35 StreamRequest (com.linkedin.r2.message.stream.StreamRequest)33 Map (java.util.Map)28 Callback (com.linkedin.common.callback.Callback)27 URISyntaxException (java.net.URISyntaxException)25 ResourceContext (com.linkedin.restli.server.ResourceContext)24