/** * Convenience wrapper around asynchronous reconfig that takes Lists of strings instead of comma-separated servers. * * @see #reconfigure * */ public void reconfigure(List<String> joiningServers, List<String> leavingServers, List<String> newMembers, long fromConfig, DataCallback cb, Object ctx) { reconfigure(StringUtils.joinStrings(joiningServers, ","), StringUtils.joinStrings(leavingServers, ","), StringUtils.joinStrings(newMembers, ","), fromConfig, cb, ctx); }
List<String> hostsList = split(connectString,","); for (String host : hostsList) { int port = DEFAULT_PORT;
/** * Convenience wrapper around reconfig that takes Lists of strings instead of comma-separated servers. * * @see #reconfigure * */ public byte[] reconfigure(List<String> joiningServers, List<String> leavingServers, List<String> newMembers, long fromConfig, Stat stat) throws KeeperException, InterruptedException { return reconfigure(StringUtils.joinStrings(joiningServers, ","), StringUtils.joinStrings(leavingServers, ","), StringUtils.joinStrings(newMembers, ","), fromConfig, stat); }
if (joiningServersString != null) joiningServers = StringUtils.split(joiningServersString,","); if (leavingServersString != null) leavingServers = StringUtils.split(leavingServersString, ","); for (String joiner: joiningServers){ String[] parts = StringUtils.split(joiner, "=").toArray(new String[0]); if (parts.length != 2) { throw new KeeperException.BadArgumentsException("Wrong format of server string");
@Override public void write(Writer out) throws IOException { Properties cfg = new Properties(); cfg.load( new StringReader( qv.toString())); List<String> servers = new ArrayList<String>(); for (Entry<Object, Object> entry : cfg.entrySet()) { String key = entry.getKey().toString().trim(); if ( !needKeepVersion && key.startsWith("version")) continue; String value = entry.getValue().toString().trim(); servers.add(key .concat("=") .concat(value)); } Collections.sort(servers); out.write(StringUtils.joinStrings(servers, "\n")); } });
private static void runCommandExpect(CliCommand command, List<String> expectedResults) throws Exception { // call command and put result in byteStream ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); PrintStream out = new PrintStream(byteStream); command.setOut(out); command.exec(); String result = byteStream.toString(); assertTrue(result, result.contains( StringUtils.joinStrings(expectedResults, LINE_SEPARATOR))); }
String sortedConfigStr = StringUtils.joinStrings(configLines, "\n");