CopyOutputFormat extends TextOutputFormat<K, V> { public static void setCommitDirectory(Job job, Path commitDirectory) { job.getConfiguration().set(DistCpConstants.CONF_LABEL_TARGET_FINAL_PATH, commitDirectory.toString()); }  static void setWorkingDirectory(Job job, Path workingDirectory); static void setCommitDirectory(Job job, Path commitDirectory); static Path getWorkingDirectory(Job job); static Path getCommitDirectory(Job job); @Override OutputCommitter getOutputCommitter(TaskAttemptContext context); @Override void checkOutputSpecs(JobContext context);  }
@Test public void testSetCommitDirectory() { try { Job job = new Job(new Configuration()); Assert.assertEquals(null, CopyOutputFormat.getCommitDirectory(job)); job.getConfiguration().set(DistCpConstants.CONF_LABEL_TARGET_FINAL_PATH, ""); Assert.assertEquals(null, CopyOutputFormat.getCommitDirectory(job)); Path directory = new Path("/tmp/test"); CopyOutputFormat.setCommitDirectory(job, directory); Assert.assertEquals(directory, CopyOutputFormat.getCommitDirectory(job)); Assert.assertEquals(directory.toString(), job.getConfiguration(). get(DistCpConstants.CONF_LABEL_TARGET_FINAL_PATH)); } catch (IOException e) { LOG.error("Exception encountered while running test", e); Assert.fail("Failed while testing for set Commit Directory"); } }
@Test public void testSetCommitDirectory() { try { Job job = Job.getInstance(new Configuration()); Assert.assertEquals(null, CopyOutputFormat.getCommitDirectory(job)); job.getConfiguration().set(DistCpConstants.CONF_LABEL_TARGET_FINAL_PATH, ""); Assert.assertEquals(null, CopyOutputFormat.getCommitDirectory(job)); Path directory = new Path("/tmp/test"); CopyOutputFormat.setCommitDirectory(job, directory); Assert.assertEquals(directory, CopyOutputFormat.getCommitDirectory(job)); Assert.assertEquals(directory.toString(), job.getConfiguration(). get(DistCpConstants.CONF_LABEL_TARGET_FINAL_PATH)); } catch (IOException e) { LOG.error("Exception encountered while running test", e); Assert.fail("Failed while testing for set Commit Directory"); } }