incubator-mrunit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject svn commit: r1178100 - in /incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit: MapDriverBase.java MapReduceDriverBase.java PipelineMapReduceDriver.java ReduceDriverBase.java TestDriver.java
Date Sat, 01 Oct 2011 22:31:01 GMT
Author: mattmann
Date: Sat Oct  1 22:31:00 2011
New Revision: 1178100

URL: http://svn.apache.org/viewvc?rev=1178100&view=rev
Log:
Apply patch for MRUNIT-15 from Brock Noland.

Modified:
    incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java
    incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
    incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java
    incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java
    incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java?rev=1178100&r1=1178099&r2=1178100&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java Sat Oct
 1 22:31:00 2011
@@ -185,9 +185,9 @@ public abstract class MapDriverBase<K1, 
       outputs = run();
       validate(outputs);
     } catch (IOException ioe) {
-      LOG.error("IOException in mapper: " + ioe.toString());
+      LOG.error("IOException in mapper", ioe);
       LOG.debug("Setting success to false based on IOException");
-      throw new RuntimeException();
+      throw new RuntimeException("IOException in mapper: ", ioe);
     }
   }
 }

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java?rev=1178100&r1=1178099&r2=1178100&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
(original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
Sat Oct  1 22:31:00 2011
@@ -166,9 +166,8 @@ public abstract class MapReduceDriverBas
       reduceOutputs = run();
       validate(reduceOutputs);
     } catch (IOException ioe) {
-      LOG.error("IOException: " + ioe.toString());
-      LOG.debug("Setting success to false based on IOException");
-      throw new RuntimeException();
+      LOG.error(ioe);
+      throw new RuntimeException(ioe);
     }
   }
 

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java?rev=1178100&r1=1178099&r2=1178100&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java
(original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java
Sat Oct  1 22:31:00 2011
@@ -332,9 +332,8 @@ public class PipelineMapReduceDriver<K1,
       outputs = run();
       validate(outputs);
     } catch (IOException ioe) {
-      LOG.error("IOException: " + ioe.toString());
-      LOG.debug("Setting success to false based on IOException");
-      throw new RuntimeException();
+      LOG.error(ioe);
+      throw new RuntimeException(ioe);
     }
   }
 }

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java?rev=1178100&r1=1178099&r2=1178100&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java Sat
Oct  1 22:31:00 2011
@@ -186,9 +186,8 @@ public abstract class ReduceDriverBase<K
       outputs = run();
       validate(outputs);
     } catch (IOException ioe) {
-      LOG.error("IOException in reducer: " + ioe.toString());
-      LOG.debug("Setting success to false based on IOException");
-      throw new RuntimeException();
+      LOG.error("IOException in reducer", ioe);
+      throw new RuntimeException("IOException in reducer: ", ioe);
     }
   }
 }

Modified: incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
URL: http://svn.apache.org/viewvc/incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java?rev=1178100&r1=1178099&r2=1178100&view=diff
==============================================================================
--- incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java (original)
+++ incubator/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java Sat Oct
 1 22:31:00 2011
@@ -133,11 +133,13 @@ public abstract class TestDriver<K1, V1,
   protected void validate(List<Pair<K2, V2>> outputs) throws RuntimeException
{
 
     boolean success = true;
-
+    List<String> errors = new ArrayList<String>();
     // were we supposed to get output in the first place?
     // return false if we don't.
     if (expectedOutputs.size() == 0 && outputs.size() > 0) {
-      LOG.error("Expected no outputs; got " + outputs.size() + " outputs.");
+      String msg = "Expected no outputs; got " + outputs.size() + " outputs.";
+      LOG.error(msg);
+      errors.add(msg);
       success = false;
     }
 
@@ -174,9 +176,11 @@ public abstract class TestDriver<K1, V1,
           if (null != expected) {
             expectedStr = expected.toString();
           }
-
-          LOG.error("Missing expected output " + expectedStr + " at position "
-              + i);
+          
+          String msg = "Missing expected output " + expectedStr + " at position "
+              + i + ".";
+          LOG.error(msg);
+          errors.add(msg);
         }
       }
 
@@ -184,7 +188,10 @@ public abstract class TestDriver<K1, V1,
     }
 
     if (!success) {
-      throw new RuntimeException();
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(errors.size()).append(" Error(s): ");
+      formatValueList(errors, buffer);
+      throw new RuntimeException(buffer.toString());
     }
   }
 



Mime
View raw message