curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jordan Zimmerman (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-128) Enhance ZKPaths to be more lenient
Date Wed, 30 Jul 2014 17:24:40 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14079581#comment-14079581
] 

Jordan Zimmerman commented on CURATOR-128:
------------------------------------------

I ran all the tests with this branch and they all passed.

> Enhance ZKPaths to be more lenient
> ----------------------------------
>
>                 Key: CURATOR-128
>                 URL: https://issues.apache.org/jira/browse/CURATOR-128
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Framework
>            Reporter: Scott Blum
>            Assignee: Jordan Zimmerman
>
> Add the following test to TestNamespaceFacade:
> {code}
>     @Test
>     public void     testRootAccess() throws Exception
>     {
>         CuratorFramework    client = CuratorFrameworkFactory.newClient(server.getConnectString(),
new RetryOneTime(1));
>         try
>         {
>             client.start();
>             client.create().forPath("/one");
>             Assert.assertNotNull(client.getZookeeperClient().getZooKeeper().exists("/one",
false));
>             Assert.assertNotNull(client.checkExists().forPath("/"));
>             try
>             {
>                 client.checkExists().forPath("");
>                 Assert.fail("IllegalArgumentException expected");
>             }
>             catch ( IllegalArgumentException expected )
>             {
>             }
>             Assert.assertNotNull(client.usingNamespace("one").checkExists().forPath(""));
>             try
>             {
>                 client.usingNamespace("one").checkExists().forPath("/");
>                 Assert.fail("IllegalArgumentException expected");
>             }
>             catch ( IllegalArgumentException expected )
>             {
>             }
>         }
>         finally
>         {
>             CloseableUtils.closeQuietly(client);
>         }
>     }
> {code}
> This tests PASSES, which means that there's no canonical way to refer to the root node.
 If the client is not namespaced, "/" works and "" does not work.  If the client is namespaced,
"" works and "/" does not.
> In either case, I think ZKPaths.makePath mishandles certain cases.
> If you append "/foo" and "/" the result is "/foo/" which is an invalid path.
> On the other hand, if you append "" and "bar" the result is "//bar" which is also invalid.
> What's the right behavior here?  Does the root node / root of a namespace always need
to be referred to as "/" or is empty string an acceptable alias?



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

Mime
View raw message