@Test public void testCommandLineWorks() throws Exception { System.setSecurityManager(new NoExitSecurityManager()); HBaseTestingUtility htu = new HBaseTestingUtility(); htu.getConfiguration().setInt(HConstants.ZK_SESSION_TIMEOUT, 1000); htu.startMiniZKCluster(); try { ZooKeeperWatcher zkw = htu.getZooKeeperWatcher(); String znode = "/testCommandLineWorks"; ZKUtil.createWithParents(zkw, znode, HConstants.EMPTY_BYTE_ARRAY); ZKUtil.checkExists(zkw, znode); boolean exception = false; try { ZooKeeperMainServer.main(new String [] {"-server", "localhost:" + htu.getZkCluster().getClientPort(), "delete", znode}); } catch (ExitException ee) { exception = true; } assertTrue(exception); assertEquals(-1, ZKUtil.checkExists(zkw, znode)); } finally { htu.shutdownMiniZKCluster(); System.setSecurityManager(null); } }
public static void main(String args[]) throws Exception { String [] newArgs = args; if (!hasServer(args)) { Configuration conf = HBaseConfiguration.create(); String hostport = new ZooKeeperMainServer().parse(conf); if (hostport != null && hostport.length() > 0) { newArgs = new String[args.length + 2]; System.arraycopy(args, 0, newArgs, 2, args.length); newArgs[0] = "-server"; newArgs[1] = hostport; } } if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } }
ZooKeeperMainServer { public static void main(String args[]) throws Exception { String [] newArgs = args; if (!hasServer(args)) { Configuration conf = HBaseConfiguration.create(); String hostport = new ZooKeeperMainServer().parse(conf); if (hostport != null && hostport.length() > 0) { newArgs = new String[args.length + 2]; System.arraycopy(args, 0, newArgs, 2, args.length); newArgs[0] = "-server"; newArgs[1] = hostport; } } if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } } }
ZooKeeperMainServer { public static void main(String args[]) throws Exception { String [] newArgs = args; if (!hasServer(args)) { Configuration conf = HBaseConfiguration.create(); String hostport = new ZooKeeperMainServer().parse(conf); if (hostport != null && hostport.length() > 0) { newArgs = new String[args.length + 2]; System.arraycopy(args, 0, newArgs, 2, args.length); newArgs[0] = "-server"; newArgs[1] = hostport; } } if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } }  }
ZooKeeperMainServer { public static void main(String args[]) throws Exception { String [] newArgs = args; if (!hasServer(args)) { Configuration conf = HBaseConfiguration.create(); String hostport = new ZooKeeperMainServer().parse(conf); if (hostport != null && hostport.length() > 0) { newArgs = new String[args.length + 2]; System.arraycopy(args, 0, newArgs, 2, args.length); newArgs[0] = "-server"; newArgs[1] = hostport; } } if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } }  String parse(final Configuration c); static void main(String args[]); }
ZooKeeperMainServer { public static void main(String args[]) throws Exception { String [] newArgs = args; if (!hasServer(args)) { Configuration conf = HBaseConfiguration.create(); String hostport = new ZooKeeperMainServer().parse(conf); if (hostport != null && hostport.length() > 0) { newArgs = new String[args.length + 2]; System.arraycopy(args, 0, newArgs, 2, args.length); newArgs[0] = "-server"; newArgs[1] = hostport; } } if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } }  String parse(final Configuration c); static void main(String args[]);  }