Search in sources :

Example 46 with Request

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

the class TestComplexKeysResource method testBatchGetEntityEmpty.

@SuppressWarnings("deprecation")
public void testBatchGetEntityEmpty(BatchGetEntityRequestBuilder<ComplexResourceKey<TwoPartKey, TwoPartKey>, Message> builder) throws Exception {
    final Request<BatchKVResponse<ComplexResourceKey<TwoPartKey, TwoPartKey>, EntityResponse<Message>>> request = builder.build();
    final FutureCallback<RestResponse> callback = new FutureCallback<RestResponse>();
    getClient().sendRestRequest(request, new RequestContext(), callback);
    final RestResponse result = callback.get();
    final DataMap responseMap = DataMapUtils.readMap(result);
    final DataMap resultsMap = responseMap.getDataMap(BatchKVResponse.RESULTS);
    Assert.assertNotNull(resultsMap, "Response does not contain results map");
    Assert.assertTrue(resultsMap.isEmpty());
}
Also used : TwoPartKey(com.linkedin.restli.examples.greetings.api.TwoPartKey) Message(com.linkedin.restli.examples.greetings.api.Message) RestResponse(com.linkedin.r2.message.rest.RestResponse) RequestContext(com.linkedin.r2.message.RequestContext) BatchKVResponse(com.linkedin.restli.client.response.BatchKVResponse) FutureCallback(com.linkedin.common.callback.FutureCallback) DataMap(com.linkedin.data.DataMap)

Example 47 with Request

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

the class TestDebugRequestHandlers method testParseqTraceDebugRequestHandlerRaw.

@Test
public void testParseqTraceDebugRequestHandlerRaw() throws URISyntaxException, ExecutionException, InterruptedException {
    RestRequest request = new RestRequestBuilder(new URI(URI_PREFIX + "greetingsPromise/1/__debug/parseqtrace/raw")).setMethod("GET").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 48 with Request

use of com.linkedin.r2.message.Request 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 49 with Request

use of com.linkedin.r2.message.Request 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 50 with Request

use of com.linkedin.r2.message.Request 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)

Aggregations

Test (org.testng.annotations.Test)209 RestRequest (com.linkedin.r2.message.rest.RestRequest)189 RequestContext (com.linkedin.r2.message.RequestContext)124 URI (java.net.URI)112 RestResponse (com.linkedin.r2.message.rest.RestResponse)111 RestRequestBuilder (com.linkedin.r2.message.rest.RestRequestBuilder)105 ByteString (com.linkedin.data.ByteString)67 StreamRequest (com.linkedin.r2.message.stream.StreamRequest)61 RoutingResult (com.linkedin.restli.internal.server.RoutingResult)59 RestException (com.linkedin.r2.message.rest.RestException)54 StreamResponse (com.linkedin.r2.message.stream.StreamResponse)50 StreamRequestBuilder (com.linkedin.r2.message.stream.StreamRequestBuilder)47 ResourceMethodDescriptor (com.linkedin.restli.internal.server.model.ResourceMethodDescriptor)44 FutureCallback (com.linkedin.common.callback.FutureCallback)41 ResourceModel (com.linkedin.restli.internal.server.model.ResourceModel)38 HashMap (java.util.HashMap)38 Callback (com.linkedin.common.callback.Callback)34 FilterRequestContext (com.linkedin.restli.server.filter.FilterRequestContext)34 ExecutionException (java.util.concurrent.ExecutionException)33 BeforeTest (org.testng.annotations.BeforeTest)31