curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cammcken...@apache.org
Subject [1/2] curator git commit: CURATOR-306 - Fixed up test case that was broken as part of the addition of client schema validation.
Date Wed, 25 May 2016 05:33:15 GMT
Repository: curator
Updated Branches:
  refs/heads/CURATOR-3.0 2357123ca -> bd0792376


CURATOR-306 - Fixed up test case that was broken as part of the addition of client schema
validation.


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

Branch: refs/heads/CURATOR-3.0
Commit: ee2f1e222072f5e7ce4e7c17db0b4fff3a2e7408
Parents: 637a0eb
Author: Cam McKenzie <cammckenzie@apache.org>
Authored: Wed May 25 15:30:29 2016 +1000
Committer: Cam McKenzie <cammckenzie@apache.org>
Committed: Wed May 25 15:30:29 2016 +1000

----------------------------------------------------------------------
 .../framework/imps/TestFrameworkBackground.java | 25 ++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/ee2f1e22/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
index b9fd5c9..c62a299 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
@@ -40,6 +40,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.Test;
+
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
@@ -55,18 +57,37 @@ public class TestFrameworkBackground extends BaseClassForTests
     @Test
     public void testErrorListener() throws Exception
     {
+        //The first call to the ACL provider will return a reasonable
+        //value. The second will throw an error. This is because the ACL
+        //provider is accessed prior to the backgrounding call.
+        final AtomicBoolean aclProviderCalled = new AtomicBoolean(false);
+        
         ACLProvider badAclProvider = new ACLProvider()
         {
             @Override
             public List<ACL> getDefaultAcl()
             {
-                throw new UnsupportedOperationException();
+                if(aclProviderCalled.getAndSet(true))
+                {
+                    throw new UnsupportedOperationException();
+                }
+                else
+                {
+                    return new ArrayList<>();
+                }
             }
 
             @Override
             public List<ACL> getAclForPath(String path)
             {
-                throw new UnsupportedOperationException();
+                if(aclProviderCalled.getAndSet(true))
+                {
+                    throw new UnsupportedOperationException();
+                }
+                else
+                {
+                    return new ArrayList<>();
+                }
             }
         };
         CuratorFramework client = CuratorFrameworkFactory.builder()


Mime
View raw message