use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project incubator-atlas by apache.
the class SetupStepsTest method shouldCreateSetupInProgressNode.
@Test
public void shouldCreateSetupInProgressNode() throws Exception {
Set<SetupStep> steps = new LinkedHashSet<>();
SetupStep setupStep1 = mock(SetupStep.class);
steps.add(setupStep1);
when(configuration.getString(HAConfiguration.ATLAS_SERVER_HA_ZK_ROOT_KEY, HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT);
when(configuration.getString(HAConfiguration.HA_ZOOKEEPER_ACL)).thenReturn("digest:user:pwd");
List<ACL> aclList = Arrays.asList(new ACL(ZooDefs.Perms.ALL, new Id("digest", "user:pwd")));
setupServerIdSelectionMocks();
CreateBuilder createBuilder = setupSetupInProgressPathMocks(aclList).getLeft();
InterProcessMutex lock = mock(InterProcessMutex.class);
when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(lock);
SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
setupSteps.runSetup();
verify(createBuilder).withACL(aclList);
verify(createBuilder).forPath(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT + SetupSteps.SETUP_IN_PROGRESS_NODE, "id2".getBytes(Charsets.UTF_8));
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project incubator-atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method idsWithColonsAreValid.
@Test
public void idsWithColonsAreValid() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl("auth:user:password");
assertEquals(acl.getId().getScheme(), "auth");
assertEquals(acl.getId().getId(), "user:password");
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project incubator-atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method shouldReturnDefaultAclIfNullOrEmpty.
@Test
public void shouldReturnDefaultAclIfNullOrEmpty() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl(null, ZooDefs.Ids.OPEN_ACL_UNSAFE.get(0));
assertEquals(acl, ZooDefs.Ids.OPEN_ACL_UNSAFE.get(0));
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project incubator-atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method shouldThrowExceptionForNullAcl.
@Test(expectedExceptions = IllegalArgumentException.class)
public void shouldThrowExceptionForNullAcl() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl(null);
fail("Should have thrown exception for null ACL string");
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.data.ACL in project incubator-atlas by apache.
the class AtlasZookeeperSecurityPropertiesTest method shouldGetAcl.
@Test
public void shouldGetAcl() {
ACL acl = AtlasZookeeperSecurityProperties.parseAcl("sasl:myclient@EXAMPLE.COM");
assertEquals(acl.getId().getScheme(), "sasl");
assertEquals(acl.getId().getId(), "myclient@EXAMPLE.COM");
assertEquals(acl.getPerms(), ZooDefs.Perms.ALL);
}
Aggregations