Я написал работу Hadoop только для карты, в которой я использовал концепцию MultipleOutputs. Проблема в том, что я хочу протестировать этот код с помощью MRUnit. Я не вижу рабочего примера для тестирования MultipleOutputs.
Мой код картографа будет выглядеть так:
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
String inputString = value.toString();
String outputString = null;
Text resultValue = null;
String finalResult = null;
String exceptionMessage = null;
try {
outputString = processInput(dataSet, inputString);
} catch (MalformedURLException me) {
System.out.println("MalformedURLException Occurred in Mapper:"
+ me.getMessage());
exceptionMessage = me.getMessage();
} catch (SolrServerException se) {
System.out.println("SolrServerException Occurred in Mapper:"
+ se.getMessage());
exceptionMessage = se.getMessage();
}
if (outputString == null || outputString.isEmpty()
&& exceptionMessage != null) {
exceptionMessage = exceptionMessage.replaceAll("\n", ", ");
finalResult = inputString + "\t[Error] =" + exceptionMessage;
resultValue = new Text(finalResult);
multipleOutputs.write(SearchConstants.FAILURE_FILE,NullWritable.get(), resultValue);
} else {
finalResult = inputString + outputString;
resultValue = new Text(finalResult);
multipleOutputs.write(SearchConstants.SUCCESS_FILE,NullWritable.get(), resultValue);
}
}
Может ли кто-нибудь из вас, ребята, дать мне рабочий пример теста MRUnit с MultipleOutputs?