use of com.spotify.helios.master.MasterZooKeeperRegistrar in project helios by spotify.
the class ZooKeeperAclInitializerTest method testInitializeAcl.
@Test
public void testInitializeAcl() throws Exception {
// setup the initial helios tree
final ZooKeeperClient zkClient = new DefaultZooKeeperClient(zk.curatorWithSuperAuth());
zkClient.ensurePath(Paths.configId(CLUSTER_ID));
new MasterZooKeeperRegistrar("helios-master").tryToRegister(zkClient);
// to start with, nothing should have permissions
for (final String path : zkClient.listRecursive("/")) {
assertEquals(ZooDefs.Ids.OPEN_ACL_UNSAFE, zkClient.getAcl(path));
}
// initialize ACL's
ZooKeeperAclInitializer.initializeAcl(zk.connectString(), CLUSTER_ID, MASTER_USER, MASTER_PASSWORD, AGENT_USER, AGENT_PASSWORD);
for (final String path : zkClient.listRecursive("/")) {
final List<ACL> expected = aclProvider.getAclForPath(path);
final List<ACL> actual = zkClient.getAcl(path);
assertEquals(expected.size(), actual.size());
assertTrue(expected.containsAll(actual));
}
}
Aggregations