use of com.linkedin.restli.examples.custom.types.CustomNonNegativeLong in project rest.li by linkedin.
the class ChainedTyperefResource method get.
@Override
public Greeting get(CompoundKey key) {
CustomNonNegativeLong age = (CustomNonNegativeLong) key.getPart("age");
Date birthday = (Date) key.getPart("birthday");
return new Greeting().setId(age.toLong() + birthday.getTime());
}
use of com.linkedin.restli.examples.custom.types.CustomNonNegativeLong in project rest.li by linkedin.
the class TestCustomTypesClient method testBatchUpdateForChainedRefs.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestChainedTyperefsBuilderDataProvider")
public void testBatchUpdateForChainedRefs(RootBuilderWrapper<CompoundKey, Greeting> builders) throws RemoteInvocationException {
Long lo = 29L;
Long date = 10L;
ChainedTyperefsBuilders.Key key = new ChainedTyperefsBuilders.Key().setAge(new CustomNonNegativeLong(lo)).setBirthday(new Date(date));
RequestBuilder<? extends Request<BatchKVResponse<CompoundKey, UpdateStatus>>> batchUpdateRequest = builders.batchUpdate().input(key, new Greeting().setId(1).setMessage("foo")).getBuilder();
BatchKVResponse<CompoundKey, UpdateStatus> response = getClient().sendRequest(batchUpdateRequest).getResponse().getEntity();
Assert.assertEquals(1, response.getResults().keySet().size());
CompoundKey expected = new CompoundKey();
expected.append("birthday", new Date(date));
expected.append("age", new CustomNonNegativeLong(lo));
CompoundKey result = response.getResults().keySet().iterator().next();
Assert.assertEquals(result, expected);
}
Aggregations