Search in sources :

Example 1 with ComplexArrayBuilders

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

the class TestComplexArrayResource method testBatchGetKV.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "versionWithRequestOptionsDataProvider")
public void testBatchGetKV(ProtocolVersion version, RestliRequestOptions options) throws RemoteInvocationException {
    List<ComplexResourceKey<ComplexArray, ComplexArray>> complexKeys = getBatchCompleKeys();
    ComplexArrayBuilders builders = new ComplexArrayBuilders(options);
    Request<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> request2 = builders.batchGet().ids(complexKeys).buildKV();
    Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> response2 = getClient().sendRequest(request2).getResponse();
    Greeting greeting1 = response2.getEntity().getResults().get(complexKeys.get(0));
    Assert.assertNotNull(greeting1);
    Greeting greeting2 = response2.getEntity().getResults().get(complexKeys.get(1));
    Assert.assertNotNull(greeting2);
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) ComplexArrayBuilders(com.linkedin.restli.examples.greetings.client.ComplexArrayBuilders) 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)

Example 2 with ComplexArrayBuilders

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

the class TestComplexArrayResource method testBatchGet.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "versionWithRequestOptionsDataProvider")
public void testBatchGet(ProtocolVersion version, RestliRequestOptions options) throws RemoteInvocationException {
    List<ComplexResourceKey<ComplexArray, ComplexArray>> complexKeys = getBatchCompleKeys();
    ComplexArrayBuilders builders = new ComplexArrayBuilders(options);
    Request<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> request = builders.batchGet().ids(complexKeys).buildKV();
    Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> response = getClient().sendRequest(request).getResponse();
    Greeting greeting1 = response.getEntity().getResults().get(complexKeys.get(0));
    Assert.assertNotNull(greeting1);
    Greeting greeting2 = response.getEntity().getResults().get(complexKeys.get(1));
    Assert.assertNotNull(greeting2);
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) ComplexArrayBuilders(com.linkedin.restli.examples.greetings.client.ComplexArrayBuilders) 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)2 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)2 ComplexArray (com.linkedin.restli.examples.greetings.api.ComplexArray)2 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)2 ComplexArrayBuilders (com.linkedin.restli.examples.greetings.client.ComplexArrayBuilders)2 Test (org.testng.annotations.Test)2