[ https://issues.apache.org/jira/browse/MRUNIT-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15225618#comment-15225618 ]
Ryan Chapin commented on MRUNIT-224: ------------------------------------ The only other thing that should probably go with this issue is an update to the pom to turn off doclint for JDK 8 Javadoc. I would imagine that everyone has migrated to Java 8 by now and without the following the build fails when generating the Javacoc. {code} diff --git a/pom.xml b/pom.xml index 7623e06..15dc2bc 100644 --- a/pom.xml +++ b/pom.xml @@ -247,6 +247,7 @@ <version>2.8.1</version> <configuration> <excludePackageNames>*.internal</excludePackageNames> + <additionalparam>-Xdoclint:none</additionalparam> </configuration> <executions> <execution> {code} > Custom Comparators are not used for results written to MultipleOutputs > ---------------------------------------------------------------------- > > Key: MRUNIT-224 > URL: https://issues.apache.org/jira/browse/MRUNIT-224 > Project: MRUnit > Issue Type: Bug > Affects Versions: 1.1.0 > Reporter: Dan Ziemba > Attachments: > 0001-MRUNIT-224-Key-and-Value-Comparators-not-effective-w.patch > > > TestDriver's setValueComparator method has no effect when testing for data > written to MultipleOutputs. setKeyComparator probably doesn't work either. > See the example unit test below: > {code:java} > package test; > import org.apache.hadoop.io.LongWritable; > import org.apache.hadoop.io.Text; > import org.apache.hadoop.mapreduce.Mapper; > import org.apache.hadoop.mapreduce.lib.output.MultipleOutputs; > import org.apache.hadoop.mrunit.mapreduce.MapDriver; > import org.junit.Test; > import org.junit.runner.RunWith; > import org.powermock.core.classloader.annotations.PrepareForTest; > import org.powermock.modules.junit4.PowerMockRunner; > import java.io.IOException; > import java.util.Comparator; > @RunWith(PowerMockRunner.class) > @PrepareForTest(MosComparatorTest.MosMapper.class) > public class MosComparatorTest { > private class NormalMapper extends Mapper<LongWritable, Text, > LongWritable, Text> { > @Override > protected void map(LongWritable key, Text value, Context context) > throws IOException, InterruptedException { > context.write(key, new Text("testValueOut")); > } > } > public class MosMapper extends Mapper<LongWritable, Text, LongWritable, > Text> { > private MultipleOutputs<LongWritable, Text> mos; > @Override > protected void setup(Context context) throws IOException, > InterruptedException { > mos = new MultipleOutputs<>(context); > } > @Override > protected void map(LongWritable key, Text value, Context context) > throws IOException, InterruptedException { > mos.write("testOut", key, new Text("testValueOut")); > } > @Override > protected void cleanup(Context context) throws IOException, > InterruptedException { > mos.close(); > } > } > @Test > public void testNormal() throws Exception { > MapDriver<LongWritable, Text, LongWritable, Text> driver = > MapDriver.newMapDriver(new NormalMapper()); > driver.withInput(new LongWritable(123), new Text("testValueIn")) > .withOutput(new LongWritable(123), new Text("testValueOut")) > .runTest(); > } > @Test > public void testNormalValueComparator() throws Exception { > MapDriver<LongWritable, Text, LongWritable, Text> driver = > MapDriver.newMapDriver(new NormalMapper()); > driver.setValueComparator(new Comparator<Text>() { > @Override > public int compare(Text o1, Text o2) { > // Everything matches > return 0; > } > }); > driver.withInput(new LongWritable(123), new Text("testValueIn")) > .withOutput(new LongWritable(123), new Text("this doesn't > matter")) > .runTest(); > } > @Test > public void testMos() throws Exception { > MapDriver<LongWritable, Text, LongWritable, Text> driver = > MapDriver.newMapDriver(new MosMapper()); > driver.withInput(new LongWritable(123), new Text("testValueIn")) > .withMultiOutput("testOut", new LongWritable(123), new > Text("testValueOut")) > .runTest(); > } > /** > * This test fails. It should pass because of the custom value > Comparator. > * <p/> > * <pre>java.lang.AssertionError: 1 Error(s): (Expected output (123, this > shouldn't matter) for namedOutput 'testOut' at position 0, but found (123, > testValueOut))</pre> > */ > @Test > public void testMosValueComparator() throws Exception { > MapDriver<LongWritable, Text, LongWritable, Text> driver = > MapDriver.newMapDriver(new MosMapper()); > driver.setValueComparator(new Comparator<Text>() { > @Override > public int compare(Text o1, Text o2) { > // Everything matches > return 0; > } > }); > driver.withInput(new LongWritable(123), new Text("testValueIn")) > .withMultiOutput("testOut", new LongWritable(123), new > Text("this shouldn't matter")) > .runTest(); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)