Search in sources :

Example 6 with ComplexArray

use of com.linkedin.restli.examples.greetings.api.ComplexArray in project rest.li by linkedin.

the class TestComplexArrayResource method testBatchGet.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "versionWithRequestOptionsDataProvider")
public void testBatchGet(ProtocolVersion version, RestliRequestOptions options) throws RemoteInvocationException {
    List<ComplexResourceKey<ComplexArray, ComplexArray>> complexKeys = getBatchCompleKeys();
    ComplexArrayBuilders builders = new ComplexArrayBuilders(options);
    Request<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> request = builders.batchGet().ids(complexKeys).buildKV();
    Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> response = getClient().sendRequest(request).getResponse();
    Greeting greeting1 = response.getEntity().getResults().get(complexKeys.get(0));
    Assert.assertNotNull(greeting1);
    Greeting greeting2 = response.getEntity().getResults().get(complexKeys.get(1));
    Assert.assertNotNull(greeting2);
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) ComplexArrayBuilders(com.linkedin.restli.examples.greetings.client.ComplexArrayBuilders) ComplexResourceKey(com.linkedin.restli.common.ComplexResourceKey) ComplexArray(com.linkedin.restli.examples.greetings.api.ComplexArray) BatchKVResponse(com.linkedin.restli.client.response.BatchKVResponse) Test(org.testng.annotations.Test)

Example 7 with ComplexArray

use of com.linkedin.restli.examples.greetings.api.ComplexArray in project rest.li by linkedin.

the class TestComplexArrayResource method testFinder.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testFinder(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<CollectionResponse<Greeting>> request = builders.findBy("Finder").setQueryParam("array", array).build();
    getClient().sendRequest(request).getResponse().getEntity();
}
Also used : LongArray(com.linkedin.data.template.LongArray) CollectionResponse(com.linkedin.restli.common.CollectionResponse) ComplexArray(com.linkedin.restli.examples.greetings.api.ComplexArray) Test(org.testng.annotations.Test)

Aggregations

ComplexArray (com.linkedin.restli.examples.greetings.api.ComplexArray)7 Test (org.testng.annotations.Test)6 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)5 LongArray (com.linkedin.data.template.LongArray)4 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)4 BatchKVResponse (com.linkedin.restli.client.response.BatchKVResponse)3 ComplexArrayBuilders (com.linkedin.restli.examples.greetings.client.ComplexArrayBuilders)2 CollectionResponse (com.linkedin.restli.common.CollectionResponse)1 ComplexArrayRequestBuilders (com.linkedin.restli.examples.greetings.client.ComplexArrayRequestBuilders)1 ArrayList (java.util.ArrayList)1