Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump zookeeper version #16

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ 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'
slf4jVersion = '1.7.21'
dropwizardMetricsVersion = '4.1.12.1'
snappyJavaVersion = '1.1.10.5'
}

configurations.all {
resolutionStrategy {
force "org.hamcrest:hamcrest-all:$hamcrestVersion"
}
}
}

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

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 @@ -5,24 +5,18 @@
import com.wepay.zktools.zookeeper.serializer.ByteArraySerializer;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Id;
import org.junit.Test;

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 +32,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
Loading