Java Code Examples for io.vertx.reactivex.core.Vertx#close()

The following examples show how to use io.vertx.reactivex.core.Vertx#close() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxVertxTestBase.java    From graviteeio-access-management with Apache License 2.0 6 votes vote down vote up
protected void tearDown() throws Exception {
    if (vertx != null) {
        close(vertx.getDelegate());
    }
    if (created != null) {
        CountDownLatch latch = new CountDownLatch(created.size());
        for (Vertx v : created) {
            v.close(ar -> {
                if (ar.failed()) {
                    log.error("Failed to shutdown vert.x", ar.cause());
                }
                latch.countDown();
            });
        }
        assertTrue(latch.await(180, TimeUnit.SECONDS));
    }
    FakeClusterManager.reset(); // Bit ugly
    super.tearDown();
}
 
Example 2
Source File: InMemoryUserStoreTest.java    From graviteeio-access-management with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldGetUser() throws InterruptedException {
    User user = new User();
    user.setId("user-id");
    user.setUsername("username");
    Vertx vertx = Vertx.vertx();
    InMemoryUserStore inMemoryUserStore = new InMemoryUserStore(vertx, 5000);
    inMemoryUserStore.add(user);
    Thread.sleep(3000l);
    User fetchedUser = inMemoryUserStore.get(user.getId());
    Assert.assertNotNull(fetchedUser);
    Assert.assertTrue("username".equals(fetchedUser.getUsername()));
    vertx.close();
}
 
Example 3
Source File: InMemoryUserStoreTest.java    From graviteeio-access-management with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotGetUser_userEviction() throws InterruptedException {
    User user = new User();
    user.setId("user-id");
    user.setUsername("username");
    Vertx vertx = Vertx.vertx();
    InMemoryUserStore inMemoryUserStore = new InMemoryUserStore(vertx, 1000);
    inMemoryUserStore.add(user);
    Thread.sleep(3000l);
    User fetchedUser = inMemoryUserStore.get(user.getId());
    Assert.assertNull(fetchedUser);
    vertx.close();
}