AtlasZookeeperSecurityProperties { public static ACL parseAcl(String aclString, ACL defaultAcl) { if (StringUtils.isEmpty(aclString)) { return defaultAcl; } return parseAcl(aclString); }  static ACL parseAcl(String aclString, ACL defaultAcl); static ACL parseAcl(String aclString); static AuthInfo parseAuth(String authString);  }
@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); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldThrowExceptionForNullAcl() { ACL acl = AtlasZookeeperSecurityProperties.parseAcl(null); fail("Should have thrown exception for null ACL string"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldThrowExceptionForInvalidAclString() { ACL acl = AtlasZookeeperSecurityProperties.parseAcl("randomAcl"); fail("Should have thrown exception for null ACL string"); }
@Test public void idsWithColonsAreValid() { ACL acl = AtlasZookeeperSecurityProperties.parseAcl("auth:user:password"); assertEquals(acl.getId().getScheme(), "auth"); assertEquals(acl.getId().getId(), "user:password"); }
@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)); }