@Test
@TestDir
@TestJetty
@TestHdfs
public void testDirAcls() throws Exception {

  final String defUser1 = "default:user:glarch:r-x";
  final String defSpec1 = "aclspec=" + defUser1;
  final String dir = "/aclDirTest";
  String statusJson;
  List<String> aclEntries;
  createHttpFSServer(false, false);
  FileSystem fs = FileSystem.get(TestHdfsHelper.getHdfsConf());
  fs.mkdirs(new Path(dir));
  /* getfilestatus and liststatus don't have 'aclBit' in their reply */
  statusJson = getStatus(dir, "GETFILESTATUS");
  Assert.assertEquals(-1, statusJson.indexOf("aclBit"));
  /* No ACLs, either */
  statusJson = getStatus(dir, "GETACLSTATUS");
  aclEntries = getAclEntries(statusJson);
  Assert.assertTrue(aclEntries.size() == 0);
  /* Give it a default ACL and verify */
  putCmd(dir, "SETACL", defSpec1);
  statusJson = getStatus(dir, "GETFILESTATUS");
  Assert.assertNotEquals(-1, statusJson.indexOf("aclBit"));
  statusJson = getStatus(dir, "GETACLSTATUS");
  aclEntries = getAclEntries(statusJson);
  Assert.assertTrue(aclEntries.size() == 5);
  /* 4 Entries are default:(user|group|mask|other):perm */
  Assert.assertTrue(aclEntries.contains(defUser1));
  /* Remove the default ACL and re-verify */
  putCmd(dir, "REMOVEDEFAULTACL", null);
  statusJson = getStatus(dir, "GETFILESTATUS");
  Assert.assertEquals(-1, statusJson.indexOf("aclBit"));
  statusJson = getStatus(dir, "GETACLSTATUS");
  aclEntries = getAclEntries(statusJson);
  Assert.assertTrue(aclEntries.size() == 0);
}