DynamicInputFormat extends InputFormat<K, V> { public DynamicInputChunkContext<K, V> getChunkContext( Configuration configuration) throws IOException { if(chunkContext == null) { chunkContext = new DynamicInputChunkContext<K, V>(configuration); } return chunkContext; }  @Override List<InputSplit> getSplits(JobContext jobContext); DynamicInputChunkContext<K, V> getChunkContext(
      Configuration configuration); @Override RecordReader<K, V> createRecordReader(
          InputSplit inputSplit,
          TaskAttemptContext taskAttemptContext);  }
@Test public void testDynamicInputChunkContext() throws IOException { Configuration configuration = new Configuration(); configuration.set(DistCpConstants.CONF_LABEL_LISTING_FILE_PATH, "/tmp/test/file1.seq"); DynamicInputFormat firstInputFormat = new DynamicInputFormat(); DynamicInputFormat secondInputFormat = new DynamicInputFormat(); DynamicInputChunkContext firstContext = firstInputFormat.getChunkContext(configuration); DynamicInputChunkContext secondContext = firstInputFormat.getChunkContext(configuration); DynamicInputChunkContext thirdContext = secondInputFormat.getChunkContext(configuration); DynamicInputChunkContext fourthContext = secondInputFormat.getChunkContext(configuration); Assert.assertTrue("Chunk contexts from the same DynamicInputFormat " + "object should be the same.",firstContext.equals(secondContext)); Assert.assertTrue("Chunk contexts from the same DynamicInputFormat " + "object should be the same.",thirdContext.equals(fourthContext)); Assert.assertTrue("Contexts from different DynamicInputFormat " + "objects should be different.",!firstContext.equals(thirdContext)); }