[2/3] curator git commit: NamespaceFacade should not overload createContainers(). It was losing the namespace

2015-10-06 Thread randgalt
NamespaceFacade should not overload createContainers(). It was losing the 
namespace


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f4f22082
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f4f22082
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f4f22082

Branch: refs/heads/CURATOR-3.0
Commit: f4f2208240cf6c76067f3ae1b5fbe58b46ac2478
Parents: 1556a2f
Author: randgalt 
Authored: Tue Oct 6 08:21:05 2015 -0500
Committer: randgalt 
Committed: Tue Oct 6 08:21:05 2015 -0500

--
 .../org/apache/curator/framework/imps/NamespaceFacade.java| 7 ---
 .../java/org/apache/curator/framework/imps/TestFramework.java | 6 +++---
 2 files changed, 3 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/f4f22082/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
--
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
index a4bb2e5..95bf132 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
@@ -43,13 +43,6 @@ class NamespaceFacade extends CuratorFrameworkImpl
 }
 
 @Override
-public void createContainers(String path) throws Exception
-{
-path = fixForNamespace(path);
-client.createContainers(path);
-}
-
-@Override
 public CuratorFramework nonNamespaceView()
 {
 return usingNamespace(null);

http://git-wip-us.apache.org/repos/asf/curator/blob/f4f22082/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index b6a0a40..8aa37c0 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -599,9 +599,9 @@ public class TestFramework extends BaseClassForTests
 final String namespace = "container1";
 CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
 CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).namespace(namespace).build();
-client.start();
 try
 {
+client.start();
 String path = "/path1/path2";
 client.createContainers(path);
 Assert.assertNotNull(client.checkExists().forPath(path));
@@ -620,10 +620,10 @@ public class TestFramework extends BaseClassForTests
 final String namespace = "container2";
 CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
 CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).build();
-client.start();
-CuratorFramework nsClient = client.usingNamespace(namespace);
 try
 {
+client.start();
+CuratorFramework nsClient = client.usingNamespace(namespace);
 String path = "/path1/path2";
 nsClient.createContainers(path);
 Assert.assertNotNull(nsClient.checkExists().forPath(path));



[3/3] curator git commit: Merge branch 'master' into CURATOR-3.0

2015-10-06 Thread randgalt
Merge branch 'master' into CURATOR-3.0


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/df949e7a
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/df949e7a
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/df949e7a

Branch: refs/heads/CURATOR-3.0
Commit: df949e7a27e370d0e7f8013a7c7b0469382d1a2f
Parents: 537156d f4f2208
Author: randgalt 
Authored: Tue Oct 6 08:23:41 2015 -0500
Committer: randgalt 
Committed: Tue Oct 6 08:23:41 2015 -0500

--
 .../curator/framework/imps/NamespaceFacade.java |  6 ---
 .../curator/framework/imps/TestFramework.java   | 42 
 2 files changed, 42 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/df949e7a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
--



[1/3] curator git commit: CURATOR-270 createContainers does not work correctly with usingNamespace

2015-10-06 Thread randgalt
Repository: curator
Updated Branches:
  refs/heads/CURATOR-3.0 537156db4 -> df949e7a2


CURATOR-270 createContainers does not work correctly with usingNamespace


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1556a2fc
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1556a2fc
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1556a2fc

Branch: refs/heads/CURATOR-3.0
Commit: 1556a2fcb8fd0d43669b057eb51290e3bf5ee5a2
Parents: f8f05be
Author: Alexey Serba 
Authored: Tue Oct 6 00:11:35 2015 +0300
Committer: Alexey Serba 
Committed: Tue Oct 6 00:11:35 2015 +0300

--
 .../curator/framework/imps/NamespaceFacade.java |  1 +
 .../curator/framework/imps/TestFramework.java   | 42 
 2 files changed, 43 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/1556a2fc/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
--
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
index 60ef647..a4bb2e5 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
@@ -45,6 +45,7 @@ class NamespaceFacade extends CuratorFrameworkImpl
 @Override
 public void createContainers(String path) throws Exception
 {
+path = fixForNamespace(path);
 client.createContainers(path);
 }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/1556a2fc/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 811631c..b6a0a40 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -592,6 +592,48 @@ public class TestFramework extends BaseClassForTests
 CloseableUtils.closeQuietly(client);
 }
 }
+
+@Test
+public void testCreateContainersWithNamespace() throws Exception
+{
+final String namespace = "container1";
+CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
+CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).namespace(namespace).build();
+client.start();
+try
+{
+String path = "/path1/path2";
+client.createContainers(path);
+Assert.assertNotNull(client.checkExists().forPath(path));
+
Assert.assertNotNull(client.getZookeeperClient().getZooKeeper().exists("/" + 
namespace + path, false));
+}
+finally
+{
+CloseableUtils.closeQuietly(client);
+}
+}
+
+
+@Test
+public void testCreateContainersUsingNamespace() throws Exception
+{
+final String namespace = "container2";
+CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
+CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).build();
+client.start();
+CuratorFramework nsClient = client.usingNamespace(namespace);
+try
+{
+String path = "/path1/path2";
+nsClient.createContainers(path);
+Assert.assertNotNull(nsClient.checkExists().forPath(path));
+
Assert.assertNotNull(nsClient.getZookeeperClient().getZooKeeper().exists("/" + 
namespace + path, false));
+}
+finally
+{
+CloseableUtils.closeQuietly(client);
+}
+}
 
 @Test
 public void testNamespace() throws Exception



