use of com.linkedin.restli.examples.greetings.client.BatchGreetingRequestBuilders in project rest.li by linkedin.
the class TestMaxBatchSize method testBatchGetWithMaxBatchSizeBeyondLimitation.
@Test
public void testBatchGetWithMaxBatchSizeBeyondLimitation() throws RemoteInvocationException {
BatchGetEntityRequest<Long, Greeting> request = new BatchGreetingRequestBuilders().batchGet().ids(1l, 2l, 3l).build();
try {
getClient().sendRequest(request).getResponse();
Assert.fail("The batch size is larger than the allowed max batch size should cause an exception.");
} catch (RestLiResponseException e) {
Assert.assertEquals(e.getStatus(), HttpStatus.S_400_BAD_REQUEST.getCode());
Assert.assertEquals(e.getServiceErrorMessage(), "The request batch size: " + "3 is larger than the allowed max batch size: 2 for method: batch_get");
}
}
use of com.linkedin.restli.examples.greetings.client.BatchGreetingRequestBuilders in project rest.li by linkedin.
the class TestMaxBatchSize method testBatchGetWithMaxBatchSizeUnderLimitation.
@Test
public void testBatchGetWithMaxBatchSizeUnderLimitation() throws RemoteInvocationException {
BatchGetEntityRequest<Long, Greeting> request = new BatchGreetingRequestBuilders().batchGet().ids(1l, 2l).build();
Response<BatchKVResponse<Long, EntityResponse<Greeting>>> response = getClient().sendRequest(request).getResponse();
Assert.assertEquals(response.getStatus(), 200);
Assert.assertEquals(response.getEntity().getResults().keySet().size(), 2);
}
Aggregations