You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/08 05:37:44 UTC

svn commit: r1079127 - in /hadoop/common/branches/yahoo-merge: CHANGES.txt src/java/org/apache/hadoop/fs/FileSystem.java src/test/core/org/apache/hadoop/fs/FileSystemTestHelper.java

Author: omalley
Date: Tue Mar  8 04:37:44 2011
New Revision: 1079127

URL: http://svn.apache.org/viewvc?rev=1079127&view=rev
Log:
commit db65eac45527f691124bc7621e68a10471f0869b
Author: Jakob Glen Homan <jg...@apache.org>
Date:   Thu Nov 11 22:34:52 2010 +0000

    HADOOP-7024. Create a test method for adding file systems during tests.  Contributed by Kan Zhang.
    
    
    git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1034184 13f79535-47bb-0310-9956-ffa450edef68

Modified:
    hadoop/common/branches/yahoo-merge/CHANGES.txt
    hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FileSystem.java
    hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/fs/FileSystemTestHelper.java

Modified: hadoop/common/branches/yahoo-merge/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/CHANGES.txt?rev=1079127&r1=1079126&r2=1079127&view=diff
==============================================================================
--- hadoop/common/branches/yahoo-merge/CHANGES.txt (original)
+++ hadoop/common/branches/yahoo-merge/CHANGES.txt Tue Mar  8 04:37:44 2011
@@ -173,6 +173,9 @@ Trunk (unreleased changes)
 
     HADOOP-6977. Herriot daemon clients should vend statistics (cos)
 
+    HADOOP-7024. Create a test method for adding file systems during tests.
+    (Kan Zhang via jghoman)
+
   OPTIMIZATIONS
 
     HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..).

Modified: hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FileSystem.java?rev=1079127&r1=1079126&r2=1079127&view=diff
==============================================================================
--- hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FileSystem.java (original)
+++ hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/FileSystem.java Tue Mar  8 04:37:44 2011
@@ -104,6 +104,19 @@ public abstract class FileSystem extends
   private Set<Path> deleteOnExit = new TreeSet<Path>();
   
   /**
+   * This method adds a file system for testing so that we can find it later. It
+   * is only for testing.
+   * @param uri the uri to store it under
+   * @param conf the configuration to store it under
+   * @param fs the file system to store
+   * @throws IOException
+   */
+  static void addFileSystemForTesting(URI uri, Configuration conf,
+      FileSystem fs) throws IOException {
+    CACHE.map.put(new Cache.Key(uri, conf), fs);
+  }
+
+  /**
    * Get a filesystem instance based on the uri, the passed
    * configuration and the user
    * @param uri

Modified: hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/fs/FileSystemTestHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/fs/FileSystemTestHelper.java?rev=1079127&r1=1079126&r2=1079127&view=diff
==============================================================================
--- hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/fs/FileSystemTestHelper.java (original)
+++ hadoop/common/branches/yahoo-merge/src/test/core/org/apache/hadoop/fs/FileSystemTestHelper.java Tue Mar  8 04:37:44 2011
@@ -20,8 +20,10 @@ package org.apache.hadoop.fs;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.io.FileNotFoundException;
+import java.net.URI;
 
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.IOUtils;
 import org.junit.Assert;
 
@@ -40,6 +42,11 @@ public final class FileSystemTestHelper 
   /** Hidden constructor */
   private FileSystemTestHelper() {}
   
+  public static void addFileSystemForTesting(URI uri, Configuration conf,
+      FileSystem fs) throws IOException {
+    FileSystem.addFileSystemForTesting(uri, conf, fs);
+  }
+  
   public static int getDefaultBlockSize() {
     return DEFAULT_BLOCK_SIZE;
   }