Search in sources :

Example 71 with ACL

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));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) CreateBuilder(org.apache.curator.framework.api.CreateBuilder) ACL(org.apache.zookeeper.data.ACL) SetupStep(org.apache.atlas.setup.SetupStep) Id(org.apache.zookeeper.data.Id) InterProcessMutex(org.apache.curator.framework.recipes.locks.InterProcessMutex) Test(org.testng.annotations.Test)

Example 72 with ACL

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");
}
Also used : ACL(org.apache.zookeeper.data.ACL) Test(org.testng.annotations.Test)

Example 73 with ACL

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));
}
Also used : ACL(org.apache.zookeeper.data.ACL) Test(org.testng.annotations.Test)

Example 74 with ACL

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");
}
Also used : ACL(org.apache.zookeeper.data.ACL) Test(org.testng.annotations.Test)

Example 75 with ACL

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);
}
Also used : ACL(org.apache.zookeeper.data.ACL) Test(org.testng.annotations.Test)

Aggregations

ACL (org.apache.zookeeper.data.ACL)215 Id (org.apache.zookeeper.data.Id)85 ArrayList (java.util.ArrayList)61 Test (org.junit.Test)56 Stat (org.apache.zookeeper.data.Stat)45 KeeperException (org.apache.zookeeper.KeeperException)35 Test (org.testng.annotations.Test)32 CuratorFramework (org.apache.curator.framework.CuratorFramework)20 Test (org.junit.jupiter.api.Test)18 Configuration (org.apache.hadoop.conf.Configuration)17 ZooKeeper (org.apache.zookeeper.ZooKeeper)16 ACLProvider (org.apache.curator.framework.api.ACLProvider)15 List (java.util.List)11 IOException (java.io.IOException)10 CountDownLatch (java.util.concurrent.CountDownLatch)9 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)8 TestableZooKeeper (org.apache.zookeeper.TestableZooKeeper)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 HashMap (java.util.HashMap)6 CreateMode (org.apache.zookeeper.CreateMode)6