Added test for async create protected

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

Branch: refs/heads/master
Commit: 6aa0a17be282414b045906ea928b9b75fba28fbb
Parents: 5c27ecc
Author: randgalt <[email protected]>
Authored: Tue Dec 4 20:22:51 2018 -0500
Committer: randgalt <[email protected]>
Committed: Tue Dec 4 20:22:51 2018 -0500

----------------------------------------------------------------------
 .../curator/framework/imps/TestFramework.java    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/6aa0a17b/curator-x-async/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --git 
a/curator-x-async/src/test/java/org/apache/curator/framework/imps/TestFramework.java
 
b/curator-x-async/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index adc85da..e1e875b 100644
--- 
a/curator-x-async/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ 
b/curator-x-async/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -46,6 +46,7 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
@@ -396,6 +397,24 @@ public class TestFramework extends BaseClassForTests
         }
     }
 
+    @Test
+    public void testCreateWithProtection() throws ExecutionException, 
InterruptedException
+    {
+        CuratorFramework client = 
CuratorFrameworkFactory.newClient(server.getConnectString(), new 
RetryOneTime(1));
+        try
+        {
+            client.start();
+            AsyncCuratorFramework async = AsyncCuratorFramework.wrap(client);
+            String path = 
async.create().withOptions(Collections.singleton(CreateOption.doProtected)).forPath("/yo").toCompletableFuture().get();
+            String node = ZKPaths.getNodeFromPath(path);
+            
Assert.assertTrue(node.startsWith(CreateBuilderImpl.PROTECTED_PREFIX), node);
+        }
+        finally
+        {
+            CloseableUtils.closeQuietly(client);
+        }
+    }
+
     private boolean checkForContainers()
     {
         if ( ZKPaths.getContainerCreateMode() == CreateMode.PERSISTENT )

Reply via email to