List of usage examples for org.apache.hadoop.mapreduce.lib.output MultipleOutputs close
@SuppressWarnings("unchecked") public void close() throws IOException, InterruptedException
From source file:be.uantwerpen.adrem.bigfim.AprioriPhaseReducerTest.java
License:Apache License
private MultipleOutputs<Text, Text> createMockMos(int minSup, Object[][] dataOnePrefix) throws IOException, InterruptedException { MultipleOutputs<Text, Text> mos = createMock(MultipleOutputs.class); for (Object[] prefixAndSupport : dataOnePrefix) { if ((Integer) prefixAndSupport[1] >= minSup) { addToOutput(mos, (String) prefixAndSupport[0], (Integer) prefixAndSupport[1]); }/* w ww . java 2 s .co m*/ } mos.close(); return mos; }
From source file:be.uantwerpen.adrem.bigfim.ComputeTidListReducerTest.java
License:Apache License
@Test public void One_PG_One_Item() throws Exception { MultipleOutputs<IntArrayWritable, IntMatrixWritable> mos = createMock(MultipleOutputs.class); mos.write(newIAW(1), EmptyImw, "pg/bucket-0"); mos.write(newIAW(0), new IntMatrixWritable(newIAW(0, 1, 2, 4, 7, 9), newIAW(0, 1, 2, 3, 5, 6, 8)), "pg/bucket-0"); mos.write(EmptyIaw, EmptyImw, "pg/bucket-0"); mos.close(); Reducer.Context ctx = createMock(Reducer.Context.class); EasyMock.expect(ctx.getConfiguration()).andReturn(createConfiguration()).anyTimes(); EasyMock.expect(ctx.getTaskAttemptID()).andReturn(new TaskAttemptID()).anyTimes(); EasyMock.replay(ctx, mos);//w w w.j av a 2s. c o m ComputeTidListReducer reducer = new ComputeTidListReducer(); reducer.setup(ctx); setField(reducer, "mos", mos); reducer.reduce(new Text("1"), createTestInput_1Item(), ctx); reducer.cleanup(ctx); EasyMock.verify(mos); }
From source file:be.uantwerpen.adrem.bigfim.ComputeTidListReducerTest.java
License:Apache License
@Test public void One_PG_N_Items() throws Exception { MultipleOutputs<IntArrayWritable, IntMatrixWritable> mos = createMock(MultipleOutputs.class); mos.write(newIAW(1), EmptyImw, "pg/bucket-0"); mos.write(newIAW(0), new IntMatrixWritable(newIAW(0, 1, 2, 4, 7, 9), newIAW(0, 1, 2, 3, 5, 6, 8)), "pg/bucket-0"); mos.write(newIAW(1), new IntMatrixWritable(newIAW(1, 2, 3), newIAW(4, 5, 6)), "pg/bucket-0"); mos.write(newIAW(3), new IntMatrixWritable(newIAW(4, 7, 9), newIAW(4, 7, 9)), "pg/bucket-0"); mos.write(EmptyIaw, EmptyImw, "pg/bucket-0"); mos.close(); Reducer.Context ctx = createMock(Reducer.Context.class); EasyMock.expect(ctx.getConfiguration()).andReturn(createConfiguration()).anyTimes(); EasyMock.expect(ctx.getTaskAttemptID()).andReturn(new TaskAttemptID()).anyTimes(); EasyMock.replay(ctx, mos);/*from w w w . j a v a2 s. c om*/ ComputeTidListReducer reducer = new ComputeTidListReducer(); reducer.setup(ctx); setField(reducer, "mos", mos); reducer.reduce(new Text("1"), createTestInput_NItems(), ctx); reducer.cleanup(ctx); EasyMock.verify(mos); }
From source file:be.uantwerpen.adrem.bigfim.ComputeTidListReducerTest.java
License:Apache License
@Test public void N_PG_N_Items() throws Exception { MultipleOutputs<IntArrayWritable, IntMatrixWritable> mos = createMock(MultipleOutputs.class); mos.write(newIAW(1), EmptyImw, "pg/bucket-0"); mos.write(newIAW(0), new IntMatrixWritable(newIAW(0, 1, 2, 4, 7, 9), newIAW(0, 1, 2, 3, 5, 6, 8)), "pg/bucket-0"); mos.write(newIAW(1), new IntMatrixWritable(newIAW(1, 2, 3), newIAW(4, 5, 6)), "pg/bucket-0"); mos.write(newIAW(3), new IntMatrixWritable(newIAW(4, 7, 9), newIAW(4, 7, 9)), "pg/bucket-0"); mos.write(EmptyIaw, EmptyImw, "pg/bucket-0"); mos.write(newIAW(2), EmptyImw, "pg/bucket-1"); mos.write(newIAW(1), new IntMatrixWritable(newIAW(1, 4, 7, 8), newIAW(1, 5, 6, 8)), "pg/bucket-1"); mos.write(newIAW(2), new IntMatrixWritable(newIAW(3, 5, 7), newIAW(1, 2, 3, 4, 5, 6, 7, 8, 9)), "pg/bucket-1"); mos.write(EmptyIaw, EmptyImw, "pg/bucket-1"); mos.close(); Reducer.Context ctx = createMock(Reducer.Context.class); EasyMock.expect(ctx.getConfiguration()).andReturn(createConfiguration()).anyTimes(); EasyMock.expect(ctx.getTaskAttemptID()).andReturn(new TaskAttemptID()).anyTimes(); EasyMock.replay(ctx, mos);/*from w ww . j a va 2s. c om*/ ComputeTidListReducer reducer = new ComputeTidListReducer(); reducer.setup(ctx); setField(reducer, "mos", mos); reducer.reduce(new Text("1"), createTestInput_NItems(), ctx); reducer.reduce(new Text("2"), createTestInput_NItems2(), ctx); reducer.cleanup(ctx); EasyMock.verify(mos); }