You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mrunit.apache.org by db...@apache.org on 2012/11/11 13:38:53 UTC

git commit: MRUNIT-159: MRUnit not compiling with hadoop 0.23.3

Updated Branches:
  refs/heads/trunk 03b0d58cb -> 27b8505da


MRUNIT-159: MRUnit not compiling with hadoop 0.23.3


Project: http://git-wip-us.apache.org/repos/asf/mrunit/repo
Commit: http://git-wip-us.apache.org/repos/asf/mrunit/commit/27b8505d
Tree: http://git-wip-us.apache.org/repos/asf/mrunit/tree/27b8505d
Diff: http://git-wip-us.apache.org/repos/asf/mrunit/diff/27b8505d

Branch: refs/heads/trunk
Commit: 27b8505da44394456f4ae3d91220683e2e5977b5
Parents: 03b0d58
Author: Dave Beech <db...@apache.org>
Authored: Sun Nov 11 12:38:17 2012 +0000
Committer: Dave Beech <db...@apache.org>
Committed: Sun Nov 11 12:38:17 2012 +0000

----------------------------------------------------------------------
 .../java/org/apache/hadoop/mrunit/TestDriver.java  |    4 ++--
 .../mrunit/internal/util/DistCacheUtils.java       |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mrunit/blob/27b8505d/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/mrunit/TestDriver.java b/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
index 1072f26..b460e17 100644
--- a/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
+++ b/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
@@ -461,7 +461,7 @@ public abstract class TestDriver<K1, V1, K2, V2, T extends TestDriver<K1, V1, K2
         localFiles.add(filePath);
       }
       if (!localFiles.isEmpty()) {
-        DistributedCache.addLocalFiles(conf, 
+        DistCacheUtils.addLocalFiles(conf, 
             DistCacheUtils.stringifyPathList(localFiles));
       }
     }
@@ -475,7 +475,7 @@ public abstract class TestDriver<K1, V1, K2, V2, T extends TestDriver<K1, V1, K2
             archivePath, tmpDistCacheDir));
       }
       if (!localArchives.isEmpty()) {
-        DistributedCache.addLocalArchives(conf, 
+        DistCacheUtils.addLocalArchives(conf, 
             DistCacheUtils.stringifyPathList(localArchives));
       }
     }

http://git-wip-us.apache.org/repos/asf/mrunit/blob/27b8505d/src/main/java/org/apache/hadoop/mrunit/internal/util/DistCacheUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/mrunit/internal/util/DistCacheUtils.java b/src/main/java/org/apache/hadoop/mrunit/internal/util/DistCacheUtils.java
index 0a060b1..f150573 100644
--- a/src/main/java/org/apache/hadoop/mrunit/internal/util/DistCacheUtils.java
+++ b/src/main/java/org/apache/hadoop/mrunit/internal/util/DistCacheUtils.java
@@ -27,12 +27,15 @@ import java.util.UUID;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.util.RunJar;
 
 public class DistCacheUtils {
 
+  private static final String CACHE_LOCALARCHIVES = "mapred.cache.localArchives";
+  private static final String CACHE_LOCALFILES = "mapred.cache.localFiles";
   private static final Log LOG = LogFactory.getLog(DistCacheUtils.class);
 
   private DistCacheUtils() {
@@ -129,4 +132,16 @@ public class DistCacheUtils {
            filename.endsWith(".tar"));
   }
 
+  public static void addLocalFiles(Configuration conf, String str) {
+    String files = conf.get(CACHE_LOCALFILES);
+    conf.set(CACHE_LOCALFILES, files == null ? str
+        : files + "," + str);
+  }
+
+  public static void addLocalArchives(Configuration conf, String str) {
+    String files = conf.get(CACHE_LOCALARCHIVES);
+    conf.set(CACHE_LOCALARCHIVES, files == null ? str
+        : files + "," + str);
+  }
+
 }