public Path getLocalPathForWrite(String pathStr, 
      Configuration conf) throws IOException {
    return getLocalPathForWrite(pathStr, SIZE_UNKNOWN, conf);
  }
@Test(timeout = 30000)
  public void testDirectoryRecovery() throws Throwable {
    String dir0 = buildBufferDir(ROOT, 0);
    String subdir = dir0 + "/subdir1/subdir2";

    conf.set(CONTEXT, subdir);
    // get local path and an ancestor
    final Path pathForWrite = dirAllocator.getLocalPathForWrite("file", -1, conf);
    final Path ancestor = pathForWrite.getParent().getParent();

    // delete that ancestor
    localFs.delete(ancestor, true);
    // and expect to get a new file back
    dirAllocator.getLocalPathForWrite("file2", -1, conf);
  }