From aee1bb81c69f11ace3d25a89c66441250b61e79d Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Sun, 15 Jan 2012 08:51:48 +0000 Subject: [PATCH] HADOOP-7974. TestViewFsTrash incorrectly determines the user's home directory. Contributed by Harsh J git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1231640 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop-common/CHANGES.txt | 3 +++ .../hadoop/fs/viewfs/TestViewFsTrash.java | 19 +++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 6f951e095a7..3026e078cbd 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -271,6 +271,9 @@ Release 0.23.1 - Unreleased HADOOP-7964. Deadlock in NetUtils and SecurityUtil class initialization. (Daryn Sharp via suresh) + HADOOP-7974. TestViewFsTrash incorrectly determines the user's home + directory. (harsh via eli) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java index 9239f2f1f8c..7795c3f5f02 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java @@ -78,17 +78,16 @@ public void setUp() throws Exception { // set up viewfs's home dir root to point to home dir root on target // But home dir is different on linux, mac etc. // Figure it out by calling home dir on target - - String homeDir = fsTarget.getHomeDirectory().toUri().getPath(); - int indexOf2ndSlash = homeDir.indexOf('/', 1); - String homeDirRoot = homeDir.substring(0, indexOf2ndSlash); - ConfigUtil.addLink(conf, homeDirRoot, - fsTarget.makeQualified(new Path(homeDirRoot)).toUri()); - ConfigUtil.setHomeDirConf(conf, homeDirRoot); - Log.info("Home dir base " + homeDirRoot); - + + String homeDirRoot = fsTarget.getHomeDirectory() + .getParent().toUri().getPath(); + ConfigUtil.addLink(conf, homeDirRoot, + fsTarget.makeQualified(new Path(homeDirRoot)).toUri()); + ConfigUtil.setHomeDirConf(conf, homeDirRoot); + Log.info("Home dir base " + homeDirRoot); + fsView = ViewFileSystemTestSetup.setupForViewFs(conf, fsTarget); - + // set working dir so that relative paths //fsView.setWorkingDirectory(new Path(fsTarget.getWorkingDirectory().toUri().getPath())); conf.set("fs.defaultFS", FsConstants.VIEWFS_URI.toString());