@Test
public void testCreateDirectories() throws IOException {

  
  conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
  String dirA = new File(testDir, "dirA").getPath();
  String dirB = new File(dirA, "dirB").getPath();
  String dirC = new File(testDir, "dirC").getPath();
  Path pathC = new Path(dirC);
  FsPermission permDirC = new FsPermission((short)0710);
  localFs.mkdir(pathC, null, true);
  localFs.setPermission(pathC, permDirC);
  String[] dirs = { dirA, dirB, dirC };
  DirectoryCollection dc =
      new DirectoryCollection(dirs, conf.getFloat(
        YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE,
        YarnConfiguration.DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE));
  FsPermission defaultPerm = FsPermission.getDefault()
      .applyUMask(new FsPermission((short)FsPermission.DEFAULT_UMASK));
  boolean createResult = dc.createNonExistentDirs(localFs, defaultPerm);
  Assert.assertTrue(createResult);
  FileStatus status = localFs.getFileStatus(new Path(dirA));
  Assert.assertEquals("local dir parent not created with proper permissions",
      defaultPerm, status.getPermission());
  status = localFs.getFileStatus(new Path(dirB));
  Assert.assertEquals("local dir not created with proper permissions",
      defaultPerm, status.getPermission());
  status = localFs.getFileStatus(pathC);
  Assert.assertEquals("existing local directory permissions modified",
      permDirC, status.getPermission());
}