Skip to content

Instantly share code, notes, and snippets.

@jklingsporn
Created May 15, 2017 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jklingsporn/329921215f49771efed1f8d4b51ee6e4 to your computer and use it in GitHub Desktop.
Save jklingsporn/329921215f49771efed1f8d4b51ee6e4 to your computer and use it in GitHub Desktop.
vertx-jooq release 2.2.0
@Test
public void asyncCRUDConditionShouldSucceed() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
CompletableFuture<Integer> insertFuture = dao.insertReturningPrimaryAsync(createSomething());
insertFuture.
thenCompose(v -> dao.fetchOneAsync(Tables.SOMETHING.SOMEID.eq(insertFuture.join()))).
thenAccept(Assert::assertNotNull).
thenCompose(v -> dao.deleteExecAsync(Tables.SOMETHING.SOMEID.eq(insertFuture.join()))).
whenComplete(failOrCountDown(latch));
await(latch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment