use of com.linkedin.restli.examples.greetings.client.AssociationsSubFluentClient in project rest.li by linkedin.
the class TestParseqBasedFluentClientApi method testSubResource_associationKey.
/**
* Test {@link com.linkedin.restli.examples.greetings.server.AssociationsSubResource}
*
* A complete set of request tests were tested in {@link TestAssociationsResource}
*/
@Test
public void testSubResource_associationKey() throws Exception {
// AssociationsSub
String src = "src";
String dest = "dest";
String subKey = "subKey";
CompoundKey key1 = new AssociationsFluentClient.Key().setSrc(src).setDest(dest);
AssociationsSubFluentClient subFluentClient = new AssociationsSubFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
Message response = subFluentClient.withAssociationsId(key1).get(subKey).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(response.getId(), "src");
Assert.assertEquals(response.getMessage(), "dest");
// Repeat using sub client generated from parent
Associations.AssociationsSub subFluentClient2 = new AssociationsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine()).associationsSubOf(key1);
response = subFluentClient2.get(subKey).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(response.getId(), "src");
Assert.assertEquals(response.getMessage(), "dest");
}
Aggregations