private void deleteSnapshotWithAclAndVerify(AclFeature aclFeature, Path pathToCheckAcl, int totalAclFeatures) throws IOException { hdfs.deleteSnapshot(path, snapshotName); AclFeature afterDeleteAclFeature = FSAclBaseTest.getAclFeature( pathToCheckAcl, cluster); assertSame(aclFeature, afterDeleteAclFeature); assertEquals("Reference count should remain same" + " even after deletion of snapshot", 1, afterDeleteAclFeature.getRefCount()); hdfs.removeAcl(pathToCheckAcl); assertEquals("Reference count should be 0", 0, aclFeature.getRefCount()); assertEquals("Unique ACL features should remain same", totalAclFeatures, AclStorage.getUniqueAclFeatures().getUniqueElementsSize()); }
child1AclFeature = getAclFeature(child1, cluster); assertEquals("Reference count should be 1", 1, child1AclFeature.getRefCount()); currentSize++; child2AclFeature); assertEquals("Reference count should be 2", 2, child2AclFeature.getRefCount()); AclFeature modifiedAclFeature = getAclFeature(child1, cluster); assertEquals("Old Reference count should be 1", 1, child1AclFeature.getRefCount()); assertEquals("New Reference count should be 1", 1, modifiedAclFeature.getRefCount()); fs.removeAclEntries(child1, Lists.newArrayList(aclEntry)); assertEquals("Old Reference count should be 2 again", 2, child1AclFeature.getRefCount()); assertEquals("New Reference count should be 0", 0, modifiedAclFeature.getRefCount()); child1AclFeature.getRefCount()); child1AclFeature.getRefCount()); fileAclFeature = getAclFeature(file1, cluster); assertEquals("Reference count should be 1", 1, fileAclFeature.getRefCount()); fs.create(file2).close();
aclFeature.getRefCount()); Path snapshotPath = SnapshotTestHelper.createSnapshot(hdfs, path, snapshotName); assertSame(aclFeature, snapshotAclFeature); assertEquals("Reference count should be increased", 2, snapshotAclFeature.getRefCount()); assertEquals("Reference count should be 1", 1, aclFeature.getRefCount()); Path snapshotPath = SnapshotTestHelper.createSnapshot(hdfs, path, snapshotName); assertSame(aclFeature, snapshotAcl); assertEquals("Reference count should remain same", 1, aclFeature.getRefCount()); assertEquals("Reference count should be 1", 1, aclFeature.getRefCount()); Path snapshotPath = SnapshotTestHelper.createSnapshot(hdfs, path, snapshotName); assertSame(aclFeature, snapshotAcl); assertEquals("Reference count should remain same", 1, aclFeature.getRefCount()); aclFeature = FSAclBaseTest.getAclFeature(path, cluster); assertEquals("Before modification same ACL should be referenced twice", 2, aclFeature.getRefCount()); List<AclEntry> newAcl = Lists.newArrayList(aclEntry(ACCESS, USER, "testNewUser", ALL));