use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionBatchGetKV.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testCollectionBatchGetKV(RestliRequestOptions requestOptions) throws RemoteInvocationException {
Request<BatchKVResponse<CustomLong, Greeting>> request = new CustomTypes2Builders(requestOptions).batchGet().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).buildKV();
Map<CustomLong, Greeting> greetings = getClient().sendRequest(request).getResponse().getEntity().getResults();
Assert.assertEquals(greetings.size(), 3);
Assert.assertEquals(greetings.get(new CustomLong(1L)).getId().longValue(), 1L);
Assert.assertEquals(greetings.get(new CustomLong(2L)).getId().longValue(), 2L);
Assert.assertEquals(greetings.get(new CustomLong(3L)).getId().longValue(), 3L);
}
use of com.linkedin.restli.examples.custom.types.CustomLong 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.examples.custom.types.CustomLong 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.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionGet.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BuilderDataProvider")
public void testCollectionGet(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException {
Long lo = 5L;
Request<Greeting> request = builders.get().id(new CustomLong(lo)).build();
Greeting result = getClient().sendRequest(request).getResponse().getEntity();
Assert.assertEquals(result.getId(), lo);
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testAction.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testAction(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
Long lo = 5L;
Request<Long> request = builders.<Long>action("Action").setActionParam("L", new CustomLong(lo)).build();
Long result = getClient().sendRequest(request).getResponse().getEntity();
Assert.assertEquals(result, lo);
}
Aggregations