hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1127679 - in /hadoop/common/trunk: ./ src/java/org/apache/hadoop/fs/ src/java/org/apache/hadoop/fs/shell/ src/java/org/apache/hadoop/fs/viewfs/ src/test/core/org/apache/hadoop/fs/ src/test/core/org/apache/hadoop/fs/viewfs/
Date Wed, 25 May 2011 20:45:28 GMT
Author: todd
Date: Wed May 25 20:45:27 2011
New Revision: 1127679

URL: http://svn.apache.org/viewvc?rev=1127679&view=rev
Log:
Revert HADOOP-7284 (r1127642) since it broke the HDFS build.

Removed:
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java
Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/Trash.java
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Delete.java
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestTrash.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFs.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Wed May 25 20:45:27 2011
@@ -247,8 +247,6 @@ Trunk (unreleased changes)
     HADOOP-7282. ipc.Server.getRemoteIp() may return null.  (John George
     via szetszwo)
 
-    HADOOP-7284 Trash and shell's rm does not work for viewfs (Sanjay Radia)
-
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/Trash.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/Trash.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/Trash.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/Trash.java Wed May 25 20:45:27 2011
@@ -17,11 +17,6 @@
  */
 package org.apache.hadoop.fs;
 
-import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_CHECKPOINT_INTERVAL_DEFAULT;
-import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_CHECKPOINT_INTERVAL_KEY;
-import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_DEFAULT;
-import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_KEY;
-
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.text.DateFormat;
@@ -35,6 +30,7 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configured;
+import static org.apache.hadoop.fs.CommonConfigurationKeys.*;
 import org.apache.hadoop.fs.permission.FsAction;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.util.StringUtils;
@@ -90,26 +86,7 @@ public class Trash extends Configured {
                                          FS_TRASH_INTERVAL_DEFAULT) *
                                 MSECS_PER_MINUTE);
   }
