use of com.linkedin.restli.examples.greetings.client.TyperefKeysRequestBuilders in project rest.li by linkedin.
the class TestTyperefKeysResource method testCreateId.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testCreateId(RestliRequestOptions requestOptions) throws RemoteInvocationException {
Greeting greeting = new Greeting().setId(1L).setMessage("Foo").setTone(Tone.FRIENDLY);
CreateIdRequest<Long, Greeting> req = new TyperefKeysRequestBuilders(requestOptions).create().input(greeting).build();
Response<IdResponse<Long>> resp = getClient().sendRequest(req).getResponse();
Assert.assertEquals(resp.getEntity().getId(), Long.valueOf(1L));
}
use of com.linkedin.restli.examples.greetings.client.TyperefKeysRequestBuilders in project rest.li by linkedin.
the class TestTyperefKeysResource method testBatchGetEntity.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testBatchGetEntity(RestliRequestOptions requestOptions) throws RemoteInvocationException {
BatchGetEntityRequest<Long, Greeting> req = new TyperefKeysRequestBuilders(requestOptions).batchGet().ids(1L, 2L).build();
Response<BatchKVResponse<Long, EntityResponse<Greeting>>> resp = getClient().sendRequest(req).getResponse();
Map<Long, EntityResponse<Greeting>> results = resp.getEntity().getResults();
Assert.assertEquals(results.get(1L).getEntity().getId(), Long.valueOf(1L));
Assert.assertEquals(results.get(2L).getEntity().getId(), Long.valueOf(2L));
}
Aggregations