accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject accumulo git commit: ACCUMULO-3871 Roll mrit module into test
Date Wed, 17 Jun 2015 22:11:04 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master c268fc64b -> 9026ff808


ACCUMULO-3871 Roll mrit module into test

* Makes the mrit module an optional shaded artifact for the test module
* Doesn't build mrit by default (activate with -Dmrit or -Pmrit)
* Deletes the mrit module
* Minor pom cleanup


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/9026ff80
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/9026ff80
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/9026ff80

Branch: refs/heads/master
Commit: 9026ff8082b3b954b6323c769bfc9f8a05a845a4
Parents: c268fc6
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Wed Jun 17 18:09:21 2015 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Wed Jun 17 18:09:21 2015 -0400

----------------------------------------------------------------------
 assemble/pom.xml                                |  16 ++
 core/.gitignore                                 |   2 -
 minicluster/.gitignore                          |   1 -
 mrit/.gitignore                                 |  25 ----
 mrit/pom.xml                                    |  92 ------------
 mrit/src/main/findbugs/exclude-filter.xml       |  18 ---
 .../accumulo/mrit/IntegrationTestMapReduce.java | 147 -------------------
 pom.xml                                         |  25 ++--
 proxy/.gitignore                                |   1 -
 test/pom.xml                                    |  57 +++++++
 .../test/mrit/IntegrationTestMapReduce.java     | 147 +++++++++++++++++++
 11 files changed, 235 insertions(+), 296 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/assemble/pom.xml
----------------------------------------------------------------------
diff --git a/assemble/pom.xml b/assemble/pom.xml
index b965fe6..dfb46d7 100644
--- a/assemble/pom.xml
+++ b/assemble/pom.xml
@@ -324,5 +324,21 @@
         </dependency>
       </dependencies>
     </profile>
+    <profile>
+      <!-- create shaded test jar appropriate for running ITs on MapReduce -->
+      <id>mrit</id>
+      <activation>
+        <property>
+          <name>mrit</name>
+        </property>
+      </activation>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.accumulo</groupId>
+          <artifactId>accumulo-test</artifactId>
+          <classifier>mrit</classifier>
+        </dependency>
+      </dependencies>
+    </profile>
   </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/core/.gitignore
