@Test
public void testAtomicCommitMissingFinal() throws IOException {

  TaskAttemptContext taskAttemptContext = getTaskAttemptContext(config);
  JobContext jobContext = new JobContextImpl(taskAttemptContext.getConfiguration(),
      taskAttemptContext.getTaskAttemptID().getJobID());
  Configuration conf = jobContext.getConfiguration();
  String workPath = "/tmp1/" + String.valueOf(rand.nextLong());
  String finalPath = "/tmp1/" + String.valueOf(rand.nextLong());
  FileSystem fs = null;
  try {
    OutputCommitter committer = new CopyCommitter(null, taskAttemptContext);
    fs = FileSystem.get(conf);
    fs.mkdirs(new Path(workPath));
    conf.set(CONF_LABEL_TARGET_WORK_PATH, workPath);
    conf.set(CONF_LABEL_TARGET_FINAL_PATH, finalPath);
    conf.setBoolean(DistCpConstants.CONF_LABEL_ATOMIC_COPY, true);
    assertPathExists(fs, "Work path", new Path(workPath));
    assertPathDoesNotExist(fs, "Final path", new Path(finalPath));
    committer.commitJob(jobContext);
    assertPathDoesNotExist(fs, "Work path", new Path(workPath));
    assertPathExists(fs, "Final path", new Path(finalPath));
    //Test for idempotent commit
    committer.commitJob(jobContext);
    assertPathDoesNotExist(fs, "Work path", new Path(workPath));
    assertPathExists(fs, "Final path", new Path(finalPath));
  } finally {
    TestDistCpUtils.delete(fs, workPath);
    TestDistCpUtils.delete(fs, finalPath);
    conf.setBoolean(DistCpConstants.CONF_LABEL_ATOMIC_COPY, false);
  }
}