Search in sources :

Example 21 with TwoPartKey

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

the class TestEscapeCharsInStringKeys method testGetWithComplexKey.

@Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestComplexKeysBuilderDataProvider")
public void testGetWithComplexKey(RootBuilderWrapper<ComplexResourceKey<TwoPartKey, TwoPartKey>, Message> builders) throws Exception {
    TwoPartKey key = new TwoPartKey();
    key.setMajor(key1());
    key.setMinor(key2());
    TwoPartKey params = new TwoPartKey();
    params.setMajor(key1());
    params.setMinor(key3());
    ComplexResourceKey<TwoPartKey, TwoPartKey> complexKey = new ComplexResourceKey<TwoPartKey, TwoPartKey>(key, params);
    Request<Message> request = builders.get().id(complexKey).build();
    Message response = getClient().sendRequest(request).get().getEntity();
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getId(), key.getMajor() + " " + key.getMinor(), "Message should be key1 + ' ' + key2 for complexKey(key1,key2)");
}
Also used : TwoPartKey(com.linkedin.restli.examples.greetings.api.TwoPartKey) Message(com.linkedin.restli.examples.greetings.api.Message) ComplexResourceKey(com.linkedin.restli.common.ComplexResourceKey) Test(org.testng.annotations.Test)

Aggregations

TwoPartKey (com.linkedin.restli.examples.greetings.api.TwoPartKey)21 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)15 Message (com.linkedin.restli.examples.greetings.api.Message)13 HashMap (java.util.HashMap)7 BatchKVResponse (com.linkedin.restli.client.response.BatchKVResponse)6 ArrayList (java.util.ArrayList)6 Map (java.util.Map)5 DataMap (com.linkedin.data.DataMap)4 EntityResponse (com.linkedin.restli.common.EntityResponse)4 UpdateStatus (com.linkedin.restli.common.UpdateStatus)3 BatchUpdateResult (com.linkedin.restli.server.BatchUpdateResult)3 UpdateResponse (com.linkedin.restli.server.UpdateResponse)3 Test (org.testng.annotations.Test)3 BatchCreateIdResponse (com.linkedin.restli.common.BatchCreateIdResponse)2 EmptyRecord (com.linkedin.restli.common.EmptyRecord)2 PatchRequest (com.linkedin.restli.common.PatchRequest)2 CreateResponse (com.linkedin.restli.server.CreateResponse)2 RestLiServiceException (com.linkedin.restli.server.RestLiServiceException)2 HashSet (java.util.HashSet)2 FutureCallback (com.linkedin.common.callback.FutureCallback)1