PathOutputCommitterFactory extends Configured { public static PathOutputCommitter createCommitter(Path outputPath, TaskAttemptContext context) throws IOException { return getCommitterFactory(outputPath, context.getConfiguration()) .createOutputCommitter(outputPath, context); }  PathOutputCommitter createOutputCommitter(
      Path outputPath,
      TaskAttemptContext context); static PathOutputCommitterFactory getCommitterFactory(
      Path outputPath,
      Configuration conf); static PathOutputCommitter createCommitter(Path outputPath,
      TaskAttemptContext context); static final String COMMITTER_FACTORY_CLASS; static final String COMMITTER_FACTORY_SCHEME; static final String COMMITTER_FACTORY_SCHEME_PATTERN; static final String FILE_COMMITTER_FACTORY; static final String NAMED_COMMITTER_FACTORY; static final String NAMED_COMMITTER_CLASS; static final String COMMITTER_FACTORY_DEFAULT; }
@Test public void testCommitterFallbackDefault() throws Throwable { createCommitter(FileOutputCommitter.class, HDFS_PATH, taskAttempt(newBondedConfiguration())); }
@Test public void testCommitterNullOutputPath() throws Throwable { Configuration conf = newBondedConfiguration(); FileOutputCommitter committer = createCommitter( FileOutputCommitterFactory.class, FileOutputCommitter.class, null, conf); assertNull(committer.getOutputPath()); assertNull(committer.getWorkPath()); }
@Test public void testNamedCommitterFactory() throws Throwable { Configuration conf = new Configuration(); conf.set(COMMITTER_FACTORY_CLASS, NAMED_COMMITTER_FACTORY); conf.set(NAMED_COMMITTER_CLASS, SimpleCommitter.class.getName()); SimpleCommitter sc = createCommitter( NamedCommitterFactory.class, SimpleCommitter.class, HDFS_PATH, conf); assertEquals("Wrong output path from " + sc, HDFS_PATH, sc.getOutputPath()); }
@Test public void testNamedCommitterFactoryNullPath() throws Throwable { Configuration conf = new Configuration(); conf.set(COMMITTER_FACTORY_CLASS, NAMED_COMMITTER_FACTORY); conf.set(NAMED_COMMITTER_CLASS, SimpleCommitter.class.getName()); SimpleCommitter sc = createCommitter( NamedCommitterFactory.class, SimpleCommitter.class, null, conf); assertNull(sc.getOutputPath()); }
@Test public void testNamedCommitterNullPath() throws Throwable { Configuration conf = new Configuration(); conf.set(COMMITTER_FACTORY_CLASS, NAMED_COMMITTER_FACTORY); conf.set(NAMED_COMMITTER_CLASS, SimpleCommitter.class.getName()); SimpleCommitter sc = createCommitter( SimpleCommitter.class, null, taskAttempt(conf)); assertNull(sc.getOutputPath()); }