Browse Source

HADOOP-2973. Fix TestLocalDFS for Windows platform.
(Tsz Wo (Nicholas), SZE via dhruba)



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@635664 13f79535-47bb-0310-9956-ffa450edef68

Dhruba Borthakur 17 years ago
parent
commit
b0df4cfa5e
2 changed files with 12 additions and 2 deletions
  1. 3 0
      CHANGES.txt
  2. 9 2
      src/test/org/apache/hadoop/dfs/TestLocalDFS.java

+ 3 - 0
CHANGES.txt

@@ -164,6 +164,9 @@ Trunk (unreleased changes)
     HADOOP-2870.  DataNode and NameNode closes all connections while
     shutting down. (Hairong Kuang via dhruba)
 
+    HADOOP-2973. Fix TestLocalDFS for Windows platform.
+    (Tsz Wo (Nicholas), SZE via dhruba)
+
 Release 0.16.1 - 2008-03-13
 
   INCOMPATIBLE CHANGES

+ 9 - 2
src/test/org/apache/hadoop/dfs/TestLocalDFS.java

@@ -48,7 +48,14 @@ public class TestLocalDFS extends TestCase {
     fileSys.delete(name, true);
     assertTrue(!fileSys.exists(name));
   }
-  
+
+  static String getUserName(FileSystem fs) {
+    if (fs instanceof DistributedFileSystem) {
+      return ((DistributedFileSystem)fs).dfs.ugi.getUserName();
+    }
+    return System.getProperty("user.name");
+  }
+
   /**
    * Tests get/set working directory in DFS.
    */
@@ -75,7 +82,7 @@ public class TestLocalDFS extends TestCase {
                                     file1.toString()));
 
       // test home directory
-      Path home = new Path("/user/"+System.getProperty("user.name"))
+      Path home = new Path("/user/" + getUserName(fileSys))
         .makeQualified(fileSys);
       Path fsHome = fileSys.getHomeDirectory();
       assertEquals(home, fsHome);