curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject git commit: Wrong path was being usedin getParticipantNodes()
Date Wed, 25 Sep 2013 03:49:22 GMT
Updated Branches:
  refs/heads/master 852e3fd3f -> 10eb1efe5


Wrong path was being usedin getParticipantNodes()


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

Branch: refs/heads/master
Commit: 10eb1efe554f1c499976be22a89586fc3f2519b4
Parents: 852e3fd
Author: randgalt <randgalt@apache.org>
Authored: Tue Sep 24 20:50:19 2013 -0700
Committer: randgalt <randgalt@apache.org>
Committed: Tue Sep 24 20:50:19 2013 -0700

----------------------------------------------------------------------
 .../recipes/locks/InterProcessSemaphoreV2.java  |  2 +-
 .../locks/TestInterProcessSemaphore.java        | 23 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/10eb1efe/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
index e24b019..94b740e 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
@@ -164,7 +164,7 @@ public class InterProcessSemaphoreV2
      */
     public Collection<String> getParticipantNodes() throws Exception
     {
-        return client.getChildren().forPath(ZKPaths.makePath(leasesPath, LEASE_BASE_NAME));
+        return client.getChildren().forPath(leasesPath);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/10eb1efe/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
index b930cc0..35bb876 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
@@ -491,4 +491,27 @@ public class TestInterProcessSemaphore extends BaseClassForTests
             client.close();
         }
     }
+
+    @Test
+    public void testGetParticipantNodes() throws Exception
+    {
+        final int LEASES = 3;
+
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(),
new RetryOneTime(1));
+        client.start();
+        try
+        {
+            InterProcessSemaphoreV2 semaphore = new InterProcessSemaphoreV2(client, "/test",
LEASES);
+            for ( int i = 0; i < LEASES; ++i )
+            {
+                semaphore.acquire();
+            }
+
+            Assert.assertEquals(semaphore.getParticipantNodes().size(), LEASES);
+        }
+        finally
+        {
+            Closeables.closeQuietly(client);
+        }
+    }
 }


Mime
View raw message