----------------------------------------------------------------------
diff --git a/core/.gitignore b/core/.gitignore
index 8847bdd..56204d2 100644
--- a/core/.gitignore
+++ b/core/.gitignore
@@ -23,5 +23,3 @@
 /.pydevproject
 /.idea
 /*.iml
-/target/
-/bin/

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/minicluster/.gitignore
----------------------------------------------------------------------
diff --git a/minicluster/.gitignore b/minicluster/.gitignore
index e7d7fb1..56204d2 100644
--- a/minicluster/.gitignore
+++ b/minicluster/.gitignore
@@ -23,4 +23,3 @@
 /.pydevproject
 /.idea
 /*.iml
-/target/

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/mrit/.gitignore
----------------------------------------------------------------------
diff --git a/mrit/.gitignore b/mrit/.gitignore
deleted file mode 100644
index 56204d2..0000000
--- a/mrit/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Maven ignores
-/target/
-
-# IDE ignores
-/.settings/
-/.project
-/.classpath
-/.pydevproject
-/.idea
-/*.iml

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/mrit/pom.xml
----------------------------------------------------------------------
diff --git a/mrit/pom.xml b/mrit/pom.xml
deleted file mode 100644
index 8bc50f4..0000000
--- a/mrit/pom.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.accumulo</groupId>
-    <artifactId>accumulo-project</artifactId>
-    <version>1.8.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>accumulo-mrit</artifactId>
-  <name>MapReduce Integration Test Runner</name>
-  <description>Run Integration Tests Using Map-Reduce</description>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-test</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.accumulo</groupId>
-          <artifactId>accumulo-native</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.slf4j</groupId>
-          <artifactId>slf4j-log4j12</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.servlet</groupId>
-          <artifactId>servlet-api</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <configuration>
-          <archive>
-            <manifestEntries>
-              <Sealed>false</Sealed>
-            </manifestEntries>
-          </archive>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <configuration>
-          <createDependencyReducedPom>false</createDependencyReducedPom>
-          <filters>
-            <filter>
-              <artifact>*:*</artifact>
-              <excludes>
-                <exclude>META-INF/*.SF</exclude>
-                <exclude>META-INF/*.DSA</exclude>
-                <exclude>META-INF/*.RSA</exclude>
-              </excludes>
-            </filter>
-          </filters>
-          <artifactSet>
-            <excludes>
-              <exclude>org.easymock:*</exclude>
-            </excludes>
-          </artifactSet>
-        </configuration>
-        <executions>
-          <execution>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/mrit/src/main/findbugs/exclude-filter.xml
----------------------------------------------------------------------
diff --git a/mrit/src/main/findbugs/exclude-filter.xml b/mrit/src/main/findbugs/exclude-filter.xml
deleted file mode 100644
index c801230..0000000
--- a/mrit/src/main/findbugs/exclude-filter.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<FindBugsFilter>
-</FindBugsFilter>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/mrit/src/main/java/org/apache/accumulo/mrit/IntegrationTestMapReduce.java
----------------------------------------------------------------------
diff --git a/mrit/src/main/java/org/apache/accumulo/mrit/IntegrationTestMapReduce.java b/mrit/src/main/java/org/apache/accumulo/mrit/IntegrationTestMapReduce.java
deleted file mode 100644
index beeb2cf..0000000
--- a/mrit/src/main/java/org/apache/accumulo/mrit/IntegrationTestMapReduce.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.mrit;
-
-import java.io.IOException;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.IntWritable;
-import org.apache.hadoop.io.LongWritable;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.mapreduce.Job;
-import org.apache.hadoop.mapreduce.Mapper;
-import org.apache.hadoop.mapreduce.Reducer;
-import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
-import org.apache.hadoop.mapreduce.lib.input.NLineInputFormat;
-import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
-import org.apache.hadoop.util.Tool;
-import org.apache.hadoop.util.ToolRunner;
-import org.junit.runner.Description;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class IntegrationTestMapReduce extends Configured implements Tool {
-
-  private static final Logger log = LoggerFactory.getLogger(IntegrationTestMapReduce.class);
-
-  public static class TestMapper extends Mapper<LongWritable,Text,IntWritable,Text>
{
-
-    @Override
-    protected void map(LongWritable key, Text value, final Mapper<LongWritable,Text,IntWritable,Text>.Context
context) throws IOException, InterruptedException {
-      String className = value.toString();
-      if (className.trim().isEmpty()) {
-        return;
-      }
-      log.info("Running test {}", className);
-      Class<? extends Object> test = null;
-      try {
-        test = Class.forName(className);
-      } catch (ClassNotFoundException e) {
-        log.debug("Error finding class {}", className, e);
-        context.write(new IntWritable(-1), new Text(e.toString()));
-        return;
-      }
-      JUnitCore core = new JUnitCore();
-      core.addListener(new RunListener() {
-
-        @Override
-        public void testStarted(Description description) throws Exception {
-          log.info("Starting {}", description);
-          context.progress();
-        }
-
-        @Override
-        public void testFinished(Description description) throws Exception {
-          log.info("Finished {}", description);
-          context.progress();
-        }
-
-        @Override
-        public void testFailure(Failure failure) throws Exception {
-          log.info("Test failed: {}", failure.getDescription(), failure.getException());
-          context.progress();
-        }
-
-      });
-      context.setStatus(test.getSimpleName());
-      try {
-        Result result = core.run(test);
-        if (result.wasSuccessful()) {
-          log.info("{} was successful", className);
-          context.write(new IntWritable(0), value);
-        } else {
-          log.info("{} failed", className);
-          context.write(new IntWritable(1), value);
-        }
-      } catch (Exception e) {
-        // most likely JUnit issues, like no tests to run
-        log.info("Test failed: {}", className, e);
-      }
-    }
-  }
-
-  public static class TestReducer extends Reducer<IntWritable,Text,IntWritable,Text>
{
-
-    @Override
-    protected void reduce(IntWritable code, Iterable<Text> tests, Reducer<IntWritable,Text,IntWritable,Text>.Context
context) throws IOException,
-        InterruptedException {
-      StringBuffer result = new StringBuffer();
-      for (Text test : tests) {
-        result.append(test);
-        result.append("\n");
-      }
-      context.write(code, new Text(result.toString()));
-    }
-  }
-
-  @Override
-  public int run(String[] args) throws Exception {
-    // read a list of tests from the input, and print out the results
-    if (args.length != 2) {
-      System.err.println("Wrong number of args: <input> <output>");
-    }
-    Configuration conf = getConf();
-    Job job = Job.getInstance(conf, "accumulo integration test runner");
-    // read one line at a time
-    job.setInputFormatClass(NLineInputFormat.class);
-    conf.setInt(NLineInputFormat.LINES_PER_MAP, 1);
-
-    // run the test
-    job.setJarByClass(IntegrationTestMapReduce.class);
-    job.setMapperClass(TestMapper.class);
-
-    // group test by result code
-    job.setReducerClass(TestReducer.class);
-    job.setOutputKeyClass(IntWritable.class);
-    job.setOutputValueClass(Text.class);
-
-    FileInputFormat.addInputPath(job, new Path(args[0]));
-    FileOutputFormat.setOutputPath(job, new Path(args[1]));
-    return job.waitForCompletion(true) ? 0 : 1;
-  }
-
-  public static void main(String[] args) throws Exception {
-    System.exit(ToolRunner.run(new IntegrationTestMapReduce(), args));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8b89c7b..a308068 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,19 +72,14 @@
     <maven>${maven.min-version}</maven>
   </prerequisites>
   <modules>
-    <module>trace</module>
-    <module>core</module>
-    <module>shell</module>
-    <module>fate</module>
-    <module>start</module>
-    <module>examples/simple</module>
     <module>assemble</module>
-    <module>proxy</module>
-    <module>test</module>
-    <module>mrit</module>
-    <module>minicluster</module>
+    <module>core</module>
     <module>docs</module>
+    <module>examples/simple</module>
+    <module>fate</module>
     <module>maven-plugin</module>
+    <module>minicluster</module>
+    <module>proxy</module>
     <module>server/base</module>
     <module>server/gc</module>
     <module>server/master</module>
@@ -92,6 +87,10 @@
     <module>server/native</module>
     <module>server/tracer</module>
     <module>server/tserver</module>
+    <module>shell</module>
+    <module>start</module>
+    <module>test</module>
+    <module>trace</module>
   </modules>
   <scm>
     <connection>scm:git:git://git.apache.org/accumulo.git</connection>
@@ -320,6 +319,12 @@
         <groupId>org.apache.accumulo</groupId>
         <artifactId>accumulo-test</artifactId>
         <version>${project.version}</version>
+        <classifier>mrit</classifier>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.accumulo</groupId>
+        <artifactId>accumulo-test</artifactId>
+        <version>${project.version}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.accumulo</groupId>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/proxy/.gitignore
----------------------------------------------------------------------
diff --git a/proxy/.gitignore b/proxy/.gitignore
index 98fdcca..5def651 100644
--- a/proxy/.gitignore
+++ b/proxy/.gitignore
@@ -26,4 +26,3 @@
 
 # python ignores
 *.pyc
-/bin/

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/test/pom.xml
----------------------------------------------------------------------
diff --git a/test/pom.xml b/test/pom.xml
index 57cfbbd..980c173 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -322,5 +322,62 @@
         </dependency>
       </dependencies>
     </profile>
+    <profile>
+      <!-- create shaded test jar appropriate for running ITs on MapReduce -->
+      <id>mrit</id>
+      <activation>
+        <property>
+          <name>mrit</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-shade-plugin</artifactId>
+            <configuration>
+              <artifactSet>
+                <excludes>
+                  <exclude>com.google.auto.service</exclude>
+                  <exclude>com.google.auto</exclude>
+                  <exclude>javax.servlet:servlet-api</exclude>
+                  <exclude>org.apache.accumulo:accumulo-native</exclude>
+                  <exclude>org.easymock</exclude>
+                  <exclude>org.slf4j:slf4j-log4j12</exclude>
+                </excludes>
+              </artifactSet>
+              <shadedArtifactAttached>true</shadedArtifactAttached>
+              <shadedClassifierName>mrit</shadedClassifierName>
+              <createDependencyReducedPom>false</createDependencyReducedPom>
+              <filters>
+                <filter>
+                  <artifact>*:*</artifact>
+                  <excludes>
+                    <exclude>META-INF/*.DSA</exclude>
+                    <exclude>META-INF/*.RSA</exclude>
+                    <exclude>META-INF/*.SF</exclude>
+                    <exclude>META-INF/DEPENDENCIES</exclude>
+                  </excludes>
+                </filter>
+              </filters>
+              <transformers>
+                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                  <manifestEntries>
+                    <Sealed>false</Sealed>
+                  </manifestEntries>
+                </transformer>
+              </transformers>
+            </configuration>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>shade</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9026ff80/test/src/main/java/org/apache/accumulo/test/mrit/IntegrationTestMapReduce.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/mrit/IntegrationTestMapReduce.java
b/test/src/main/java/org/apache/accumulo/test/mrit/IntegrationTestMapReduce.java
new file mode 100644
index 0000000..dcc25ea
--- /dev/null
+++ b/test/src/main/java/org/apache/accumulo/test/mrit/IntegrationTestMapReduce.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.mrit;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapreduce.Job;
+import org.apache.hadoop.mapreduce.Mapper;
+import org.apache.hadoop.mapreduce.Reducer;
+import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
+import org.apache.hadoop.mapreduce.lib.input.NLineInputFormat;
+import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
+import org.apache.hadoop.util.Tool;
+import org.apache.hadoop.util.ToolRunner;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class IntegrationTestMapReduce extends Configured implements Tool {
+
+  private static final Logger log = LoggerFactory.getLogger(IntegrationTestMapReduce.class);
+
+  public static class TestMapper extends Mapper<LongWritable,Text,IntWritable,Text>
{
+
+    @Override
+    protected void map(LongWritable key, Text value, final Mapper<LongWritable,Text,IntWritable,Text>.Context
context) throws IOException, InterruptedException {
+      String className = value.toString();
+      if (className.trim().isEmpty()) {
+        return;
+      }
+      log.info("Running test {}", className);
+      Class<? extends Object> test = null;
+      try {
+        test = Class.forName(className);
+      } catch (ClassNotFoundException e) {
+        log.debug("Error finding class {}", className, e);
+        context.write(new IntWritable(-1), new Text(e.toString()));
+        return;
+      }
+      JUnitCore core = new JUnitCore();
+      core.addListener(new RunListener() {
+
+        @Override
+        public void testStarted(Description description) throws Exception {
+          log.info("Starting {}", description);
+          context.progress();
+        }
+
+        @Override
+        public void testFinished(Description description) throws Exception {
+          log.info("Finished {}", description);
+          context.progress();
+        }
+
+        @Override
+        public void testFailure(Failure failure) throws Exception {
+          log.info("Test failed: {}", failure.getDescription(), failure.getException());
+          context.progress();
+        }
+
+      });
+      context.setStatus(test.getSimpleName());
+      try {
+        Result result = core.run(test);
+        if (result.wasSuccessful()) {
+          log.info("{} was successful", className);
+          context.write(new IntWritable(0), value);
+        } else {
+          log.info("{} failed", className);
+          context.write(new IntWritable(1), value);
+        }
+      } catch (Exception e) {
+        // most likely JUnit issues, like no tests to run
+        log.info("Test failed: {}", className, e);
+      }
+    }
+  }
+
+  public static class TestReducer extends Reducer<IntWritable,Text,IntWritable,Text>
{
+
+    @Override
+    protected void reduce(IntWritable code, Iterable<Text> tests, Reducer<IntWritable,Text,IntWritable,Text>.Context
context) throws IOException,
+        InterruptedException {
+      StringBuffer result = new StringBuffer();
+      for (Text test : tests) {
+        result.append(test);
+        result.append("\n");
+      }
+      context.write(code, new Text(result.toString()));
+    }
+  }
+
+  @Override
+  public int run(String[] args) throws Exception {
+    // read a list of tests from the input, and print out the results
+    if (args.length != 2) {
+      System.err.println("Wrong number of args: <input> <output>");
+    }
+    Configuration conf = getConf();
+    Job job = Job.getInstance(conf, "accumulo integration test runner");
+    // read one line at a time
+    job.setInputFormatClass(NLineInputFormat.class);
+    conf.setInt(NLineInputFormat.LINES_PER_MAP, 1);
+
+    // run the test
+    job.setJarByClass(IntegrationTestMapReduce.class);
+    job.setMapperClass(TestMapper.class);
+
+    // group test by result code
+    job.setReducerClass(TestReducer.class);
+    job.setOutputKeyClass(IntWritable.class);
+    job.setOutputValueClass(Text.class);
+
+    FileInputFormat.addInputPath(job, new Path(args[0]));
+    FileOutputFormat.setOutputPath(job, new Path(args[1]));
+    return job.waitForCompletion(true) ? 0 : 1;
+  }
+
+  public static void main(String[] args) throws Exception {
+    System.exit(ToolRunner.run(new IntegrationTestMapReduce(), args));
+  }
+
+}


Mime
View raw message