Search in sources :

Example 21 with CustomLong

use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.

the class TestCustomTypesClient method testCustomLongArray.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testCustomLongArray(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
    List<CustomLong> ls = new ArrayList<CustomLong>(2);
    ls.add(new CustomLong(1L));
    ls.add(new CustomLong(2L));
    Request<CollectionResponse<Greeting>> request = builders.findBy("CustomLongArray").setQueryParam("ls", ls).build();
    List<Greeting> elements = getClient().sendRequest(request).getResponse().getEntity().getElements();
    Assert.assertEquals(elements.size(), 0);
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) CollectionResponse(com.linkedin.restli.common.CollectionResponse) ArrayList(java.util.ArrayList) CustomLong(com.linkedin.restli.examples.custom.types.CustomLong) Test(org.testng.annotations.Test)

Example 22 with CustomLong

use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.

the class TestCustomTypesRequestBuilders method testCollectionBatchGetEntityKey.

@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BatchDataProvider")
public void testCollectionBatchGetEntityKey(ProtocolVersion version, String expectedUri) throws IOException, RestException {
    Request<BatchKVResponse<CustomLong, EntityResponse<Greeting>>> request = new CustomTypes2RequestBuilders().batchGet().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).build();
    checkRequestBuilder(request, ResourceMethod.BATCH_GET, BatchEntityResponseDecoder.class, expectedUri, null, version);
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) CustomTypes2RequestBuilders(com.linkedin.restli.examples.greetings.client.CustomTypes2RequestBuilders) CustomLong(com.linkedin.restli.examples.custom.types.CustomLong) BatchKVResponse(com.linkedin.restli.client.response.BatchKVResponse) Test(org.testng.annotations.Test)

Example 23 with CustomLong

use of com.linkedin.restli.examples.custom.types.CustomLong in project rest.li by linkedin.

the class CustomTypesResource3 method get.

@Override
public Greeting get(CompoundKey key) {
    CustomLong longId = (CustomLong) key.getPart("longId");
    Date dateId = (Date) key.getPart("dateId");
    return new Greeting().setId(longId.toLong() + dateId.getTime());
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) CustomLong(com.linkedin.restli.examples.custom.types.CustomLong) Date(java.util.Date)

Aggregations

CustomLong (com.linkedin.restli.examples.custom.types.CustomLong)23 Test (org.testng.annotations.Test)22 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)19 BatchKVResponse (com.linkedin.restli.client.response.BatchKVResponse)6 CustomNonNegativeLong (com.linkedin.restli.examples.custom.types.CustomNonNegativeLong)5 CustomTypes2Builders (com.linkedin.restli.examples.greetings.client.CustomTypes2Builders)5 CollectionResponse (com.linkedin.restli.common.CollectionResponse)4 CustomTypes2RequestBuilders (com.linkedin.restli.examples.greetings.client.CustomTypes2RequestBuilders)4 Date (java.util.Date)4 ByteString (com.linkedin.data.ByteString)3 CompoundKey (com.linkedin.restli.common.CompoundKey)3 UpdateStatus (com.linkedin.restli.common.UpdateStatus)3 CustomTypes3Builders (com.linkedin.restli.examples.greetings.client.CustomTypes3Builders)3 BatchCreateIdResponse (com.linkedin.restli.common.BatchCreateIdResponse)2 BatchResponse (com.linkedin.restli.common.BatchResponse)2 CreateIdStatus (com.linkedin.restli.common.CreateIdStatus)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 CreateResponse (com.linkedin.restli.client.response.CreateResponse)1 CreateStatus (com.linkedin.restli.common.CreateStatus)1