-  
-  /**
-   * In case of the symlinks or mount points, one has to move the appropriate
-   * trashbin in the actual volume of the path p being deleted.
-   * 
-   * Hence we get the file system of the fully-qualified resolved-path and
-   * then move the path p to the trashbin in that volume,
-   * @param fs - the filesystem of path p
-   * @param p - the  path being deleted - to be moved to trasg
-   * @param conf - configuration
-   * @return false if the item is already in the trash or trash is disabled
-   * @throws IOException on error
-   */
-  public static boolean moveToAppropriateTrash(FileSystem fs, Path p,
-      Configuration conf) throws IOException {
-    Path fullyResolvedPath = fs.resolvePath(p);
-    Trash trash = new Trash(FileSystem.get(fullyResolvedPath.toUri(), conf), conf);
-    return trash.moveToTrash(fullyResolvedPath);
-  }
-  
+
   private Trash(Path home, Configuration conf) throws IOException {
     super(conf);
     this.fs = home.getFileSystem(conf);
@@ -145,7 +122,7 @@ public class Trash extends Configured {
     if (!fs.exists(path))                         // check that path exists
       throw new FileNotFoundException(path.toString());
 
-    String qpath = fs.makeQualified(path).toString();
+    String qpath = path.makeQualified(fs).toString();
 
     if (qpath.startsWith(trash.toString())) {
       return false;                               // already in trash

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Delete.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Delete.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Delete.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/shell/Delete.java Wed May 25 20:45:27
2011
@@ -86,7 +86,8 @@ class Delete extends FsCommand {
     private boolean moveToTrash(PathData item) throws IOException {
       boolean success = false;
       if (!skipTrash) {
-        success = Trash.moveToAppropriateTrash(item.fs, item.path, getConf());
+        Trash trash = new Trash(item.fs, getConf());
+        success = (trash.isEnabled() && trash.moveToTrash(item.path));
       }
       return success;
     }

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ChRootedFileSystem.java Wed May
25 20:45:27 2011
@@ -116,7 +116,8 @@ class ChRootedFileSystem extends FileSys
           chRootPathPart.toString().substring(1));
 
     workingDir = getHomeDirectory();
-    // We don't use the wd of the myFs
+    // We don't use the wd of the myFs,  (lets set it to root anyway)
+    myFs.setWorkingDirectory(chRootPathPart);
   }
   
   /** 

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java Wed May 25
20:45:27 2011
@@ -157,6 +157,8 @@ public class ViewFileSystem extends File
     final String authority = theUri.getAuthority();
     try {
       myUri = new URI(FsConstants.VIEWFS_SCHEME, authority, "/", null, null);
+      workingDir =
+        this.makeQualified(new Path("/user/" + ugi.getShortUserName()));
       fsState = new InodeTree<FileSystem>(conf, authority) {
 
         @Override
@@ -182,7 +184,6 @@ public class ViewFileSystem extends File
           // return MergeFs.createMergeFs(mergeFsURIList, config);
         }
       };
-      workingDir = this.getHomeDirectory();
     } catch (URISyntaxException e) {
       throw new IOException("URISyntax exception: " + theUri);
     }
@@ -233,28 +234,6 @@ public class ViewFileSystem extends File
     return res.targetFileSystem.resolvePath(res.remainingPath);
   }
   
-  Path homeDir = null;
-  @Override
-  public Path getHomeDirectory() {
-    String base = "/user/";;
-    if (homeDir == null) {
-      // We deal with whether or not home dir should be /user (hdfs) or /Users (if run on
local file system on mac
-      try {
-        if (this.exists(new Path("/user/"))) {
-          base = "/user/";
-        } else if (this.exists(new Path("/Users"))) {
-          base = "/Users/";  
-        } else if (this.exists(new Path("/homes"))) {
-          base = "/homes/";  
-        }
-      } catch (IOException e) {
-          // ignore - - the default of /user is good enough
-      }
-      homeDir = this.makeQualified(new Path(base + ugi.getShortUserName()));
-    }
-    return homeDir;
-  }
-  
   @Override
   public Path getWorkingDirectory() {
     return workingDir;

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestTrash.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestTrash.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestTrash.java (original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestTrash.java Wed May 25 20:45:27
2011
@@ -24,6 +24,7 @@ import java.io.DataOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -56,10 +57,10 @@ public class TestTrash extends TestCase 
   }
 
   // check that the specified file is in Trash
-  protected static void checkTrash(FileSystem trashFs, Path trashRoot,
+  protected static void checkTrash(FileSystem fs, Path trashRoot,
       Path path) throws IOException {
     Path p = new Path(trashRoot+"/"+ path.toUri().getPath());
-    assertTrue("Could not find file in trash: "+ p , trashFs.exists(p));
+    assertTrue(fs.exists(p));
   }
   
   // counts how many instances of the file are in the Trash
@@ -89,19 +90,10 @@ public class TestTrash extends TestCase 
     assertTrue(!fs.exists(p));
   }
 
-  /**
-   * 
-   * Test trash for the shell's delete command for the default file system
-   * specified in the paramter conf
-   * @param conf 
-   * @param base - the base path where files are created
-   * @param trashRoot - the expected place where the trashbin resides
-   * @throws IOException
-   */
-  public static void trashShell(final Configuration conf, final Path base,
-      FileSystem trashRootFs, Path trashRoot)
+  protected static void trashShell(final FileSystem fs, final Path base)
       throws IOException {
-    FileSystem fs = FileSystem.get(conf);
+    Configuration conf = new Configuration();
+    conf.set("fs.default.name", fs.getUri().toString());
 
     conf.set(FS_TRASH_INTERVAL_KEY, "0"); // disabled
     assertFalse(new Trash(conf).isEnabled());
@@ -111,12 +103,7 @@ public class TestTrash extends TestCase 
 
     FsShell shell = new FsShell();
     shell.setConf(conf);
-    if (trashRoot == null) {
-      trashRoot = shell.getCurrentTrashDir();
-    }
-    if (trashRootFs == null) {
-      trashRootFs = fs;
-    }
+    Path trashRoot = null;
 
     // First create a new directory with mkdirs
     Path myPath = new Path(base, "test/mkdirs");
@@ -156,8 +143,8 @@ public class TestTrash extends TestCase 
       }
       assertTrue(val == 0);
 
- 
-      checkTrash(trashRootFs, trashRoot, fs.makeQualified(myFile));
+      trashRoot = shell.getCurrentTrashDir();
+      checkTrash(fs, trashRoot, myFile);
     }
 
     // Verify that we can recreate the file
@@ -219,7 +206,7 @@ public class TestTrash extends TestCase 
     {
         Path toErase = new Path(trashRoot, "toErase");
         int retVal = -1;
-        writeFile(trashRootFs, toErase);
+        writeFile(fs, toErase);
         try {
           retVal = shell.run(new String[] {"-rm", toErase.toString()});
         } catch (Exception e) {
@@ -227,8 +214,8 @@ public class TestTrash extends TestCase 
                              e.getLocalizedMessage());
         }
         assertTrue(retVal == 0);
-        checkNotInTrash (trashRootFs, trashRoot, toErase.toString());
-        checkNotInTrash (trashRootFs, trashRoot, toErase.toString()+".1");
+        checkNotInTrash (fs, trashRoot, toErase.toString());
+        checkNotInTrash (fs, trashRoot, toErase.toString()+".1");
     }
 
     // simulate Trash removal
@@ -246,7 +233,7 @@ public class TestTrash extends TestCase 
     }
 
     // verify that after expunging the Trash, it really goes away
