You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2016/01/19 00:04:52 UTC

[1/3] curator git commit: ZKPaths.mkdirs() was always passing the full path to the aclProvider instead of the subpath being created

Repository: curator
Updated Branches:
  refs/heads/CURATOR-3.0 ae8dc466c -> 75325d4ae


ZKPaths.mkdirs() was always passing the full path to the aclProvider instead of the subpath being created


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

Branch: refs/heads/CURATOR-3.0
Commit: d6da90e8e746c92cc182e62a96fc2a9182fd1a15
Parents: 45332f3
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 12 10:13:12 2016 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue Jan 12 10:13:12 2016 -0500

----------------------------------------------------------------------
 .../java/org/apache/curator/utils/ZKPaths.java  |  2 +-
 .../framework/recipes/locks/TestLockACLs.java   | 50 ++++++++++++++++----
 2 files changed, 43 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/d6da90e8/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
index 75e1171..17fa913 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
@@ -278,7 +278,7 @@ public class ZKPaths
                     List<ACL> acl = null;
                     if ( aclProvider != null )
                     {
-                        acl = aclProvider.getAclForPath(path);
+                        acl = aclProvider.getAclForPath(subPath);
                         if ( acl == null )
                         {
                             acl = aclProvider.getDefaultAcl();

http://git-wip-us.apache.org/repos/asf/curator/blob/d6da90e8/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
index 2d9a9aa..b6159cc 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
@@ -26,7 +26,6 @@ import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.ACLProvider;
 import org.apache.curator.retry.ExponentialBackoffRetry;
-import org.apache.curator.test.TestingServer;
 import org.apache.zookeeper.ZooDefs;
 import org.apache.zookeeper.data.ACL;
 import org.apache.zookeeper.data.Id;
@@ -37,16 +36,17 @@ import java.util.List;
 
 public class TestLockACLs extends BaseClassForTests
 {
-    private static final List<ACL> ACLS = Collections.singletonList(new ACL(ZooDefs.Perms.ALL, new Id("ip", "127.0.0.1")));
+    private static final List<ACL> ACLS1 = Collections.singletonList(new ACL(ZooDefs.Perms.ALL, new Id("ip", "127.0.0.1")));
+    private static final List<ACL> ACLS2 = Collections.singletonList(new ACL(ZooDefs.Perms.CREATE, new Id("ip", "127.0.0.1")));
 
-    private CuratorFramework createClient() throws Exception
+    private CuratorFramework createClient(ACLProvider provider) throws Exception
     {
         RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
         CuratorFramework client = CuratorFrameworkFactory.builder()
             .namespace("ns")
             .connectString(server.getConnectString())
             .retryPolicy(retryPolicy)
-            .aclProvider(new MyACLProvider())
+            .aclProvider(provider)
             .build();
         client.start();
         return client;
@@ -55,7 +55,7 @@ public class TestLockACLs extends BaseClassForTests
     @Test
     public void testLockACLs() throws Exception
     {
-        CuratorFramework client = createClient();
+        CuratorFramework client = createClient(new TestLockACLsProvider());
         try
         {
             client.create().forPath("/foo");
@@ -78,19 +78,53 @@ public class TestLockACLs extends BaseClassForTests
         }
     }
 
-    public class MyACLProvider implements ACLProvider
+    @Test
+    public void testACLsCreatingParents() throws Exception
+    {
+        CuratorFramework client = createClient(new TestACLsCreatingParentsProvider());
+        try
+        {
+            client.create().creatingParentsIfNeeded().forPath("/parent/foo");
+            Assert.assertEquals(ZooDefs.Perms.CREATE, client.getACL().forPath("/parent").get(0).getPerms());
+            Assert.assertEquals(ZooDefs.Perms.ALL, client.getACL().forPath("/parent/foo").get(0).getPerms());
+        }
+        finally
+        {
+            CloseableUtils.closeQuietly(client);
+        }
+    }
+
+    private class TestACLsCreatingParentsProvider implements ACLProvider
     {
+        @Override
+        public List<ACL> getDefaultAcl()
+        {
+            return ACLS1;
+        }
 
         @Override
+        public List<ACL> getAclForPath(String path)
+        {
+            if ( path.equals("/ns/parent") )
+            {
+                return ACLS2;
+            }
+            return ACLS1;
+        }
+    }
+
+    private class TestLockACLsProvider implements ACLProvider
+    {
+        @Override
         public List<ACL> getDefaultAcl()
         {
-            return ACLS;
+            return ACLS1;
         }
 
         @Override
         public List<ACL> getAclForPath(String path)
         {
-            return ACLS;
+            return ACLS1;
         }
     }
 }


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

Posted by ra...@apache.org.
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/75325d4a
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/75325d4a
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/75325d4a

Branch: refs/heads/CURATOR-3.0
Commit: 75325d4aea8057607c7ee4a531b0c41f2bf2a6cb
Parents: ae8dc46 b08b543
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 18 18:04:41 2016 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 18 18:04:41 2016 -0500

----------------------------------------------------------------------
 .../java/org/apache/curator/utils/ZKPaths.java  |  2 +-
 .../framework/recipes/locks/TestLockACLs.java   | 50 ++++++++++++++++----
 2 files changed, 43 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/75325d4a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
----------------------------------------------------------------------


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

Posted by ra...@apache.org.
Merge branch 'master' into CURATOR-244


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

Branch: refs/heads/CURATOR-3.0
Commit: b08b543da519cf932b4d47a2e5e5ad69c76f49cc
Parents: d6da90e 5d485b0
Author: randgalt <ra...@apache.org>
Authored: Mon Jan 18 18:04:07 2016 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 18 18:04:07 2016 -0500

----------------------------------------------------------------------
 .../org/apache/curator/ConnectionState.java     |  4 ++
 .../apache/curator/CuratorZookeeperClient.java  |  2 +
 .../main/java/org/apache/curator/RetryLoop.java |  2 +
 .../apache/curator/SessionFailRetryLoop.java    |  2 +
 .../exhibitor/ExhibitorEnsembleProvider.java    |  2 +
 .../org/apache/curator/utils/ThreadUtils.java   | 23 +++++++
 .../src/main/java/locking/LockingExample.java   |  7 ++-
 .../framework/api/VersionPathAndBytesable.java  | 25 ++++++++
 .../transaction/TransactionCreateBuilder.java   |  5 +-
 .../transaction/TransactionSetDataBuilder.java  |  4 +-
 .../curator/framework/imps/Backgrounding.java   |  2 +
 .../framework/imps/CreateBuilderImpl.java       | 15 +++--
 .../framework/imps/CuratorFrameworkImpl.java    | 46 +++++++++-----
 .../framework/imps/DeleteBuilderImpl.java       |  2 +
 .../framework/imps/FailedDeleteManager.java     |  5 +-
 .../FindAndDeleteProtectedNodeInBackground.java |  3 +
 .../framework/imps/GetDataBuilderImpl.java      |  2 +
 .../curator/framework/imps/NamespaceImpl.java   |  2 +
 .../framework/imps/NamespaceWatcher.java        |  2 +
 .../framework/imps/OperationAndData.java        | 11 +++-
 .../framework/imps/SetDataBuilderImpl.java      |  8 +--
 .../framework/listen/ListenerContainer.java     |  2 +
 .../framework/state/ConnectionStateManager.java | 14 +++--
 .../framework/imps/TestTransactions.java        | 46 +++++++++++++-
 .../recipes/AfterConnectionEstablished.java     |  1 +
 .../recipes/cache/DefaultTreeCacheSelector.java | 37 +++++++++++
 .../framework/recipes/cache/NodeCache.java      |  4 ++
 .../recipes/cache/PathChildrenCache.java        |  4 ++
 .../framework/recipes/cache/TreeCache.java      | 45 +++++++++----
 .../recipes/cache/TreeCacheSelector.java        | 66 ++++++++++++++++++++
 .../framework/recipes/leader/LeaderLatch.java   |  5 ++
 .../recipes/leader/LeaderSelector.java          | 10 ++-
 .../framework/recipes/locks/ChildReaper.java    |  1 +
 .../recipes/locks/InterProcessMultiLock.java    |  4 ++
 .../recipes/locks/InterProcessSemaphore.java    |  4 ++
 .../recipes/locks/InterProcessSemaphoreV2.java  |  2 +
 .../framework/recipes/locks/LockInternals.java  |  2 +
 .../curator/framework/recipes/locks/Reaper.java |  1 +
 .../framework/recipes/nodes/GroupMember.java    |  3 +
 .../recipes/nodes/PersistentEphemeralNode.java  |  3 +
 .../recipes/queue/DistributedQueue.java         | 43 ++++++++-----
 .../framework/recipes/queue/QueueSharder.java   | 16 +++--
 .../framework/recipes/shared/SharedValue.java   |  2 +
 ...estResetConnectionWithBackgroundFailure.java | 36 +++++------
 .../framework/recipes/cache/TestTreeCache.java  | 57 +++++++++++++++--
 .../curator/test/TestingZooKeeperMain.java      | 31 ++++++++-
 .../entity/JsonServiceInstanceMarshaller.java   |  3 +
 .../entity/JsonServiceInstancesMarshaller.java  |  2 +
 .../server/rest/DiscoveryResource.java          |  6 ++
 .../discovery/server/rest/InstanceCleanup.java  |  2 +
 .../discovery/details/ServiceDiscoveryImpl.java |  3 +
 .../x/rpc/idl/discovery/DiscoveryService.java   |  8 +++
 .../idl/discovery/DiscoveryServiceLowLevel.java |  7 +++
 .../idl/services/CuratorProjectionService.java  | 25 ++++++++
 54 files changed, 563 insertions(+), 106 deletions(-)
----------------------------------------------------------------------