Search in sources :

Example 6 with AccessControlEntry

use of com.twitter.distributedlog.thrift.AccessControlEntry in project distributedlog by twitter.

the class TestZKAccessControl method testDeleteZKAccessControl.

@Test(timeout = 60000)
public void testDeleteZKAccessControl() throws Exception {
    String zkPath = "/delete-zk-access-control";
    AccessControlEntry ace = new AccessControlEntry();
    ace.setDenyDelete(true);
    ZKAccessControl zkac = new ZKAccessControl(ace, zkPath);
    Await.result(zkac.create(zkc));
    ZKAccessControl readZKAC = Await.result(ZKAccessControl.read(zkc, zkPath, null));
    assertEquals(zkac, readZKAC);
    Await.result(ZKAccessControl.delete(zkc, zkPath));
    try {
        Await.result(ZKAccessControl.read(zkc, zkPath, null));
    } catch (KeeperException.NoNodeException nne) {
    // expected.
    }
    Await.result(ZKAccessControl.delete(zkc, zkPath));
}
Also used : AccessControlEntry(com.twitter.distributedlog.thrift.AccessControlEntry) KeeperException(org.apache.zookeeper.KeeperException) Test(org.junit.Test)

Aggregations

AccessControlEntry (com.twitter.distributedlog.thrift.AccessControlEntry)6 Test (org.junit.Test)5 KeeperException (org.apache.zookeeper.KeeperException)3 ZooKeeperClient (com.twitter.distributedlog.ZooKeeperClient)1 AccessControlManager (com.twitter.distributedlog.acl.AccessControlManager)1 ZKAccessControl (com.twitter.distributedlog.acl.ZKAccessControl)1 DLException (com.twitter.distributedlog.exceptions.DLException)1 BKDLConfig (com.twitter.distributedlog.metadata.BKDLConfig)1 DistributedLogNamespace (com.twitter.distributedlog.namespace.DistributedLogNamespace)1 TException (org.apache.thrift.TException)1 TJSONProtocol (org.apache.thrift.protocol.TJSONProtocol)1 TMemoryInputTransport (org.apache.thrift.transport.TMemoryInputTransport)1