use of com.linkedin.restli.examples.greetings.client.AssociationsRequestBuilders in project rest.li by linkedin.
the class TestAssociationsResource method testBatchGetEntity.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testBatchGetEntity(RestliRequestOptions requestOptions) throws RemoteInvocationException {
Request<BatchKVResponse<CompoundKey, EntityResponse<Message>>> request = new AssociationsRequestBuilders(requestOptions).batchGet().ids(DB.keySet()).build();
ResponseFuture<BatchKVResponse<CompoundKey, EntityResponse<Message>>> responseFuture = getClient().sendRequest(request);
Response<BatchKVResponse<CompoundKey, EntityResponse<Message>>> response = responseFuture.getResponse();
BatchKVResponse<CompoundKey, EntityResponse<Message>> entityResponse = response.getEntity();
Assert.assertEquals(entityResponse.getErrors().size(), 0);
Assert.assertEquals(entityResponse.getResults().size(), 2);
for (CompoundKey id : DB.keySet()) {
EntityResponse<Message> single = entityResponse.getResults().get(id);
Assert.assertTrue(entityResponse.getResults().containsKey(id));
Assert.assertEquals(single.getEntity(), DB.get(id));
}
}
Aggregations