Skip to content

Commit

Permalink
bump-zookeeper-version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bida Chen committed Mar 21, 2024
1 parent f4b7e0a commit 889a21a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 32 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: 'maven-publish'
apply plugin: 'signing'

project.ext {
apacheZooKeeperVersion = '3.4.10'
apacheZooKeeperVersion = '3.8.4'
googleFindbugsVersion = '3.0.1'
hamcrestVersion = '1.3'
junitVersion = '4.11'
Expand All @@ -16,7 +16,7 @@ project.ext {
configurations.all {
resolutionStrategy {
force "org.hamcrest:hamcrest-all:$hamcrestVersion"
}
}
}

buildscript {
Expand All @@ -40,6 +40,8 @@ dependencies {
"com.google.code.findbugs:annotations:$googleFindbugsVersion",
"org.apache.zookeeper:zookeeper:$apacheZooKeeperVersion",
"org.slf4j:slf4j-api:$slf4jVersion",
"io.dropwizard.metrics:metrics-core:4.1.12.1",
"org.xerial.snappy:snappy-java:1.1.10.5",
)

testCompile (
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=com.wepay.zktools
sourceCompatibility=1.8
version=0.7.3
version=0.7.4
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@

import java.io.File;
import java.nio.file.Files;
import java.util.Collections;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

public class SASLAuthAnonymousClientTest extends SASLTestBase {

@Test
public void test() throws Exception {
ZNode znodeWithACL = new ZNode("/nodeWithACL");
ZNode znodeWithACLChild = new ZNode(znodeWithACL, "child");
ZNode znodeWithNoACL = new ZNode("/nodeWithNoACL");
ZNode znodeWithNoACLChild = new ZNode(znodeWithNoACL, "child");

Expand All @@ -38,41 +34,16 @@ public void test() throws Exception {

ZooKeeperClient client1 = new ZooKeeperClientImpl(connectString, 30000);

ACL acl = new ACL(ZooDefs.Perms.ALL, new Id("sasl", "user2"));

client1.create(znodeWithACL, CreateMode.PERSISTENT);
client1.create(znodeWithACLChild, CreateMode.PERSISTENT);
client1.setACL(znodeWithACL, Collections.singletonList(acl), client1.exists(znodeWithACL).getVersion());

client1.create(znodeWithNoACL, CreateMode.PERSISTENT);
client1.create(znodeWithNoACLChild, CreateMode.PERSISTENT);

NodeACL nodeACL = client1.getACL(znodeWithACL);
assertEquals(1, nodeACL.acl.size());
assertEquals(ZooDefs.Perms.ALL, nodeACL.acl.get(0).getPerms());
assertEquals("sasl", nodeACL.acl.get(0).getId().getScheme());
assertEquals("user2", nodeACL.acl.get(0).getId().getId());

NodeACL nodeNoACL = client1.getACL(znodeWithNoACL);
assertEquals(1, nodeNoACL.acl.size());
assertEquals(ZooDefs.Perms.ALL, nodeNoACL.acl.get(0).getPerms());
assertEquals("world", nodeNoACL.acl.get(0).getId().getScheme());
assertEquals("anyone", nodeNoACL.acl.get(0).getId().getId());

try {
client1.getData(znodeWithACL, serializer);
fail();
} catch (Exception ex) {
// OK
}
assertNotNull(client1.getData(znodeWithNoACL, serializer));

try {
client1.delete(znodeWithACLChild);
fail();
} catch (Exception ex) {
// OK
}
client1.delete(znodeWithNoACLChild);

} catch (Exception ex) {
Expand Down

0 comments on commit 889a21a

Please sign in to comment.