[2/2] curator git commit: NamespaceFacade should not overload createContainers(). It was losing the namespace

2015-10-06 Thread randgalt
NamespaceFacade should not overload createContainers(). It was losing the 
namespace


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/f4f22082
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/f4f22082
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/f4f22082

Branch: refs/heads/master
Commit: f4f2208240cf6c76067f3ae1b5fbe58b46ac2478
Parents: 1556a2f
Author: randgalt 
Authored: Tue Oct 6 08:21:05 2015 -0500
Committer: randgalt 
Committed: Tue Oct 6 08:21:05 2015 -0500

--
 .../org/apache/curator/framework/imps/NamespaceFacade.java| 7 ---
 .../java/org/apache/curator/framework/imps/TestFramework.java | 6 +++---
 2 files changed, 3 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/f4f22082/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
--
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
index a4bb2e5..95bf132 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
@@ -43,13 +43,6 @@ class NamespaceFacade extends CuratorFrameworkImpl
 }
 
 @Override
-public void createContainers(String path) throws Exception
-{
-path = fixForNamespace(path);
-client.createContainers(path);
-}
-
-@Override
 public CuratorFramework nonNamespaceView()
 {
 return usingNamespace(null);

http://git-wip-us.apache.org/repos/asf/curator/blob/f4f22082/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index b6a0a40..8aa37c0 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -599,9 +599,9 @@ public class TestFramework extends BaseClassForTests
 final String namespace = "container1";
 CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
 CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).namespace(namespace).build();
-client.start();
 try
 {
+client.start();
 String path = "/path1/path2";
 client.createContainers(path);
 Assert.assertNotNull(client.checkExists().forPath(path));
@@ -620,10 +620,10 @@ public class TestFramework extends BaseClassForTests
 final String namespace = "container2";
 CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
 CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).build();
-client.start();
-CuratorFramework nsClient = client.usingNamespace(namespace);
 try
 {
+client.start();
+CuratorFramework nsClient = client.usingNamespace(namespace);
 String path = "/path1/path2";
 nsClient.createContainers(path);
 Assert.assertNotNull(nsClient.checkExists().forPath(path));



[1/2] curator git commit: CURATOR-270 createContainers does not work correctly with usingNamespace

2015-10-06 Thread randgalt
Repository: curator
Updated Branches:
  refs/heads/master f8f05be2e -> f4f220824


CURATOR-270 createContainers does not work correctly with usingNamespace


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1556a2fc
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1556a2fc
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1556a2fc

Branch: refs/heads/master
Commit: 1556a2fcb8fd0d43669b057eb51290e3bf5ee5a2
Parents: f8f05be
Author: Alexey Serba 
Authored: Tue Oct 6 00:11:35 2015 +0300
Committer: Alexey Serba 
Committed: Tue Oct 6 00:11:35 2015 +0300

--
 .../curator/framework/imps/NamespaceFacade.java |  1 +
 .../curator/framework/imps/TestFramework.java   | 42 
 2 files changed, 43 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/1556a2fc/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
--
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
index 60ef647..a4bb2e5 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceFacade.java
@@ -45,6 +45,7 @@ class NamespaceFacade extends CuratorFrameworkImpl
 @Override
 public void createContainers(String path) throws Exception
 {
+path = fixForNamespace(path);
 client.createContainers(path);
 }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/1556a2fc/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 811631c..b6a0a40 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -592,6 +592,48 @@ public class TestFramework extends BaseClassForTests
 CloseableUtils.closeQuietly(client);
 }
 }
+
+@Test
+public void testCreateContainersWithNamespace() throws Exception
+{
+final String namespace = "container1";
+CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
+CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).namespace(namespace).build();
+client.start();
+try
+{
+String path = "/path1/path2";
+client.createContainers(path);
+Assert.assertNotNull(client.checkExists().forPath(path));
+
Assert.assertNotNull(client.getZookeeperClient().getZooKeeper().exists("/" + 
namespace + path, false));
+}
+finally
+{
+CloseableUtils.closeQuietly(client);
+}
+}
+
+
+@Test
+public void testCreateContainersUsingNamespace() throws Exception
+{
+final String namespace = "container2";
+CuratorFrameworkFactory.Builder builder = 
CuratorFrameworkFactory.builder();
+CuratorFramework client = 
builder.connectString(server.getConnectString()).retryPolicy(new 
RetryOneTime(1)).build();
+client.start();
+CuratorFramework nsClient = client.usingNamespace(namespace);
+try
+{
+String path = "/path1/path2";
+nsClient.createContainers(path);
+Assert.assertNotNull(nsClient.checkExists().forPath(path));
+
Assert.assertNotNull(nsClient.getZookeeperClient().getZooKeeper().exists("/" + 
namespace + path, false));
+}
+finally
+{
+CloseableUtils.closeQuietly(client);
+}
+}
 
 @Test
 public void testNamespace() throws Exception