CopyOutputFormat extends TextOutputFormat<K, V> { public static void setWorkingDirectory(Job job, Path workingDirectory) { job.getConfiguration().set(DistCpConstants.CONF_LABEL_TARGET_WORK_PATH, workingDirectory.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 testSetWorkingDirectory() { try { Job job = new Job(new Configuration()); Assert.assertEquals(null, CopyOutputFormat.getWorkingDirectory(job)); job.getConfiguration().set(DistCpConstants.CONF_LABEL_TARGET_WORK_PATH, ""); Assert.assertEquals(null, CopyOutputFormat.getWorkingDirectory(job)); Path directory = new Path("/tmp/test"); CopyOutputFormat.setWorkingDirectory(job, directory); Assert.assertEquals(directory, CopyOutputFormat.getWorkingDirectory(job)); Assert.assertEquals(directory.toString(), job.getConfiguration(). get(DistCpConstants.CONF_LABEL_TARGET_WORK_PATH)); } catch (IOException e) { LOG.error("Exception encountered while running test", e); Assert.fail("Failed while testing for set Working Directory"); } }
@Test public void testSetWorkingDirectory() { try { Job job = Job.getInstance(new Configuration()); Assert.assertEquals(null, CopyOutputFormat.getWorkingDirectory(job)); job.getConfiguration().set(DistCpConstants.CONF_LABEL_TARGET_WORK_PATH, ""); Assert.assertEquals(null, CopyOutputFormat.getWorkingDirectory(job)); Path directory = new Path("/tmp/test"); CopyOutputFormat.setWorkingDirectory(job, directory); Assert.assertEquals(directory, CopyOutputFormat.getWorkingDirectory(job)); Assert.assertEquals(directory.toString(), job.getConfiguration(). get(DistCpConstants.CONF_LABEL_TARGET_WORK_PATH)); } catch (IOException e) { LOG.error("Exception encountered while running test", e); Assert.fail("Failed while testing for set Working Directory"); } }