curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Vines (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CURATOR-132) setACL doesn't work with namespaced curator
Date Thu, 31 Jul 2014 22:48:39 GMT
John Vines created CURATOR-132:
----------------------------------

             Summary: setACL doesn't work with namespaced curator
                 Key: CURATOR-132
                 URL: https://issues.apache.org/jira/browse/CURATOR-132
             Project: Apache Curator
          Issue Type: Bug
          Components: Framework
    Affects Versions: 2.6.0, 2.3.0
            Reporter: John Vines


Experienced this on 2.3.0, doesn't seem to be resolved in 2.6.0

Attempting to setACL with a namespaced curator fails to recognize the namespace. It seems
that setACL doesn't properly pass on the Namespaced facade. The following test code is an
exemplar.

{code}public class BreakCurator {
  public static void main(String args[]) throws Exception {
    TestingServer ts = new TestingServer();

    CuratorFramework curator = CuratorFrameworkFactory.builder().connectString(ts.getConnectString()).retryPolicy(new
ExponentialBackoffRetry(1000, 5)).build();
    curator.start();
    curator.getZookeeperClient().blockUntilConnectedOrTimedOut();

    curator.create().creatingParentsIfNeeded().forPath("/parent/child", "A string".getBytes());
    CuratorFramework curator2 = curator.usingNamespace("parent");

    try {
      System.out.println(new String(curator2.getData().forPath("child")));
      curator.setACL().withACL(Collections.singletonList(new ACL(ZooDefs.Perms.WRITE, ZooDefs.Ids.ANYONE_ID_UNSAFE))).forPath("/parent/child");
// This should attempt to setACL on /parent/child, but instead fails because /child isn't
present. Using "child" causes a failure because the path doesn't start with a slash
      curator2.setACL().withACL(Collections.singletonList(new ACL(ZooDefs.Perms.DELETE, ZooDefs.Ids.ANYONE_ID_UNSAFE))).forPath("/child");
      System.out.println(curator2.getACL().forPath("/child"));
    } catch (Exception e) {
      e.printStackTrace();
    }

    ts.close();
  }
}
{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message