Search in sources :

Example 6 with Tone

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

the class TestGreetingsClient method testSearchWithTones.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
public void testSearchWithTones(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException {
    Request<CollectionResponse<Greeting>> req = builders.findBy("SearchWithTones").setQueryParam("tones", Arrays.asList(Tone.SINCERE, Tone.INSULTING)).build();
    ResponseFuture<CollectionResponse<Greeting>> future = getClient().sendRequest(req);
    Response<CollectionResponse<Greeting>> response = future.getResponse();
    List<Greeting> greetings = response.getEntity().getElements();
    for (Greeting greeting : greetings) {
        Assert.assertTrue(greeting.hasTone());
        Tone tone = greeting.getTone();
        Assert.assertTrue(Tone.SINCERE.equals(tone) || Tone.INSULTING.equals(tone));
    }
}
Also used : Greeting(com.linkedin.restli.examples.greetings.api.Greeting) Tone(com.linkedin.restli.examples.greetings.api.Tone) CollectionResponse(com.linkedin.restli.common.CollectionResponse) Test(org.testng.annotations.Test)

Aggregations

Greeting (com.linkedin.restli.examples.greetings.api.Greeting)6 Tone (com.linkedin.restli.examples.greetings.api.Tone)6 Test (org.testng.annotations.Test)3 CollectionResponse (com.linkedin.restli.common.CollectionResponse)2 Finder (com.linkedin.restli.server.annotations.Finder)2 ArrayList (java.util.ArrayList)2 Callback (com.linkedin.common.callback.Callback)1 HostSet (com.linkedin.d2.balancer.util.HostSet)1 ConsistentHashKeyMapper (com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapper)1 ConsistentHashKeyMapperTest (com.linkedin.d2.balancer.util.hashing.ConsistentHashKeyMapperTest)1 FieldDef (com.linkedin.data.template.FieldDef)1 StringMap (com.linkedin.data.template.StringMap)1 RequestContext (com.linkedin.r2.message.RequestContext)1 ActionRequestBuilder (com.linkedin.restli.client.ActionRequestBuilder)1 AllPartitionsRequestBuilder (com.linkedin.restli.client.AllPartitionsRequestBuilder)1 Response (com.linkedin.restli.client.Response)1 EmptyMap (com.linkedin.restli.examples.greetings.api.EmptyMap)1 SearchMetadata (com.linkedin.restli.examples.greetings.api.SearchMetadata)1 ToneFacet (com.linkedin.restli.examples.greetings.api.ToneFacet)1 ToneFacetArray (com.linkedin.restli.examples.greetings.api.ToneFacetArray)1