Search in sources :

Example 1 with ComplexArrayRequestBuilders

use of com.linkedin.restli.examples.greetings.client.ComplexArrayRequestBuilders in project rest.li by linkedin.

the class TestComplexArrayResource method testBatchGetEntity.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "versionWithRequestOptionsDataProvider")
public void testBatchGetEntity(ProtocolVersion version, RestliRequestOptions options) throws RemoteInvocationException {
    List<ComplexResourceKey<ComplexArray, ComplexArray>> complexKeys = getBatchCompleKeys();
    ComplexArrayRequestBuilders builders = new ComplexArrayRequestBuilders(options);
    Request<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, EntityResponse<Greeting>>> request2 = builders.batchGet().ids(complexKeys).build();
    Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, EntityResponse<Greeting>>> response2 = getClient().sendRequest(request2).getResponse();
    EntityResponse<Greeting> greeting1 = response2.getEntity().getResults().get(complexKeys.get(0));
    Assert.assertNotNull(greeting1);
    EntityResponse<Greeting> greeting2 = response2.getEntity().getResults().get(complexKeys.get(1));
    Assert.assertNotNull(greeting2);
}
Also used : ComplexArrayRequestBuilders(com.linkedin.restli.examples.greetings.client.ComplexArrayRequestBuilders) Greeting(com.linkedin.restli.examples.greetings.api.Greeting) ComplexResourceKey(com.linkedin.restli.common.ComplexResourceKey) ComplexArray(com.linkedin.restli.examples.greetings.api.ComplexArray) BatchKVResponse(com.linkedin.restli.client.response.BatchKVResponse) Test(org.testng.annotations.Test)

Aggregations

BatchKVResponse (com.linkedin.restli.client.response.BatchKVResponse)1 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)1 ComplexArray (com.linkedin.restli.examples.greetings.api.ComplexArray)1 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)1 ComplexArrayRequestBuilders (com.linkedin.restli.examples.greetings.client.ComplexArrayRequestBuilders)1 Test (org.testng.annotations.Test)1