-    checkNotInTrash(trashRootFs, trashRoot, new Path(base, "test/mkdirs/myFile").toString());
+    checkNotInTrash(fs, trashRoot, new Path(base, "test/mkdirs/myFile").toString());
 
     // recreate directory and file
     mkdir(fs, myPath);
@@ -265,7 +252,7 @@ public class TestTrash extends TestCase 
                            e.getLocalizedMessage());
       }
       assertTrue(val == 0);
-      checkTrash(trashRootFs, trashRoot, myFile);
+      checkTrash(fs, trashRoot, myFile);
 
       args = new String[2];
       args[0] = "-rmr";
@@ -278,7 +265,7 @@ public class TestTrash extends TestCase 
                            e.getLocalizedMessage());
       }
       assertTrue(val == 0);
-      checkTrash(trashRootFs, trashRoot, myPath);
+      checkTrash(fs, trashRoot, myPath);
     }
 
     // attempt to remove parent of trash
@@ -294,7 +281,7 @@ public class TestTrash extends TestCase 
                            e.getLocalizedMessage());
       }
       assertEquals("exit code", 1, val);
-      assertTrue(trashRootFs.exists(trashRoot));
+      assertTrue(fs.exists(trashRoot));
     }
     
     // Verify skip trash option really works
@@ -320,10 +307,7 @@ public class TestTrash extends TestCase 
         System.err.println("Exception raised from Trash.run " +
             e.getLocalizedMessage());
       }
-      assertFalse("Expected TrashRoot (" + trashRoot + 
-          ") to exist in file system:"
-          + trashRootFs.getUri(), 
-          trashRootFs.exists(trashRoot)); // No new Current should be created
+      assertFalse(fs.exists(trashRoot)); // No new Current should be created
       assertFalse(fs.exists(myFile));
       assertTrue(val == 0);
     }
@@ -351,7 +335,7 @@ public class TestTrash extends TestCase 
             e.getLocalizedMessage());
       }
 
-      assertFalse(trashRootFs.exists(trashRoot)); // No new Current should be created
+      assertFalse(fs.exists(trashRoot)); // No new Current should be created
       assertFalse(fs.exists(myPath));
       assertFalse(fs.exists(myFile));
       assertTrue(val == 0);
@@ -430,13 +414,13 @@ public class TestTrash extends TestCase 
   public void testTrash() throws IOException {
     Configuration conf = new Configuration();
     conf.setClass("fs.file.impl", TestLFS.class, FileSystem.class);
-    trashShell(conf, TEST_DIR, null, null);
+    trashShell(FileSystem.getLocal(conf), TEST_DIR);
   }
 
   public void testNonDefaultFS() throws IOException {
     Configuration conf = new Configuration();
     conf.setClass("fs.file.impl", TestLFS.class, FileSystem.class);
-    conf.set("fs.defaultFS", "invalid://host/bar/foo");
+    conf.set("fs.default.name", "invalid://host/bar/foo");
     trashNonDefaultFS(conf);
   }
   
@@ -454,7 +438,7 @@ public class TestTrash extends TestCase 
     emptierThread.start();
 
     FileSystem fs = FileSystem.getLocal(conf);
-    conf.set("fs.defaultFS", fs.getUri().toString());
+    conf.set("fs.default.name", fs.getUri().toString());
     FsShell shell = new FsShell();
     shell.setConf(conf);
     shell.init();
@@ -537,7 +521,7 @@ public class TestTrash extends TestCase 
     conf.setClass("fs.file.impl", TestLFS.class, FileSystem.class);
     FileSystem fs = FileSystem.getLocal(conf);
     
