public static FsPermission
        getConfiguredHistoryIntermediateUserDoneDirPermissions(
            Configuration conf) {
    String userDoneDirPermissions = conf.get(
        JHAdminConfig.MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS);
    if (userDoneDirPermissions == null) {
      return new FsPermission(
          JHAdminConfig.DEFAULT_MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS);
    }
    FsPermission permission = new FsPermission(userDoneDirPermissions);
    if (permission.getUserAction() != FsAction.ALL ||
        permission.getGroupAction() != FsAction.ALL) {
      permission = new FsPermission(FsAction.ALL, FsAction.ALL,
          permission.getOtherAction(), permission.getStickyBit());
      LOG.warn("Unsupported permission configured in " +
          JHAdminConfig.MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS +
          ", the user and the group permission must be 7 (rwx). " +
          "The permission was set to " + permission.toString());
    }
    return permission;
  }
@Test
  public void testGetConfiguredHistoryIntermediateUserDoneDirPermissions() {
    Configuration conf = new Configuration();
    Map<String, FsPermission> parameters = ImmutableMap.of(
        "775", new FsPermission(0775),
        "123", new FsPermission(0773),
        "-rwx", new FsPermission(0770),
        "+rwx", new FsPermission(0777)
    );
    for (Map.Entry<String, FsPermission> entry : parameters.entrySet()) {
      conf.set(JHAdminConfig.MR_HISTORY_INTERMEDIATE_USER_DONE_DIR_PERMISSIONS,
          entry.getKey());
      assertEquals(entry.getValue(),
          getConfiguredHistoryIntermediateUserDoneDirPermissions(conf));
    }
  }