Search in sources :

Example 1 with AssociationsBuilders

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

the class TestAssociationsResource method testBatchGet.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testBatchGet(RestliRequestOptions requestOptions) throws RemoteInvocationException {
    Request<BatchKVResponse<CompoundKey, Message>> request = new AssociationsBuilders(requestOptions).batchGet().ids(DB.keySet()).buildKV();
    ResponseFuture<BatchKVResponse<CompoundKey, Message>> responseFuture = getClient().sendRequest(request);
    Response<BatchKVResponse<CompoundKey, Message>> response = responseFuture.getResponse();
    BatchKVResponse<CompoundKey, Message> entity = response.getEntity();
    Assert.assertEquals(entity.getErrors().size(), 0);
    Assert.assertEquals(entity.getResults().size(), 2);
    for (CompoundKey id : DB.keySet()) {
        Assert.assertTrue(entity.getResults().containsKey(id));
        Assert.assertEquals(entity.getResults().get(id), DB.get(id));
    }
}
Also used : AssociationsBuilders(com.linkedin.restli.examples.greetings.client.AssociationsBuilders) Message(com.linkedin.restli.examples.greetings.api.Message) CompoundKey(com.linkedin.restli.common.CompoundKey) BatchKVResponse(com.linkedin.restli.client.response.BatchKVResponse) Test(org.testng.annotations.Test)

Aggregations

BatchKVResponse (com.linkedin.restli.client.response.BatchKVResponse)1 CompoundKey (com.linkedin.restli.common.CompoundKey)1 Message (com.linkedin.restli.examples.greetings.api.Message)1 AssociationsBuilders (com.linkedin.restli.examples.greetings.client.AssociationsBuilders)1 Test (org.testng.annotations.Test)1