From 0201be46c298e94176ec6297e9d9cdba3afc2bbd Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Tue, 13 Dec 2011 20:17:59 +0000 Subject: [PATCH] HADOOP-7810. move hadoop archive to core from tools. (tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1213907 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 2 ++ .../java}/org/apache/hadoop/fs/HarFileSystem.java | 0 .../java}/org/apache/hadoop/fs/TestHarFileSystem.java | 0 .../java}/org/apache/hadoop/tools/HadoopArchives.java | 11 +++++++++++ .../org/apache/hadoop/tools/TestHadoopArchives.java | 5 +++++ hadoop-tools/pom.xml | 1 + 6 files changed, 19 insertions(+) rename {hadoop-mapreduce-project/src/tools => hadoop-common-project/hadoop-common/src/main/java}/org/apache/hadoop/fs/HarFileSystem.java (100%) rename {hadoop-mapreduce-project/src/test/mapred => hadoop-common-project/hadoop-common/src/test/java}/org/apache/hadoop/fs/TestHarFileSystem.java (100%) rename {hadoop-mapreduce-project/src/tools => hadoop-tools/hadoop-archives/src/main/java}/org/apache/hadoop/tools/HadoopArchives.java (98%) rename {hadoop-mapreduce-project/src/test/mapred => hadoop-tools/hadoop-archives/src/test/java}/org/apache/hadoop/tools/TestHadoopArchives.java (96%) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 12255852a9..9e63b3e147 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -136,6 +136,8 @@ Trunk (unreleased changes) HADOOP-7913 Fix bug in ProtoBufRpcEngine (sanjay) + HADOOP-7810. move hadoop archive to core from tools. (tucu) + OPTIMIZATIONS HADOOP-7761. Improve the performance of raw comparisons. (todd) diff --git a/hadoop-mapreduce-project/src/tools/org/apache/hadoop/fs/HarFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java similarity index 100% rename from hadoop-mapreduce-project/src/tools/org/apache/hadoop/fs/HarFileSystem.java rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java diff --git a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/fs/TestHarFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java similarity index 100% rename from hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/fs/TestHarFileSystem.java rename to hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestHarFileSystem.java diff --git a/hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/HadoopArchives.java b/hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java similarity index 98% rename from hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/HadoopArchives.java rename to hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java index 41d149ea95..cbe8b9cbab 100644 --- a/hadoop-mapreduce-project/src/tools/org/apache/hadoop/tools/HadoopArchives.java +++ b/hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java @@ -111,6 +111,14 @@ public void setConf(Configuration conf) { } else { this.conf = new JobConf(conf, HadoopArchives.class); } + + // This is for test purposes since MR2, different from Streaming + // here it is not possible to add a JAR to the classpath the tool + // will when running the mapreduce job. + String testJar = System.getProperty(TEST_HADOOP_ARCHIVES_JAR_PATH, null); + if (testJar != null) { + ((JobConf)conf).setJar(testJar); + } } public Configuration getConf() { @@ -868,9 +876,12 @@ public int run(String[] args) throws Exception { return 0; } + static final String TEST_HADOOP_ARCHIVES_JAR_PATH = "test.hadoop.archives.jar"; + /** the main functions **/ public static void main(String[] args) { JobConf job = new JobConf(HadoopArchives.class); + HadoopArchives harchives = new HadoopArchives(job); int ret = 0; diff --git a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/tools/TestHadoopArchives.java b/hadoop-tools/hadoop-archives/src/test/java/org/apache/hadoop/tools/TestHadoopArchives.java similarity index 96% rename from hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/tools/TestHadoopArchives.java rename to hadoop-tools/hadoop-archives/src/test/java/org/apache/hadoop/tools/TestHadoopArchives.java index c999964ee7..a00be5701a 100644 --- a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/tools/TestHadoopArchives.java +++ b/hadoop-tools/hadoop-archives/src/test/java/org/apache/hadoop/tools/TestHadoopArchives.java @@ -39,6 +39,7 @@ import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.mapred.MiniMRCluster; +import org.apache.hadoop.util.JarFinder; import org.apache.hadoop.util.ToolRunner; import org.apache.log4j.Level; @@ -46,6 +47,9 @@ * test {@link HadoopArchives} */ public class TestHadoopArchives extends TestCase { + + public static final String HADOOP_ARCHIVES_JAR = JarFinder.getJar(HadoopArchives.class); + { ((Log4JLogger)LogFactory.getLog(org.apache.hadoop.security.Groups.class) ).getLogger().setLevel(Level.OFF); @@ -136,6 +140,7 @@ public void testPathWithSpaces() throws Exception { "*", archivePath.toString() }; + System.setProperty(HadoopArchives.TEST_HADOOP_ARCHIVES_JAR_PATH, HADOOP_ARCHIVES_JAR); final HadoopArchives har = new HadoopArchives(mapred.createJobConf()); assertEquals(0, ToolRunner.run(har, args)); diff --git a/hadoop-tools/pom.xml b/hadoop-tools/pom.xml index 2347ec3e0e..aa4e20fc56 100644 --- a/hadoop-tools/pom.xml +++ b/hadoop-tools/pom.xml @@ -29,6 +29,7 @@ hadoop-streaming + hadoop-archives