use of com.linkedin.restli.examples.greetings.client.AssociationsAssociationsSubFluentClient in project rest.li by linkedin.
the class TestParseqBasedFluentClientApi method testSubResource_twoLayerAssociationPathKey.
/**
* Test {@link com.linkedin.restli.examples.greetings.server.AssociationsAssociationsSubResource}
*/
@Test
public void testSubResource_twoLayerAssociationPathKey() throws Exception {
// AssociationsAssociations
String src = "src";
String anotherSrc = "anotherSrc";
String dest = "dest";
String anotherDest = "anotherDest";
String subKey = "subKey";
CompoundKey key1 = new AssociationsFluentClient.Key().setSrc(src).setDest(dest);
CompoundKey key2 = new AssociationsAssociationsFluentClient.Key().setAnotherSrc(anotherSrc).setAnotherDest(anotherDest);
AssociationsAssociationsSubFluentClient subFluentClient = new AssociationsAssociationsSubFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
Message response = subFluentClient.withAssociationsId(key1).withAssociationsAssociationsId(key2).get(subKey).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(response.getId(), src + anotherSrc + subKey);
Assert.assertEquals(response.getMessage(), dest + anotherDest);
// Repeat using sub client generated from parent
Associations.AssociationsAssociations.AssociationsAssociationsSub subFluentClient2 = new AssociationsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine()).associationsAssociationsOf(key1).associationsAssociationsSubOf(key2);
response = subFluentClient2.get(subKey).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(response.getId(), src + anotherSrc + subKey);
Assert.assertEquals(response.getMessage(), dest + anotherDest);
}
Aggregations