use of com.linkedin.restli.examples.greetings.client.GreetingsFluentClient in project rest.li by linkedin.
the class TestParseqBasedFluentClientApi method testBatchUpdateWithErrors.
@Test
public void testBatchUpdateWithErrors() throws Exception {
Greetings greetings = new GreetingsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
final Map<Long, Greeting> inputs = new HashMap<>();
inputs.put(-6L, getGreeting());
CompletionStage<Long> createResult = greetings.create(getGreeting());
CompletionStage<Map<Long, UpdateStatus>> result = createResult.thenCompose(id -> {
inputs.put(id, getGreeting("Batch update test"));
return greetings.batchUpdate(inputs);
});
CompletableFuture<Map<Long, UpdateStatus>> future = result.toCompletableFuture();
Map<Long, UpdateStatus> ids = future.get(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(ids.size(), 2);
Assert.assertEquals(ids.get(createResult.toCompletableFuture().get()).getStatus().intValue(), 204);
Assert.assertEquals(ids.get(-6L).getStatus().intValue(), 404);
}
Aggregations