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 2018/12/05 17:01:15 UTC
[1/4] curator git commit: CURATOR-489: CreateBuilderImpl assigns
protectedId if doProtected is true
Repository: curator
Updated Branches:
refs/heads/master 26ffdfb89 -> 1720520f2
CURATOR-489: CreateBuilderImpl assigns protectedId if doProtected is true
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/5c27ecc2
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/5c27ecc2
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/5c27ecc2
Branch: refs/heads/master
Commit: 5c27ecc29c3503633462cd95971ceb6a91175404
Parents: 26ffdfb
Author: josh gruenberg <jo...@gmail.com>
Authored: Tue Dec 4 14:17:15 2018 -0700
Committer: josh gruenberg <jo...@gmail.com>
Committed: Tue Dec 4 14:17:15 2018 -0700
----------------------------------------------------------------------
.../org/apache/curator/framework/imps/CreateBuilderImpl.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/5c27ecc2/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
index b2a3fbc..ce82542 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
@@ -91,13 +91,15 @@ public class CreateBuilderImpl implements CreateBuilder, CreateBuilder2, Backgro
this.backgrounding = backgrounding;
this.createParentsIfNeeded = createParentsIfNeeded;
this.createParentsAsContainers = createParentsAsContainers;
- this.doProtected = doProtected;
this.compress = compress;
this.setDataIfExists = setDataIfExists;
- protectedId = null;
this.acling = new ACLing(client.getAclProvider(), aclList);
this.storingStat = storingStat;
this.ttl = ttl;
+ if ( doProtected )
+ {
+ setProtected();
+ }
}
public void setSetDataIfExistsVersion(int version)
[3/4] curator git commit: Merge pull request #1 from
Randgalt/CURATOR-489-set-protectedId
Posted by ra...@apache.org.
Merge pull request #1 from Randgalt/CURATOR-489-set-protectedId
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/1bc21db3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1bc21db3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1bc21db3
Branch: refs/heads/master
Commit: 1bc21db3bd85f5f8b3603129490ebe2d18098c52
Parents: 5c27ecc 6aa0a17
Author: josh gruenberg <jo...@users.noreply.github.com>
Authored: Wed Dec 5 08:08:37 2018 -0700
Committer: GitHub <no...@github.com>
Committed: Wed Dec 5 08:08:37 2018 -0700
----------------------------------------------------------------------
.../curator/framework/imps/TestFramework.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
[4/4] curator git commit: expanded async-create-protected test to
verify protectedId
Posted by ra...@apache.org.
expanded async-create-protected test to verify protectedId
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/1720520f
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/1720520f
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/1720520f
Branch: refs/heads/master
Commit: 1720520f2be6b995dd562949f9e08053a748c5e8
Parents: 1bc21db
Author: josh gruenberg <jo...@gmail.com>
Authored: Wed Dec 5 08:27:30 2018 -0700
Committer: josh gruenberg <jo...@gmail.com>
Committed: Wed Dec 5 08:27:45 2018 -0700
----------------------------------------------------------------------
.../org/apache/curator/framework/imps/TestFramework.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/1720520f/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 e1e875b..27a84d0 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
@@ -49,6 +49,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
+import java.util.UUID;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
@@ -408,6 +409,15 @@ public class TestFramework extends BaseClassForTests
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);
+
+ // CURATOR-489: confirm that the node contains a valid UUID, eg '_c_53345f98-9423-4e0c-a7b5-9f819e3ec2e1-yo'
+ int expectedProtectedIdLength = 36; // '53345f98-9423-4e0c-a7b5-9f819e3ec2e1'
+ int delimeterLength = 1; // '-'
+ int expectedNodeLength = CreateBuilderImpl.PROTECTED_PREFIX.length() + expectedProtectedIdLength + delimeterLength + "yo".length();
+ Assert.assertEquals(node.length(), expectedNodeLength);
+ int uuidStart = CreateBuilderImpl.PROTECTED_PREFIX.length();
+ String protectedId = node.substring(uuidStart, uuidStart + expectedProtectedIdLength);
+ UUID.fromString(protectedId); // will throw if token is not a UUID
}
finally
{
[2/4] curator git commit: Added test for async create protected
Posted by ra...@apache.org.
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 <ra...@apache.org>
Authored: Tue Dec 4 20:22:51 2018 -0500
Committer: randgalt <ra...@apache.org>
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 )