@Before public void setUp() { AudioQASettings.MAPPER_OUTPUT_DIR = "output/MigrateMp3ToWav/"; MigrationMapper mapper = new MigrationMapper(); MigrateMp3ToWav.MigrationReducer reducer = new MigrateMp3ToWav.MigrationReducer(); mapDriver = new MapDriver<LongWritable, Text, LongWritable, Text>(); mapDriver.setMapper(mapper); reduceDriver = new ReduceDriver<LongWritable, Text, LongWritable, Text>(); reduceDriver.setReducer(reducer); mapReduceDriver = new MapReduceDriver<LongWritable, Text, LongWritable, Text, LongWritable, Text>(); mapReduceDriver.setMapper(mapper); mapReduceDriver.setReducer(reducer); }
public static void verifyReducer(SmartReducer reducer, Object key, Object... values) throws Exception { List list = new ArrayList(); for (Object value : values) { list.add(createWritable(value, reducer.getValueInType())); } ReduceDriver reduceDriver = new ReduceDriver<Text, LongWritable, Text, LongWritable>(); reduceDriver.withInput(createWritable(key, reducer.getKeyInType()), list); reduceDriver.setReducer(reducer); List results = reduceDriver.run(); Collections.sort(results, PairComparer.INSTANCE); String header = String.format( "(%s, %s)\r\n\r\n -> reduces via %s to -> \r\n", key, list, reducer.getClass().getSimpleName()); Approvals.verifyAll(header, results, Echo.INSTANCE); }