- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.executeLine()
方法的一些代码示例,展示了ZooKeeperMain.executeLine()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperMain.executeLine()
方法的具体详情如下:
包路径:org.apache.zookeeper.ZooKeeperMain
类名称:ZooKeeperMain
方法名:executeLine
暂无
代码示例来源:origin: apache/zookeeper
Method readLine = consoleC.getMethod("readLine", String.class);
while ((line = (String)readLine.invoke(console, getPrompt())) != null) {
executeLine(line);
executeLine(line);
代码示例来源:origin: org.apache.zookeeper/zookeeper
Method readLine = consoleC.getMethod("readLine", String.class);
while ((line = (String)readLine.invoke(console, getPrompt())) != null) {
executeLine(line);
executeLine(line);
代码示例来源:origin: apache/zookeeper
@Test
public void testDeleteWithInvalidVersionNo() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create -s -e /node1 data ";
String cmdstring1 = "delete /node1 2";//invalid dataversion no
zkMain.executeLine(cmdstring);
// For Invalid dataversion number should not throw exception
zkMain.executeLine(cmdstring1);
}
代码示例来源:origin: apache/zookeeper
@Test
public void testSortedLs() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /aa1");
zkMain.executeLine("create /aa2");
zkMain.executeLine("create /aa3");
zkMain.executeLine("create /test1");
zkMain.executeLine("create /zk1");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls /".split(" "));
List<String> expected = new ArrayList<String>();
expected.add("[aa1, aa2, aa3, test1, zk1, zookeeper]");
runCommandExpect(cmd, expected);
}
代码示例来源:origin: apache/zookeeper
@Test
public void testCliCommandsNotEchoingUsage() throws Exception {
// setup redirect out/err streams to get System.in/err, use this judiciously!
final PrintStream systemErr = System.err; // get current err
final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
System.setErr(new PrintStream(errContent));
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmd1 = "printwatches";
zkMain.executeLine(cmd1);
String cmd2 = "history";
zkMain.executeLine(cmd2);
String cmd3 = "redo";
zkMain.executeLine(cmd3);
// revert redirect of out/err streams - important step!
System.setErr(systemErr);
if (errContent.toString().contains("ZooKeeper -server host:port cmd args")) {
fail("CLI commands (history, redo, connect, printwatches) display usage info!");
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testLsrCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /a");
zkMain.executeLine("create /a/b");
zkMain.executeLine("create /a/c");
zkMain.executeLine("create /a/b/d");
zkMain.executeLine("create /a/c/e");
zkMain.executeLine("create /a/f");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls -R /a".split(" "));
List<String> expected = new ArrayList<String>();
expected.add("/a");
expected.add("/a/b");
expected.add("/a/c");
expected.add("/a/f");
expected.add("/a/b/d");
expected.add("/a/c/e");
runCommandExpect(cmd, expected);
}
代码示例来源:origin: apache/zookeeper
@Test
public void testRedoWithNegativeCmdNumber() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmd1 = "redo -1";
// setup redirect out/err streams to get System.in/err, use this
// judiciously!
final PrintStream systemErr = System.err; // get current err
final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
System.setErr(new PrintStream(errContent));
try {
zkMain.executeLine(cmd1);
Assert.assertEquals("Command index out of range", errContent
.toString().trim());
} finally {
// revert redirect of out/err streams - important step!
System.setErr(systemErr);
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testLsrLeafCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /b");
zkMain.executeLine("create /b/c");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls -R /b/c".split(" "));
List<String> expected = new ArrayList<String>();
expected.add("/b/c");
runCommandExpect(cmd, expected);
}
代码示例来源:origin: apache/zookeeper
@Test
public void testCheckInvalidAcls() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create -s -e /node data ip:scheme:gggsd"; //invalid acl's
// For Invalid ACls should not throw exception
zkMain.executeLine(cmdstring);
}
代码示例来源:origin: apache/zookeeper
@Test
public void testLsrNonexistantZnodeCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
zkMain.executeLine("create /b");
zkMain.executeLine("create /b/c");
LsCommand cmd = new LsCommand();
cmd.setZk(zk);
cmd.parse("ls -R /b/c/d".split(" "));
try {
runCommandExpect(cmd, new ArrayList<String>());
Assert.fail("Path doesn't exists so, command should fail.");
} catch (CliWrapperException e) {
Assert.assertEquals(KeeperException.Code.NONODE, ((KeeperException)e.getCause()).code());
}
}
代码示例来源:origin: org.apache.hadoop/zookeeper
Method readLine = consoleC.getMethod("readLine", String.class);
while ((line = (String)readLine.invoke(console, getPrompt())) != null) {
executeLine(line);
executeLine(line);
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.executeLine()方法的一些代码示例,展示了ZooKeeperMain.executeLine()的具
我是一名优秀的程序员,十分优秀!