use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesRequestBuilders method testAssociationKeys.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request3BuilderDataProviderEntity")
public void testAssociationKeys(RootBuilderWrapper<CompoundKey, Greeting> builders, ProtocolVersion version, String expectedUri) throws IOException, RestException {
// normally coercer registration is handled in RestliAnnotationReader,
// but that isn't run here because this is just a unit test. So, we need to
// force registration of the DateCoercer because it isn't contained in Date itself.
new DateCoercer();
CustomTypes3Builders.Key key = new CustomTypes3Builders.Key().setLongId(new CustomLong(5L)).setDateId(new Date(13L));
Request<Greeting> request = builders.get().id(key).build();
checkRequestBuilder(request, ResourceMethod.GET, EntityResponseDecoder.class, expectedUri, null, version);
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesRequestBuilders method testCollectionChildGetKey.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request4BuilderDataProviderEntity")
public void testCollectionChildGetKey(RootBuilderWrapper<CustomLong, Greeting> builders, ProtocolVersion version, String expectedUri) throws IOException, RestException {
Request<Greeting> request = builders.get().setPathKey("customTypes2Id", new CustomLong(1L)).id(new CustomLong(7L)).build();
checkRequestBuilder(request, ResourceMethod.GET, EntityResponseDecoder.class, expectedUri, null, version);
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesRequestBuilders method testFinderCustomLongArray.
// test correct request is built for customLongArray
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request1BuilderDataProviderCustomLongArrayFinder")
public void testFinderCustomLongArray(RootBuilderWrapper<Long, Greeting> builders, ProtocolVersion version, String expectedUri) throws IOException, RestException {
List<CustomLong> ls = new ArrayList<CustomLong>(2);
ls.add(new CustomLong(2L));
ls.add(new CustomLong(4L));
Request<CollectionResponse<Greeting>> request = builders.findBy("CustomLongArray").setQueryParam("ls", ls).build();
checkRequestBuilder(request, ResourceMethod.FINDER, CollectionResponseDecoder.class, expectedUri, null, version);
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testCollectionSubResourceGet.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request4BuilderDataProvider")
public void testCollectionSubResourceGet(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException {
Long id2 = 2L;
Long id4 = 4L;
Request<Greeting> request = builders.get().setPathKey("customTypes2Id", new CustomLong(id2)).id(new CustomLong(id4)).build();
Greeting result = getClient().sendRequest(request).getResponse().getEntity();
Assert.assertEquals(result.getId(), new Long(id2 * id4));
}
use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.
the class TestCustomTypesClient method testCustomLongArrayOnAction.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testCustomLongArrayOnAction(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
CustomLongRefArray ls = new CustomLongRefArray();
ls.add(new CustomLong(1L));
ls.add(new CustomLong(2L));
Request<CustomLongRefArray> request = builders.<CustomLongRefArray>action("ArrayAction").setActionParam("Ls", ls).build();
CustomLongRefArray elements = getClient().sendRequest(request).getResponse().getEntity();
Assert.assertEquals(elements.size(), 2);
Assert.assertEquals(elements.get(0).toLong().longValue(), 1L);
Assert.assertEquals(elements.get(1).toLong().longValue(), 2L);
}
Aggregations