ZookeeperScaler implements AutoCloseable { static Map<String, String> parseConfig(byte[] byteConfig) { String config = new String(byteConfig, StandardCharsets.US_ASCII); Map<String, String> configMap = Util.parseMap(config); Map<String, String> serverMap = new HashMap<>(configMap.size() - 1); for (Map.Entry<String, String> entry : configMap.entrySet()) { if (entry.getKey().startsWith("server.")) { serverMap.put(entry.getKey(), entry.getValue()); } } return serverMap; } 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 testParseConfig() { String config = "server.1=my-cluster-zookeeper-0.my-cluster-zookeeper-nodes.myproject.svc:2888:3888:participant;127.0.0.1:12181\n" + "server.2=my-cluster-zookeeper-1.my-cluster-zookeeper-nodes.myproject.svc:2888:3888:participant;127.0.0.1:12181\n" + "server.3=my-cluster-zookeeper-2.my-cluster-zookeeper-nodes.myproject.svc:2888:3888:participant;127.0.0.1:12181\n" + "version=100000000b"; 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.parseConfig(config.getBytes(StandardCharsets.US_ASCII)), is(expected)); }