use of com.linkedin.restli.client.response.BatchKVResponse in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionBatchPartialUpdate.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BuilderDataProvider")
public void testCollectionBatchPartialUpdate(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException {
RequestBuilder<? extends Request<BatchKVResponse<CustomLong, UpdateStatus>>> request = builders.batchPartialUpdate().input(new CustomLong(1L), new PatchRequest<Greeting>()).input(new CustomLong(2L), new PatchRequest<Greeting>()).getBuilder();
Map<CustomLong, UpdateStatus> statuses = getClient().sendRequest(request).getResponse().getEntity().getResults();
Assert.assertEquals(statuses.size(), 2);
Assert.assertEquals(statuses.get(new CustomLong(1L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
Assert.assertEquals(statuses.get(new CustomLong(2L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
}
use of com.linkedin.restli.client.response.BatchKVResponse in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionBatchUpdate.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BuilderDataProvider")
public void testCollectionBatchUpdate(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException {
RequestBuilder<? extends Request<BatchKVResponse<CustomLong, UpdateStatus>>> request = builders.batchUpdate().input(new CustomLong(1L), new Greeting().setId(1)).input(new CustomLong(2L), new Greeting().setId(2)).getBuilder();
Map<CustomLong, UpdateStatus> statuses = getClient().sendRequest(request).getResponse().getEntity().getResults();
Assert.assertEquals(statuses.size(), 2);
Assert.assertEquals(statuses.get(new CustomLong(1L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
Assert.assertEquals(statuses.get(new CustomLong(2L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
}
use of com.linkedin.restli.client.response.BatchKVResponse in project rest.li by linkedin.
the class TestEscapeCharsInStringKeys method testBatchGetKVWithSimpleKey.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestStringKeysOptionsDataProvider")
public void testBatchGetKVWithSimpleKey(RestliRequestOptions requestOptions) throws Exception {
Set<String> keys = new HashSet<String>();
keys.add(key1());
keys.add(key2());
Request<BatchKVResponse<String, Message>> req = new StringKeysBuilders(requestOptions).batchGet().ids(keys).buildKV();
BatchKVResponse<String, Message> response = getClient().sendRequest(req).get().getEntity();
Map<String, Message> results = response.getResults();
Assert.assertEquals(results.get(key1()).getMessage(), key1(), "Message should match key for key1");
Assert.assertEquals(results.get(key2()).getMessage(), key2(), "Message should match key for key2");
}
use of com.linkedin.restli.client.response.BatchKVResponse in project rest.li by linkedin.
the class TestGreetingClientContentTypes method testBatchGetKV.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "clientDataBatchDataProvider")
public void testBatchGetKV(RestClient restClient, RestliRequestOptions requestOptions) throws RemoteInvocationException {
List<Long> ids = Arrays.asList(1L, 2L, 3L, 4L);
Request<BatchKVResponse<Long, Greeting>> request = new GreetingsBuilders(requestOptions).batchGet().ids(ids).buildKV();
Response<BatchKVResponse<Long, Greeting>> response = restClient.sendRequest(request).getResponse();
BatchKVResponse<Long, Greeting> batchResponse = response.getEntity();
Assert.assertEquals(batchResponse.getResults().size(), ids.size());
}
use of com.linkedin.restli.client.response.BatchKVResponse in project rest.li by linkedin.
the class TestClientBuilders method testCrudBuilderParams10.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "batchSingleWithParam")
public void testCrudBuilderParams10(URIDetails expectedURIDetails) {
Request<BatchKVResponse<Long, UpdateStatus>> request = new BatchUpdateRequestBuilder<Long, TestRecord>(TEST_URI, TestRecord.class, _COLL_SPEC, RestliRequestOptions.DEFAULT_OPTIONS).input(1L, new TestRecord()).setParam("foo", "bar").build();
URIDetails.testUriGeneration(request, expectedURIDetails);
}
Aggregations