use of com.linkedin.restli.examples.greetings.client.ComplexKeysSubFluentClient in project rest.li by linkedin.
the class TestParseqBasedFluentClientApi method testSubResource_complexKeyParentResource.
/**
* Test {@link com.linkedin.restli.server.resources.ComplexKeyResource}
*
* A complete set of request tests were tested in {@link TestComplexKeysResource}
*/
@Test
public void testSubResource_complexKeyParentResource() throws Exception {
TwoPartKey key = new TwoPartKey();
key.setMajor("a");
key.setMinor("b");
TwoPartKey param = new TwoPartKey();
param.setMajor("c");
param.setMinor("d");
ComplexResourceKey<TwoPartKey, TwoPartKey> complexKey = new ComplexResourceKey<>(key, param);
ComplexKeysSubFluentClient subFluentClient = new ComplexKeysSubFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
subFluentClient.withKeys(complexKey);
TwoPartKey response = subFluentClient.get("stringKey").toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(response.getMajor(), "aANDc");
Assert.assertEquals(response.getMinor(), "bANDd");
// Repeat using sub client generated from parent
ComplexKeys.ComplexKeysSub subFluentClient2 = new ComplexKeysFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine()).complexKeysSubOf(complexKey);
response = subFluentClient2.get("stringKey").toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(response.getMajor(), "aANDc");
Assert.assertEquals(response.getMinor(), "bANDd");
}
Aggregations