use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionCreate.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testCollectionCreate(RestliRequestOptions requestOptions) throws RemoteInvocationException {
CreateRequest<Greeting> request = new CustomTypes2Builders(requestOptions).create().input(new Greeting().setId(10)).build();
Response<EmptyRecord> response = getClient().sendRequest(request).getResponse();
Assert.assertEquals(response.getStatus(), HttpStatus.S_201_CREATED.getCode());
@SuppressWarnings("unchecked") CreateResponse<CustomLong> createResponse = (CreateResponse<CustomLong>) response.getEntity();
Assert.assertEquals(createResponse.getId(), new CustomLong(10L));
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesRequestBuilders method testCollectionBatchGetKey.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BatchDataProvider")
public void testCollectionBatchGetKey(ProtocolVersion version, String expectedUri) throws IOException, RestException {
Request<BatchResponse<Greeting>> request = new CustomTypes2Builders().batchGet().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).build();
checkRequestBuilder(request, ResourceMethod.BATCH_GET, BatchResponseDecoder.class, expectedUri, null, version);
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionBatchGet.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testCollectionBatchGet(RestliRequestOptions requestOptions) throws RemoteInvocationException {
Request<BatchResponse<Greeting>> request = new CustomTypes2Builders(requestOptions).batchGet().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).build();
Map<String, Greeting> greetings = getClient().sendRequest(request).getResponse().getEntity().getResults();
Assert.assertEquals(greetings.size(), 3);
Assert.assertEquals(greetings.get("1").getId().longValue(), 1L);
Assert.assertEquals(greetings.get("2").getId().longValue(), 2L);
Assert.assertEquals(greetings.get("3").getId().longValue(), 3L);
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testAssociationGet.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request3BuilderDataProvider")
public void testAssociationGet(RootBuilderWrapper<CompoundKey, Greeting> builders) throws RemoteInvocationException {
Long lo = 5L;
Long date = 13L;
CustomTypes3Builders.Key key = new CustomTypes3Builders.Key().setLongId(new CustomLong(lo)).setDateId(new Date(date));
Request<Greeting> request = builders.get().id(key).build();
Greeting result = getClient().sendRequest(request).getResponse().getEntity();
Assert.assertEquals(result.getId(), new Long(lo + date));
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionCreateId.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
public void testCollectionCreateId(RestliRequestOptions requestOptions) throws RemoteInvocationException {
CreateIdRequest<CustomLong, Greeting> request = new CustomTypes2RequestBuilders(requestOptions).create().input(new Greeting().setId(10)).build();
Response<IdResponse<CustomLong>> response = getClient().sendRequest(request).getResponse();
Assert.assertEquals(response.getStatus(), HttpStatus.S_201_CREATED.getCode());
Assert.assertEquals(response.getEntity().getId(), new CustomLong(10L));
}
Aggregations