@Test public void testCreateZKConnection() { String input = "localhost:2181/solr"; LogFeederSolrClientFactory.ZkConnection result = underTest.createZKConnection(input); assertEquals("/solr", Optional.ofNullable(result.getZkChroot()).get()); assertEquals("localhost:2181", result.getZkHosts().get(0)); }
@VisibleForTesting ZkConnection createZKConnection(String zkConnectionString) { String split[] = zkConnectionString.split("/", 2); String zkChroot = null; final List<String> zkHosts; if (split.length == 1) { zkHosts = Arrays.asList(split[0].split(",")); } else { zkHosts = Arrays.asList(split[0].split(",")); zkChroot = ("/" + split[1]).replaceAll("/+", "/"); if (zkChroot.endsWith("/")) { zkChroot = zkChroot.substring(0, zkChroot.lastIndexOf("/")); } } return new ZkConnection(zkHosts, zkChroot); }
LogFeederSolrClientFactory { @VisibleForTesting ZkConnection createZKConnection(String zkConnectionString) { String split[] = zkConnectionString.split("/", 2); String zkChroot = null; final List<String> zkHosts; if (split.length == 1) { zkHosts = Arrays.asList(split[0].split(",")); } else { zkHosts = Arrays.asList(split[0].split(",")); zkChroot = ("/" + split[1]).replaceAll("/+", "/"); if (zkChroot.endsWith("/")) { zkChroot = zkChroot.substring(0, zkChroot.lastIndexOf("/")); } } return new ZkConnection(zkHosts, zkChroot); } }
LogFeederSolrClientFactory { @VisibleForTesting ZkConnection createZKConnection(String zkConnectionString) { String split[] = zkConnectionString.split("/", 2); String zkChroot = null; final List<String> zkHosts; if (split.length == 1) { zkHosts = Arrays.asList(split[0].split(",")); } else { zkHosts = Arrays.asList(split[0].split(",")); zkChroot = ("/" + split[1]).replaceAll("/+", "/"); if (zkChroot.endsWith("/")) { zkChroot = zkChroot.substring(0, zkChroot.lastIndexOf("/")); } } return new ZkConnection(zkHosts, zkChroot); }  }
LogFeederSolrClientFactory { @VisibleForTesting ZkConnection createZKConnection(String zkConnectionString) { String split[] = zkConnectionString.split("/", 2); String zkChroot = null; final List<String> zkHosts; if (split.length == 1) { zkHosts = Arrays.asList(split[0].split(",")); } else { zkHosts = Arrays.asList(split[0].split(",")); zkChroot = ("/" + split[1]).replaceAll("/+", "/"); if (zkChroot.endsWith("/")) { zkChroot = zkChroot.substring(0, zkChroot.lastIndexOf("/")); } } return new ZkConnection(zkHosts, zkChroot); }  SolrClient createSolrClient(String zkConnectionString, String[] solrUrls, String collection, boolean discover); }
LogFeederSolrClientFactory { @VisibleForTesting ZkConnection createZKConnection(String zkConnectionString) { String split[] = zkConnectionString.split("/", 2); String zkChroot = null; final List<String> zkHosts; if (split.length == 1) { zkHosts = Arrays.asList(split[0].split(",")); } else { zkHosts = Arrays.asList(split[0].split(",")); zkChroot = ("/" + split[1]).replaceAll("/+", "/"); if (zkChroot.endsWith("/")) { zkChroot = zkChroot.substring(0, zkChroot.lastIndexOf("/")); } } return new ZkConnection(zkHosts, zkChroot); }  SolrClient createSolrClient(String zkConnectionString, String[] solrUrls, String collection, boolean discover);  }