// we can't use the mapper (since we have no way of manually setting
// the Context.workingPath() )
Map<Text, List<VertexWritable>> data = buildMapData(affinity, sensitivity, this.sensitivity);
// now, set up the combiner
EigencutsAffinityCutsCombiner combiner = new EigencutsAffinityCutsCombiner();
DummyRecordWriter<Text, VertexWritable> redWriter =
new DummyRecordWriter<Text, VertexWritable>();
Reducer<Text, VertexWritable, Text, VertexWritable>.Context
redContext = DummyRecordWriter.build(combiner, conf, redWriter, Text.class,
VertexWritable.class);
// perform the combining
for (Map.Entry<Text, List<VertexWritable>> entry : data.entrySet()) {
combiner.reduce(entry.getKey(), entry.getValue(), redContext);
}
// test the number of cuts, there should be 2
assertEquals("Number of cuts detected", 4,
redContext.getCounter(EigencutsAffinityCutsJob.CUTSCOUNTER.NUM_CUTS).getValue());