@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Create)) return false; Create op = (Create) o; boolean aclEquals = true; Iterator<ACL> i = op.acl.iterator(); for (ACL acl : op.acl) { boolean hasMoreData = i.hasNext(); if (!hasMoreData) { aclEquals = false; break; } ACL otherAcl = i.next(); if (!acl.equals(otherAcl)) { aclEquals = false; break; } } return !i.hasNext() && getType() == op.getType() && Arrays.equals(data, op.data) && flags == op.flags && aclEquals; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Create)) return false; Create op = (Create) o; boolean aclEquals = true; Iterator<ACL> i = op.acl.iterator(); for (ACL acl : op.acl) { boolean hasMoreData = i.hasNext(); if (!hasMoreData) { aclEquals = false; break; } ACL otherAcl = i.next(); if (!acl.equals(otherAcl)) { aclEquals = false; break; } } return !i.hasNext() && getType() == op.getType() && Arrays.equals(data, op.data) && flags == op.flags && aclEquals; }
/** * compare two list of acls. if there elements are in the same order and the * same size then return true else return false * * @param lista * the list to be compared * @param listb * the list to be compared * @return true if and only if the lists are of the same size and the * elements are in the same order in lista and listb */ private boolean listACLEquals(List<ACL> lista, List<ACL> listb) { if (lista.size() != listb.size()) { return false; } for (int i = 0; i < lista.size(); i++) { ACL a = lista.get(i); ACL b = listb.get(i); if (!a.equals(b)) { return false; } } return true; }
@Test public void testUGIProperties() throws Throwable { UserGroupInformation user = UserGroupInformation.getCurrentUser(); ACL acl = registrySecurity.createACLForUser(user, ZooDefs.Perms.ALL); assertFalse(RegistrySecurity.ALL_READWRITE_ACCESS.equals(acl)); LOG.info("User {} has ACL {}", user, acl); }
@Test public void testUGIProperties() throws Throwable { UserGroupInformation user = UserGroupInformation.getCurrentUser(); ACL acl = registrySecurity.createACLForUser(user, ZooDefs.Perms.ALL); assertFalse(RegistrySecurity.ALL_READWRITE_ACCESS.equals(acl)); LOG.info("User {} has ACL {}", user, acl); }