- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.processZKCmd()
方法的一些代码示例,展示了ZooKeeperMain.processZKCmd()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperMain.processZKCmd()
方法的具体详情如下:
包路径:org.apache.zookeeper.ZooKeeperMain
类名称:ZooKeeperMain
方法名:processZKCmd
暂无
代码示例来源:origin: apache/zookeeper
protected boolean processCmd(MyCommandOptions co) throws CliException, IOException, InterruptedException {
boolean watch = false;
try {
watch = processZKCmd(co);
exitCode = ExitCode.EXECUTION_FINISHED.getValue();
} catch (CliException ex) {
exitCode = ex.getExitCode();
System.err.println(ex.getMessage());
}
return watch;
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
protected boolean processCmd(MyCommandOptions co)
throws KeeperException, IOException, InterruptedException
{
try {
return processZKCmd(co);
} catch (IllegalArgumentException e) {
System.err.println("Command failed: " + e);
} catch (KeeperException.NoNodeException e) {
System.err.println("Node does not exist: " + e.getPath());
} catch (KeeperException.NoChildrenForEphemeralsException e) {
System.err.println("Ephemerals cannot have children: "
+ e.getPath());
} catch (KeeperException.NodeExistsException e) {
System.err.println("Node already exists: " + e.getPath());
} catch (KeeperException.NotEmptyException e) {
System.err.println("Node not empty: " + e.getPath());
} catch (KeeperException.NotReadOnlyException e) {
System.err.println("Not a read-only call: " + e.getPath());
}catch (KeeperException.InvalidACLException e) {
System.err.println("Acl is not valid : "+e.getPath());
}catch (KeeperException.NoAuthException e) {
System.err.println("Authentication is not valid : "+e.getPath());
}catch (KeeperException.BadArgumentsException e) {
System.err.println("Arguments are not valid : "+e.getPath());
}catch (KeeperException.BadVersionException e) {
System.err.println("version No is not valid : "+e.getPath());
}
return false;
}
代码示例来源:origin: apache/zookeeper
@Test
public void testStatCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring1 = "create -e /node3 data";
String cmdstring2 = "stat /node3";
String cmdstring3 = "delete /node3";
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.processZKCmd(zkMain.cl));
}
代码示例来源:origin: apache/zookeeper
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Removewatches cmd fails to remove child watches",
zkMain.processZKCmd(zkMain.cl));
LOG.info("Waiting for the DataWatchRemoved event");
myWatcher.matches();
代码示例来源:origin: apache/zookeeper
/**
* Test verifies deletion of NodeChildrenChanged watches
*/
@Test(timeout = 30000)
public void testRemoveNodeChildrenChangedWatches() throws Exception {
List<EventType> expectedEvents = new ArrayList<Watcher.Event.EventType>();
expectedEvents.add(EventType.ChildWatchRemoved);
MyWatcher myWatcher = new MyWatcher("/testnode1", expectedEvents, 1);
zk.create("/testnode1", "data".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
LOG.info("Adding child changed watcher");
zk.getChildren("/testnode1", myWatcher);
String cmdstring = "removewatches /testnode1 -c";
LOG.info("Remove watchers using shell command : {}", cmdstring);
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Removewatches cmd fails to remove child watches",
zkMain.processZKCmd(zkMain.cl));
myWatcher.matches();
Assert.assertEquals(
"Failed to remove child watches : " + zk.getChildWatches(), 0,
zk.getChildWatches().size());
}
代码示例来源:origin: apache/zookeeper
/**
* Test verifies deletion of NodeDataChanged watches
*/
@Test(timeout = 30000)
public void testRemoveNodeDataChangedWatches() throws Exception {
LOG.info("Adding data watcher using getData()");
List<EventType> expectedEvents = new ArrayList<Watcher.Event.EventType>();
expectedEvents.add(EventType.DataWatchRemoved);
MyWatcher myWatcher = new MyWatcher("/testnode1", expectedEvents, 1);
zk.create("/testnode1", "data".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
zk.getData("/testnode1", myWatcher, null);
String cmdstring = "removewatches /testnode1 -d";
LOG.info("Remove watchers using shell command : {}", cmdstring);
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Removewatches cmd fails to remove data watches",
zkMain.processZKCmd(zkMain.cl));
LOG.info("Waiting for the DataWatchRemoved event");
myWatcher.matches();
// verifying that other path data watches are removed
Assert.assertEquals(
"Data watches are not removed : " + zk.getDataWatches(), 0, zk
.getDataWatches().size());
}
代码示例来源:origin: apache/zookeeper
String cmdstring1 = "deleteall /a";
zkMain.cl.parseCommand(cmdstring0);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
Assert.assertEquals(null, zk.exists("/a/b/v", null));
zkMain.cl.parseCommand(cmdstring1);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
Assert.assertNull(zk.exists("/a", null));
代码示例来源:origin: apache/zookeeper
Assert.assertTrue(
"Removewatches cmd fails to remove child/data watches",
zkMain.processZKCmd(zkMain.cl));
LOG.info("Waiting for the WatchRemoved events");
watcherLatch.await(10, TimeUnit.SECONDS);
代码示例来源:origin: apache/zookeeper
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Removewatches cmd fails to remove child watches",
zkMain.processZKCmd(zkMain.cl));
LOG.info("Waiting for the ChildWatchRemoved event");
myWatcher.matches();
代码示例来源:origin: apache/zookeeper
@Test
public void testSetData() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring1 = "create -e /node4 data";
String cmdstring2 = "set /node4 " + "data";
String cmdstring3 = "delete /node4";
Stat stat = new Stat();
int version = 0;
zkMain.cl.parseCommand(cmdstring1);
Assert.assertTrue(zkMain.processZKCmd(zkMain.cl));
stat = zk.exists("/node4", true);
version = stat.getVersion();
zkMain.cl.parseCommand(cmdstring2);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
stat = zk.exists("/node4", true);
Assert.assertEquals(version + 1, stat.getVersion());
zkMain.cl.parseCommand(cmdstring3);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
}
代码示例来源:origin: apache/zookeeper
@Test
public void testSetAclRecursive() throws Exception {
final ZooKeeper zk = createClient();
final byte[] EMPTY = new byte[0];
zk.setData("/", EMPTY, -1);
zk.create("/a", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/a/b", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/a/b/c", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/a/d", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
zk.create("/e", EMPTY, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String setAclCommand = "setAcl -R /a world:anyone:r";
zkMain.cl.parseCommand(setAclCommand);
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a", new Stat()));
Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a/b", new Stat()));
Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a/b/c", new Stat()));
Assert.assertEquals(Ids.READ_ACL_UNSAFE, zk.getACL("/a/d", new Stat()));
// /e is unset, its acl should remain the same.
Assert.assertEquals(Ids.OPEN_ACL_UNSAFE, zk.getACL("/e", new Stat()));
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testACLWithExtraAgruments() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
// create persistent sequential node
String cmdstring = "create -s /l data ip:10.18.52.144:cdrwa f g h";
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue(
"Not considering the extra arguments after the acls.", zkMain
.processZKCmd(zkMain.cl));
}
代码示例来源:origin: apache/zookeeper
@Test
public void testCreatePersistentNode() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
String cmdstring = "create /node2";
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Not creating Persistent node.", zkMain
.processZKCmd(zkMain.cl));
}
代码示例来源:origin: apache/zookeeper
@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));
}
代码示例来源:origin: apache/zookeeper
Assert.assertTrue(
"Removewatches cmd fails to remove pre-create watches",
zkMain.processZKCmd(zkMain.cl));
myWatcher1.matches();
Assert.assertEquals(
zkMain.cl.parseCommand(cmdstring2);
Assert.assertTrue("Removewatches cmd fails to remove data watches",
zkMain.processZKCmd(zkMain.cl));
代码示例来源:origin: apache/zookeeper
zkMain.cl.parseCommand(cmdstring);
Assert.assertTrue("Doesn't create node without data", zkMain
.processZKCmd(zkMain.cl));
.processZKCmd(zkMain.cl));
.processZKCmd(zkMain.cl));
try {
Assert.assertTrue("Created node with wrong option", zkMain
.processZKCmd(zkMain.cl));
Assert.fail("Created the node with wrong option should "
+ "throw Exception.");
代码示例来源:origin: apache/zookeeper
@Test
public void testStatWhenPathDoesNotExist() throws IOException,
InterruptedException, MalformedCommandException {
final ZooKeeper zk = createClient();
ZooKeeperMain main = new ZooKeeperMain(zk);
String cmdstring = "stat /invalidPath";
main.cl.parseCommand(cmdstring);
try {
main.processZKCmd(main.cl);
Assert.fail("As Node does not exist, command should fail by throwing No Node Exception.");
} catch (CliException e) {
Assert.assertEquals("Node does not exist: /invalidPath", e.getMessage());
}
}
代码示例来源:origin: apache/zookeeper
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");
}
代码示例来源:origin: apache/zookeeper
@Test
public void testInvalidStatCommand() throws Exception {
final ZooKeeper zk = createClient();
ZooKeeperMain zkMain = new ZooKeeperMain(zk);
// node doesn't exists
String cmdstring1 = "stat /node123";
zkMain.cl.parseCommand(cmdstring1);
try {
Assert.assertFalse(zkMain.processZKCmd(zkMain.cl));
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
protected boolean processCmd(MyCommandOptions co)
throws KeeperException, IOException, InterruptedException
{
try {
return processZKCmd(co);
} catch (IllegalArgumentException e) {
System.err.println("Command failed: " + e);
} catch (KeeperException.NoNodeException e) {
System.err.println("Node does not exist: " + e.getPath());
} catch (KeeperException.NoChildrenForEphemeralsException e) {
System.err.println("Ephemerals cannot have children: "
+ e.getPath());
} catch (KeeperException.NodeExistsException e) {
System.err.println("Node already exists: " + e.getPath());
} catch (KeeperException.NotEmptyException e) {
System.err.println("Node not empty: " + e.getPath());
}
return false;
}
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.addToHistory()方法的一些代码示例,展示了ZooKeeperMain.addToHistory()
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.getPermFromString()方法的一些代码示例,展示了ZooKeeperMain.getPermFr
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.connectToZK()方法的一些代码示例,展示了ZooKeeperMain.connectToZK()的具
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.getCommands()方法的一些代码示例,展示了ZooKeeperMain.getCommands()的具
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.createQuota()方法的一些代码示例,展示了ZooKeeperMain.createQuota()的具
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.printMessage()方法的一些代码示例,展示了ZooKeeperMain.printMessage()
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.delQuota()方法的一些代码示例,展示了ZooKeeperMain.delQuota()的具体用法。这些
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.trimProcQuotas()方法的一些代码示例,展示了ZooKeeperMain.trimProcQuot
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.getPrompt()方法的一些代码示例,展示了ZooKeeperMain.getPrompt()的具体用法。
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.processZKCmd()方法的一些代码示例,展示了ZooKeeperMain.processZKCmd()
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.usage()方法的一些代码示例,展示了ZooKeeperMain.usage()的具体用法。这些代码示例主要
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.run()方法的一些代码示例,展示了ZooKeeperMain.run()的具体用法。这些代码示例主要来源于G
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.processCmd()方法的一些代码示例,展示了ZooKeeperMain.processCmd()的具体用
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.()方法的一些代码示例,展示了ZooKeeperMain.()的具体用法。这些代码示例主要来源于Github/
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.main()方法的一些代码示例,展示了ZooKeeperMain.main()的具体用法。这些代码示例主要来源
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.executeLine()方法的一些代码示例,展示了ZooKeeperMain.executeLine()的具
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.getPrintWatches()方法的一些代码示例,展示了ZooKeeperMain.getPrintWat
本文整理了Java中org.apache.zookeeper.ZooKeeperMain.checkIfParentQuota()方法的一些代码示例,展示了ZooKeeperMain.checkIfP
我是一名优秀的程序员,十分优秀!