CopyOutputFormat extends TextOutputFormat<K, V> { @Override public OutputCommitter getOutputCommitter(TaskAttemptContext context) throws IOException { return new CopyCommitter(getOutputPath(context), context); }  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 testGetOutputCommitter() { try { TaskAttemptContext context = Mockito.mock(TaskAttemptContext.class); Mockito.when(context.getTaskAttemptID()).thenReturn(new TaskAttemptID ("200707121733", 1, false, 1, 1)); Configuration conf = new Configuration(); Mockito.when(context.getConfiguration()).thenReturn(conf); context.getConfiguration().set("mapred.output.dir", "/out"); Assert.assertTrue(new CopyOutputFormat().getOutputCommitter(context) instanceof CopyCommitter); } catch (IOException e) { LOG.error("Exception encountered ", e); Assert.fail("Unable to get output committer"); } }
@Test public void testGetOutputCommitter() { try { TaskAttemptContext context = new TaskAttemptContextImpl(new Configuration(), new TaskAttemptID("200707121733", 1, TaskType.MAP, 1, 1)); context.getConfiguration().set("mapred.output.dir", "/out"); Assert.assertTrue(new CopyOutputFormat().getOutputCommitter(context) instanceof CopyCommitter); } catch (IOException e) { LOG.error("Exception encountered ", e); Assert.fail("Unable to get output committer"); } }