use of com.linkedin.restli.examples.greetings.api.ComplexArray in project rest.li by linkedin.
the class TestComplexArrayResource method testGet.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testGet(RootBuilderWrapper<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting> builders) throws RemoteInvocationException, CloneNotSupportedException {
// all array are singletons with single element
LongArray singleton = new LongArray();
singleton.add(1L);
ComplexArray next = new ComplexArray().setArray(singleton);
ComplexArray key = new ComplexArray().setArray(singleton).setNext(next);
ComplexArray params = new ComplexArray().setArray(singleton).setNext(next);
ComplexResourceKey<ComplexArray, ComplexArray> complexKey = new ComplexResourceKey<ComplexArray, ComplexArray>(key, params);
Request<Greeting> request = builders.get().id(complexKey).build();
getClient().sendRequest(request).getResponse().getEntity();
}
use of com.linkedin.restli.examples.greetings.api.ComplexArray in project rest.li by linkedin.
the class TestComplexArrayResource method testAction.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testAction(RootBuilderWrapper<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting> builders) throws RemoteInvocationException {
LongArray singleton = new LongArray();
singleton.add(1L);
ComplexArray next = new ComplexArray().setArray(singleton);
ComplexArray array = new ComplexArray().setArray(singleton).setNext(next);
Request<Integer> request = builders.<Integer>action("Action").setActionParam("Array", array).build();
getClient().sendRequest(request).getResponse().getEntity();
}
use of com.linkedin.restli.examples.greetings.api.ComplexArray in project rest.li by linkedin.
the class TestComplexArrayResource method testBatchGetEntity.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "versionWithRequestOptionsDataProvider")
public void testBatchGetEntity(ProtocolVersion version, RestliRequestOptions options) throws RemoteInvocationException {
List<ComplexResourceKey<ComplexArray, ComplexArray>> complexKeys = getBatchCompleKeys();
ComplexArrayRequestBuilders builders = new ComplexArrayRequestBuilders(options);
Request<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, EntityResponse<Greeting>>> request2 = builders.batchGet().ids(complexKeys).build();
Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, EntityResponse<Greeting>>> response2 = getClient().sendRequest(request2).getResponse();
EntityResponse<Greeting> greeting1 = response2.getEntity().getResults().get(complexKeys.get(0));
Assert.assertNotNull(greeting1);
EntityResponse<Greeting> greeting2 = response2.getEntity().getResults().get(complexKeys.get(1));
Assert.assertNotNull(greeting2);
}
use of com.linkedin.restli.examples.greetings.api.ComplexArray in project rest.li by linkedin.
the class TestComplexArrayResource method testBatchGetKV.
@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "versionWithRequestOptionsDataProvider")
public void testBatchGetKV(ProtocolVersion version, RestliRequestOptions options) throws RemoteInvocationException {
List<ComplexResourceKey<ComplexArray, ComplexArray>> complexKeys = getBatchCompleKeys();
ComplexArrayBuilders builders = new ComplexArrayBuilders(options);
Request<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> request2 = builders.batchGet().ids(complexKeys).buildKV();
Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> response2 = getClient().sendRequest(request2).getResponse();
Greeting greeting1 = response2.getEntity().getResults().get(complexKeys.get(0));
Assert.assertNotNull(greeting1);
Greeting greeting2 = response2.getEntity().getResults().get(complexKeys.get(1));
Assert.assertNotNull(greeting2);
}
use of com.linkedin.restli.examples.greetings.api.ComplexArray in project rest.li by linkedin.
the class TestComplexArrayResource method getBatchCompleKeys.
private static List<ComplexResourceKey<ComplexArray, ComplexArray>> getBatchCompleKeys() {
LongArray singleton1 = new LongArray();
singleton1.add(1L);
ComplexArray next1 = new ComplexArray().setArray(singleton1);
ComplexArray key1 = new ComplexArray().setArray(singleton1).setNext(next1);
ComplexArray params1 = new ComplexArray().setArray(singleton1).setNext(next1);
ComplexResourceKey<ComplexArray, ComplexArray> complexKey1 = new ComplexResourceKey<ComplexArray, ComplexArray>(key1, params1);
LongArray singleton2 = new LongArray();
singleton2.add(2L);
ComplexArray next2 = new ComplexArray().setArray(singleton2);
ComplexArray key2 = new ComplexArray().setArray(singleton2).setNext(next2);
ComplexArray params2 = new ComplexArray().setArray(singleton2).setNext(next2);
ComplexResourceKey<ComplexArray, ComplexArray> complexKey2 = new ComplexResourceKey<ComplexArray, ComplexArray>(key2, params2);
List<ComplexResourceKey<ComplexArray, ComplexArray>> complexKeys = new ArrayList<ComplexResourceKey<ComplexArray, ComplexArray>>();
complexKeys.add(complexKey1);
complexKeys.add(complexKey2);
return complexKeys;
}
Aggregations