Author: rvs
Date: Tue Oct  4 16:46:58 2011
New Revision: 1178860

URL: http://svn.apache.org/viewvc?rev=1178860&view=rev
Log:
Fixing hadoop examples

Modified:
    
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/flume/pom.xml
    
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/pom.xml
    
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoopexamples/TestHadoopExamples.groovy
    
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/oozie/pom.xml

Modified: 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/flume/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/flume/pom.xml?rev=1178860&r1=1178859&r2=1178860&view=diff
==============================================================================
--- 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/flume/pom.xml 
(original)
+++ 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/flume/pom.xml 
Tue Oct  4 16:46:58 2011
@@ -33,8 +33,8 @@
   <dependencies>
      <dependency>
       <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-core</artifactId>
-      <version>0.20.2</version>
+      <artifactId>hadoop-common</artifactId>
+      <version>0.22.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>

Modified: 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/pom.xml?rev=1178860&r1=1178859&r2=1178860&view=diff
==============================================================================
--- 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/pom.xml
 (original)
+++ 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/pom.xml
 Tue Oct  4 16:46:58 2011
@@ -33,13 +33,13 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-core</artifactId>
-      <version>0.20.2</version>
+      <artifactId>hadoop-common</artifactId>
+      <version>0.22.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-test</artifactId>
-      <version>0.20.2</version>
+      <artifactId>hadoop-common-test</artifactId>
+      <version>0.22.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 

Modified: 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoopexamples/TestHadoopExamples.groovy
URL: 
http://svn.apache.org/viewvc/incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoopexamples/TestHadoopExamples.groovy?rev=1178860&r1=1178859&r2=1178860&view=diff
==============================================================================
--- 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoopexamples/TestHadoopExamples.groovy
 (original)
+++ 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/hadoop/src/main/groovy/org/apache/bigtop/itest/hadoopexamples/TestHadoopExamples.groovy
 Tue Oct  4 16:46:58 2011
@@ -18,7 +18,7 @@
 
 package org.apache.bigtop.itest.hadoopexamples
 
-import org.junit.Before
+import org.junit.BeforeClass
 import static org.junit.Assert.assertNotNull
 import org.apache.bigtop.itest.shell.Shell
 import static org.junit.Assert.assertTrue
@@ -28,6 +28,11 @@ import org.apache.bigtop.itest.JarConten
 import org.apache.commons.logging.LogFactory
 import org.apache.commons.logging.Log
 
+import org.apache.bigtop.itest.junit.OrderedParameterized
+import org.junit.runners.Parameterized.Parameters
+import org.junit.runner.RunWith
+
+@RunWith(OrderedParameterized.class)
 class TestHadoopExamples {
   static private Log LOG = LogFactory.getLog(TestHadoopExamples.class);
 
@@ -35,15 +40,20 @@ class TestHadoopExamples {
   private static final String HADOOP_CONF_DIR = 
System.getenv('HADOOP_CONF_DIR');
   private static String hadoopExamplesJar =
     JarContent.getJarName(HADOOP_HOME, 'hadoop.*examples.*.jar');
+  private static String hadoopMapredTestJar =
+    JarContent.getJarName(HADOOP_HOME, 'hadoop.*mapred-test.*.jar');
   static {
     assertNotNull("HADOOP_HOME has to be set to run this test",
         HADOOP_HOME);
     assertNotNull("HADOOP_CONF_DIR has to be set to run this test",
         HADOOP_CONF_DIR);
     assertNotNull("Can't find hadoop-examples.jar file", hadoopExamplesJar);
+    assertNotNull("Can't find hadoop-mapred-test.jar file", 
hadoopMapredTestJar);
   }
   static final String HADOOP_EXAMPLES_JAR =
     HADOOP_HOME + "/" + hadoopExamplesJar;
+  static final String HADOOP_MR_TEST_JAR =
+    HADOOP_HOME + "/" + hadoopMapredTestJar;
   private static final String hadoop = "$HADOOP_HOME/bin/hadoop";
 
   static Shell sh = new Shell("/bin/bash -s");
@@ -52,7 +62,7 @@ class TestHadoopExamples {
   private static Configuration conf;
   private static String HADOOP_OPTIONS;
 
-  @Before
+  @BeforeClass
   void setUp() {
     conf = new Configuration();
     conf.addResource('mapred-site.xml');
@@ -80,9 +90,7 @@ class TestHadoopExamples {
     assertTrue("Could not create output directory", sh.getRet() == 0);
   }
 
-  def failures = [];
-
-  def examples =
+  static Map examples =
     [
         pi                :'20 10',
         wordcount         :"$EXAMPLES/text $EXAMPLES_OUT/wordcount",
@@ -95,15 +103,40 @@ class TestHadoopExamples {
         randomtextwriter  :"-Dtest.randomtextwrite.total_bytes=1073741824 
$EXAMPLES_OUT/randomtextwriter"
     ];
 
+  static Map jars =
+    [
+        pi                : HADOOP_EXAMPLES_JAR,
+        wordcount         : HADOOP_EXAMPLES_JAR,
+        multifilewc       : HADOOP_EXAMPLES_JAR,
+//        aggregatewordcount:"$EXAMPLES/text $EXAMPLES_OUT/aggregatewordcount 
5 textinputformat",
+//        aggregatewordhist :"$EXAMPLES/text $EXAMPLES_OUT/aggregatewordhist 5 
textinputformat",
+        grep              : HADOOP_EXAMPLES_JAR,
+        sleep             : HADOOP_MR_TEST_JAR,
+        secondarysort     : HADOOP_EXAMPLES_JAR,
+        randomtextwriter  : HADOOP_EXAMPLES_JAR,
+    ];
+
+ 
+  private String exampleName;
+
+  @Parameters
+  public static Map<String, Object[]> generateTests() {
+    Map<String, Object[]> res = [:];
+    examples.each { res[it] = it; }
+    return res;
+  }
+
+  public TestHadoopExamples(String example) {
+    exampleName = example;
+  }
+
   @Test
-  void testMRExamples() {
-    examples.each { testName, args ->
-      sh.exec("$hadoop jar $HADOOP_EXAMPLES_JAR $testName $HADOOP_OPTIONS 
$args");
-
-      if (sh.getRet()) {
-        failures.add(testName);
-      }
-    }
-    assertTrue("The following tests have failed: " + failures, failures.size() 
== 0);
+  void testMRExample() {
+    testJar = jars[exampleName];
+    testArgs = examples[exampleName];
+    sh.exec("$hadoop jar $testJar $exampleName $HADOOP_OPTIONS $testArgs");
+
+    assertTrue("Example $exampleName failed", 
+               sh.getRet() == 0);
   }
 }

Modified: 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/oozie/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/oozie/pom.xml?rev=1178860&r1=1178859&r2=1178860&view=diff
==============================================================================
--- 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/oozie/pom.xml 
(original)
+++ 
incubator/bigtop/branches/hadoop-0.22/bigtop-tests/test-artifacts/oozie/pom.xml 
Tue Oct  4 16:46:58 2011
@@ -33,8 +33,8 @@
   <dependencies>
      <dependency>
       <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-core</artifactId>
-      <version>0.20.2</version>
+      <artifactId>hadoop-common</artifactId>
+      <version>0.22.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>


Reply via email to