-    conf.set("fs.defaultFS", fs.getUri().toString());
+    conf.set("fs.default.name", fs.getUri().toString());
     conf.set(FS_TRASH_INTERVAL_KEY, "10"); //minutes..
     FsShell shell = new FsShell();
     shell.setConf(conf);

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
(original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
Wed May 25 20:45:27 2011
@@ -17,7 +17,6 @@
  */
 package org.apache.hadoop.fs.viewfs;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
 
@@ -288,21 +287,5 @@ public class TestChRootedFileSystem {
     Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
 
   }
-  
-  /*
-   * Test resolvePath(p) 
-   */
-  
-  @Test
-  public void testResolvePath() throws IOException {
-    Assert.assertEquals(chrootedTo, fSys.resolvePath(new Path("/"))); 
-    FileSystemTestHelper.createFile(fSys, "/foo");
-    Assert.assertEquals(new Path(chrootedTo, "foo"),
-        fSys.resolvePath(new Path("/foo"))); 
-  }
-
-  @Test(expected=FileNotFoundException.class) 
-  public void testResolvePathNonExisting() throws IOException {
-      fSys.resolvePath(new Path("/nonExisting"));
-  }
+ 
 }

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFs.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFs.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFs.java (original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestChRootedFs.java Wed
May 25 20:45:27 2011
@@ -17,7 +17,6 @@
  */
 package org.apache.hadoop.fs.viewfs;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
 import java.util.EnumSet;
@@ -289,22 +288,5 @@ public class TestChRootedFs {
     Assert.assertEquals(absoluteDir, fc.getWorkingDirectory());
 
   }
-  
-  /*
-   * Test resolvePath(p) 
-   */
-  
-  @Test
-  public void testResolvePath() throws IOException {
-    Assert.assertEquals(chrootedTo, fc.getDefaultFileSystem().resolvePath(new Path("/")));

-    FileContextTestHelper.createFile(fc, "/foo");
-    Assert.assertEquals(new Path(chrootedTo, "foo"),
-        fc.getDefaultFileSystem().resolvePath(new Path("/foo"))); 
-  }
-
-  @Test(expected=FileNotFoundException.class) 
-  public void testResolvePathNonExisting() throws IOException {
-      fc.getDefaultFileSystem().resolvePath(new Path("/nonExisting"));
-  }
  
 }

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java
(original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java
Wed May 25 20:45:27 2011
@@ -37,8 +37,7 @@ public class TestFSMainOperationsLocalFi
   public void setUp() throws Exception {
     Configuration conf = new Configuration();
     fcTarget = FileSystem.getLocal(conf);
-    fSys = ViewFileSystemTestSetup.setupForViewFs(
-        ViewFileSystemTestSetup.configWithViewfsScheme(), fcTarget);
+    fSys = ViewFileSystemTestSetup.setupForViewFs(fcTarget);
     super.setUp();
   }
   

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java?rev=1127679&r1=1127678&r2=1127679&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java
(original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java
Wed May 25 20:45:27 2011
@@ -32,8 +32,7 @@ import org.apache.hadoop.fs.viewfs.Confi
  * If tests launched via ant (build.xml) the test root is absolute path
  * If tests launched via eclipse, the test root is 
  * is a test dir below the working directory. (see FileSystemTestHelper).
- * Since viewFs has no built-in wd, its wd is /user/<username> 
- *          (or /User/<username> on mac
+ * Since viewFs has no built-in wd, its wd is /user/<username>.
  * 
  * We set a viewFileSystems with mount point for 
  * /<firstComponent>" pointing to the target fs's  testdir 
@@ -46,28 +45,32 @@ public class ViewFileSystemTestSetup {
    * @return return the ViewFS File context to be used for tests
    * @throws Exception
    */
-  static public FileSystem setupForViewFs(Configuration conf, FileSystem fsTarget) throws
Exception {
+  static public FileSystem setupForViewFs(FileSystem fsTarget) throws Exception {
     /**
      * create the test root on local_fs - the  mount table will point here
      */
+    Configuration conf = configWithViewfsScheme();
     Path targetOfTests = FileSystemTestHelper.getTestRootPath(fsTarget);
     // In case previous test was killed before cleanup
     fsTarget.delete(targetOfTests, true);
     
     fsTarget.mkdirs(targetOfTests);
   
+    String srcTestFirstDir;
+    if (FileSystemTestHelper.TEST_ROOT_DIR.startsWith("/")) {
+      int indexOf2ndSlash = FileSystemTestHelper.TEST_ROOT_DIR.indexOf('/', 1);
+      srcTestFirstDir = FileSystemTestHelper.TEST_ROOT_DIR.substring(0, indexOf2ndSlash);
+    } else {
+      srcTestFirstDir = "/user"; 
+  
+    }
+    //System.out.println("srcTestFirstDir=" + srcTestFirstDir);
+  
+    // Set up the defaultMT in the config with mount point links
+    // The test dir is root is below  /user/<userid>
 
-    // Now set up a link from viewfs to targetfs for the first component of
-    // path of testdir. For example, if testdir is /user/<userid>/xx then
-    // a link from /user to tragetfs://user.
-    
-    String testDir = FileSystemTestHelper.getTestRootPath(fsTarget).toUri().getPath();
-    int indexOf2ndSlash = testDir.indexOf('/', 1);
-    String testDirFirstComponent = testDir.substring(0, indexOf2ndSlash);
-    
-    
-    ConfigUtil.addLink(conf, testDirFirstComponent,
-        fsTarget.makeQualified(new Path(testDirFirstComponent)).toUri()); 
+    ConfigUtil.addLink(conf, srcTestFirstDir,
+        targetOfTests.toUri());
     
     FileSystem fsView = FileSystem.get(FsConstants.VIEWFS_URI, conf);
     //System.out.println("SRCOfTests = "+ getTestRootPath(fs, "test"));



Mime
View raw message