ZookeeperScaler implements AutoCloseable { static Map<String, String> generateConfig(int scale, Function<Integer, String> zkNodeAddress) { Map<String, String> servers = new HashMap<>(scale); for (int i = 0; i < scale; i++) { String key = String.format("server.%d", i + 1); String value = String.format("%s:%d:%d:participant;127.0.0.1:%d", zkNodeAddress.apply(i), ZookeeperCluster.CLUSTERING_PORT, ZookeeperCluster.LEADER_ELECTION_PORT, ZookeeperCluster.CLIENT_PLAINTEXT_PORT); servers.put(key, value); } return servers; } 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();  }
@Test public void testGenerateConfigOneNode() { Map<String, String> expected = new HashMap<>(3); expected.put("server.1", "my-cluster-zookeeper-0.my-cluster-zookeeper-nodes.myproject.svc:2888:3888:participant;127.0.0.1:12181"); assertThat(ZookeeperScaler.generateConfig(1, zkNodeAddress), is(expected)); }
@Test public void testGenerateConfigThreeNodes() { Map<String, String> expected = new HashMap<>(3); expected.put("server.1", "my-cluster-zookeeper-0.my-cluster-zookeeper-nodes.myproject.svc:2888:3888:participant;127.0.0.1:12181"); expected.put("server.2", "my-cluster-zookeeper-1.my-cluster-zookeeper-nodes.myproject.svc:2888:3888:participant;127.0.0.1:12181"); expected.put("server.3", "my-cluster-zookeeper-2.my-cluster-zookeeper-nodes.myproject.svc:2888:3888:participant;127.0.0.1:12181"); assertThat(ZookeeperScaler.generateConfig(3, zkNodeAddress), is(expected)); }