ChenYangWen created CURATOR-282:
-----------------------------------

             Summary: In consist behavior for create EPHEMERAL_SEQUENTIAL with 
usingNamespace
                 Key: CURATOR-282
                 URL: https://issues.apache.org/jira/browse/CURATOR-282
             Project: Apache Curator
          Issue Type: Bug
    Affects Versions: 3.0.0
            Reporter: ChenYangWen
            Assignee: Jordan Zimmerman


Here is a junit test write in groovy.

{code:java}
import org.apache.curator.framework.CuratorFramework
import org.apache.curator.framework.CuratorFrameworkFactory
import org.apache.curator.retry.RetryOneTime
import org.apache.curator.test.TestingServer
import org.apache.zookeeper.CreateMode
import org.junit.After
import org.junit.Before
import org.junit.Test

public class PlayZK {
    private TestingServer server
    private CuratorFramework client

    @Before
    public void setup() {
        server = new TestingServer(8788)
        server.start();
        println "ConnectString: " + server.getConnectString()
        client = CuratorFrameworkFactory.newClient(server.getConnectString(), 
new RetryOneTime(8000))
        client.start()
    }

    @Test
    public void issues() {
        println "Create " + 
client.create().creatingParentContainersIfNeeded().forPath("/test/data/sub");
        println "Create " + 
client.create().creatingParentContainersIfNeeded().forPath("/sub");
        println "Create sub " + 
client.create().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath("/sub/")
        println "Create sub " + 
client.usingNamespace("test/data").create().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath("/sub/")

        println "Expected sub"
        client.children.forPath("/test/data").each {println it}
        println "Expected 0000000000"
        client.children.forPath("/test/data/sub").each {println it}
        println "Expected 0000000000"
        client.children.forPath("/sub").each {println it}
    }

    @After
    public void down() {
        server.stop()
    }
}
{code}

{code:java}
// will create /test/data/sub0000000001
client.usingNamespace("test/data").create().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath("/sub/")
 

// will create /test/data/sub/0000000000
client.create().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath("/sub/")
{code}


Which one is expected ?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to