@Test public void testConnectionToNonExistingHost(VertxTestContext context) { ZookeeperScaler scaler = new ZookeeperScaler(vertx, new DefaultZooKeeperAdminProvider(), "i-do-not-exist.com:2181", null, dummyCaSecret, dummyCoSecret, 2_000); Checkpoint check = context.checkpoint(); scaler.scale(5).onComplete(context.failing(cause -> context.verify(() -> { assertThat(cause.getMessage(), is("Failed to connect to Zookeeper i-do-not-exist.com:2181. Connection was not ready in 2000 ms.")); check.flag(); }))); }
public Future<Void> scale(int scaleTo) { return connect() .compose(zkAdmin -> { Promise<Void> scalePromise = Promise.promise(); getCurrentConfig(zkAdmin) .compose(servers -> scaleTo(zkAdmin, servers, scaleTo)) .onComplete(res -> { closeConnection(zkAdmin); if (res.succeeded()) { scalePromise.complete(); } else { scalePromise.fail(res.cause()); } }); return scalePromise.future(); }); }
ZookeeperScaler implements AutoCloseable { public Future<Void> scale(int scaleTo) { return connect() .compose(zkAdmin -> { Promise<Void> scalePromise = Promise.promise(); getCurrentConfig(zkAdmin) .compose(servers -> scaleTo(zkAdmin, servers, scaleTo)) .onComplete(res -> { closeConnection(zkAdmin); if (res.succeeded()) { scalePromise.complete(); } else { scalePromise.fail(res.cause()); } }); return scalePromise.future(); }); } }
ZookeeperScaler implements AutoCloseable { public Future<Void> scale(int scaleTo) { return connect() .compose(zkAdmin -> { Promise<Void> scalePromise = Promise.promise(); getCurrentConfig(zkAdmin) .compose(servers -> scaleTo(zkAdmin, servers, scaleTo)) .onComplete(res -> { closeConnection(zkAdmin); if (res.succeeded()) { scalePromise.complete(); } else { scalePromise.fail(res.cause()); } }); return scalePromise.future(); }); } protected  ZookeeperScaler(Vertx vertx, ZooKeeperAdminProvider zooAdminProvider, String zookeeperConnectionString, Function<Integer, String> zkNodeAddress, Secret clusterCaCertSecret, Secret coKeySecret, long operationTimeoutMs); }
ZookeeperScaler implements AutoCloseable { public Future<Void> scale(int scaleTo) { return connect() .compose(zkAdmin -> { Promise<Void> scalePromise = Promise.promise(); getCurrentConfig(zkAdmin) .compose(servers -> scaleTo(zkAdmin, servers, scaleTo)) .onComplete(res -> { closeConnection(zkAdmin); if (res.succeeded()) { scalePromise.complete(); } else { scalePromise.fail(res.cause()); } }); return scalePromise.future(); }); } protected  ZookeeperScaler(Vertx vertx, ZooKeeperAdminProvider zooAdminProvider, String zookeeperConnectionString, Function<Integer, String> zkNodeAddress, Secret clusterCaCertSecret, Secret coKeySecret, long operationTimeoutMs); Future<Void> scale(int scaleTo); @Override void close(); }
ZookeeperScaler implements AutoCloseable { public Future<Void> scale(int scaleTo) { return connect() .compose(zkAdmin -> { Promise<Void> scalePromise = Promise.promise(); getCurrentConfig(zkAdmin) .compose(servers -> scaleTo(zkAdmin, servers, scaleTo)) .onComplete(res -> { closeConnection(zkAdmin); if (res.succeeded()) { scalePromise.complete(); } else { scalePromise.fail(res.cause()); } }); return scalePromise.future(); }); } protected  ZookeeperScaler(Vertx vertx, ZooKeeperAdminProvider zooAdminProvider, String zookeeperConnectionString, Function<Integer, String> zkNodeAddress, Secret clusterCaCertSecret, Secret coKeySecret, long operationTimeoutMs); Future<Void> scale(int scaleTo); @Override void close();  }