Java Code Examples for org.apache.zookeeper.KeeperException#InvalidACLException
The following examples show how to use
org.apache.zookeeper.KeeperException#InvalidACLException .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestZooKeeperClient.java From distributedlog with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testAclNullIdDisablesAuth() throws Exception { ZooKeeperClient zkcAuth = buildAuthdClient(null); zkcAuth.get().create("/test", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zkcAuth.get().create("/test/key1", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); try { zkcAuth.get().create("/test/key2", new byte[0], DistributedLogConstants.EVERYONE_READ_CREATOR_ALL, CreateMode.PERSISTENT); fail("create should fail because we're not authenticated"); } catch (KeeperException.InvalidACLException ex) { LOG.info("caught exception writing to protected key", ex); } rmAll(zkcAuth, "/test"); }
Example 2
Source File: TestZooKeeperClient.java From distributedlog with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testAclNullIdDisablesAuth() throws Exception { ZooKeeperClient zkcAuth = buildAuthdClient(null); zkcAuth.get().create("/test", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zkcAuth.get().create("/test/key1", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); try { zkcAuth.get().create("/test/key2", new byte[0], DistributedLogConstants.EVERYONE_READ_CREATOR_ALL, CreateMode.PERSISTENT); fail("create should fail because we're not authenticated"); } catch (KeeperException.InvalidACLException ex) { LOG.info("caught exception writing to protected key", ex); } rmAll(zkcAuth, "/test"); }