public void executeLine(String line) throws CliException, InterruptedException, IOException { if (!line.equals("")) { cl.parseCommand(line); addToHistory(commandCount,line); processCmd(cl); commandCount++; } }
public void executeLine(String line) throws InterruptedException, IOException, KeeperException { if (!line.equals("")) { cl.parseCommand(line); addToHistory(commandCount,line); processCmd(cl); commandCount++; } }
processCmd(cl); } else if (cmd.equals("history")) { for (int i = commandCount - 10; i <= commandCount; ++i) {
processCmd( cl); } else if (cmd.equals("history")) { for (int i=commandCount - 10;i<=commandCount;++i) {
private void testInvalidCommand(String cmdString, int exitCode) throws Exception { final ZooKeeper zk = createClient(); ZooKeeperMain zkMain = new ZooKeeperMain(zk); zkMain.cl.parseCommand(cmdString); // Verify that the exit code is set properly zkMain.processCmd(zkMain.cl); Assert.assertEquals(exitCode, zkMain.exitCode); // Verify that the correct exception is thrown try { zkMain.processZKCmd(zkMain.cl); Assert.fail(); } catch (CliException e) { return; } Assert.fail("invalid command should throw CliException"); }
@Test public void testDelete() throws Exception { final ZooKeeper zk = createClient(); ZooKeeperMain zkMain = new ZooKeeperMain(zk); String cmdstring1 = "create -e /node2 data"; String cmdstring2 = "delete /node2"; String cmdstring3 = "ls /node2"; zkMain.cl.parseCommand(cmdstring1); Assert.assertTrue(zkMain.processZKCmd(zkMain.cl)); zkMain.cl.parseCommand(cmdstring2); Assert.assertFalse(zkMain.processZKCmd(zkMain.cl)); zkMain.cl.parseCommand(cmdstring3); Assert.assertFalse("", zkMain.processCmd(zkMain.cl)); }
public void executeLine(String line) throws InterruptedException, IOException, KeeperException { if (!line.equals("")) { cl.parseCommand(line); addToHistory(commandCount,line); processCmd(cl); commandCount++; } }
boolean watch = processCmd(cl); if (!watch) { System.exit(0);
processCmd( cl); } else if (cmd.equals("history")) { for (int i=commandCount - 10;i<=commandCount;++i) {