@Test(expected = IOException.class)
  public void testDeletedStagedFile() throws Exception {
    Path stagingDirPath =
      new Path(dfs.getWorkingDirectory(), new Path(name.getMethodName(), STAGING_DIR));
    if (!dfs.exists(stagingDirPath)) {
      dfs.mkdirs(stagingDirPath);
    }
    SecureBulkLoadManager.SecureBulkLoadListener listener =
      new SecureBulkLoadManager.SecureBulkLoadListener(dfs, stagingDirPath.toString(), conf);

    // creating file to load
    String srcFile = createHFileForFamilies(FAMILY);
    Path srcPath = new Path(srcFile);
    Assert.assertTrue(dfs.exists(srcPath));

    Path stagedFamily = new Path(stagingDirPath, new Path(Bytes.toString(FAMILY)));
    if (!dfs.exists(stagedFamily)) {
      dfs.mkdirs(stagedFamily);
    }

    // moving file to staging
    String stagedFile = listener.prepareBulkLoad(FAMILY, srcFile, false, null);
    Path stagedPath = new Path(stagedFile);
    Assert.assertTrue(dfs.exists(stagedPath));
    Assert.assertFalse(dfs.exists(srcPath));

    dfs.delete(stagedPath, false);

    // moving files back to original location after a failed bulkload
    listener.failedBulkLoad(FAMILY, stagedFile);
  }
Tests for failedBulkLoad logic to make sure staged files are returned to their original location
if the bulkload have failed.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSecureBulkloadListener.java