private void addDatePartition(Path basePath, LocalDate date) throws Exception {
    if (!fs.exists(basePath)) {
      fs.mkdirs(basePath);
      fs.setPermission(basePath, FsPermission.createImmutable((short)01777));
    }

    Path datePtn = new Path(basePath, getDirForDate(date));
    fs.mkdirs(datePtn);
    fs.setPermission(datePtn, FsPermission.createImmutable((short) 01777));
    FsPermission.setUMask(hiveConf, FsPermission.createImmutable((short) 0066));
    Path partFile = new Path(datePtn, "data");
    FSDataOutputStream out = fs.create(partFile);
    out.writeInt(1000);
    out.close();
  }
Returns the directory name for a given date.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveProtoEventsCleanerTask.java