From bf7d772b797680da69b9945b57cec0bfc9b46f88 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Fri, 30 Nov 2012 18:38:53 +0000 Subject: [PATCH] HADOOP-8958. ViewFs:Non absolute mount name failures when running multiple tests on Windows. Contributed by Chris Nauroth. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1415784 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java | 8 ++++++-- .../java/org/apache/hadoop/fs/viewfs/ViewFsTestSetup.java | 8 ++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 95e44506c7..b6a16ceea9 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -453,6 +453,9 @@ Release 2.0.3-alpha - Unreleased HADOOP-9064. Augment DelegationTokenRenewer API to cancel the tokens on calls to removeRenewAction. (kkambatl via tucu) + HADOOP-8958. ViewFs:Non absolute mount name failures when running + multiple tests on Windows. (Chris Nauroth via suresh) + Release 2.0.2-alpha - 2012-09-07 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java index 446b38e60b..c502fbd7df 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java @@ -26,6 +26,7 @@ import org.apache.hadoop.fs.FsConstants; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.viewfs.ConfigUtil; +import org.apache.hadoop.util.Shell; import org.mortbay.log.Log; @@ -123,8 +124,11 @@ static void setUpHomeDir(Configuration conf, FileSystem fsTarget) { * in the target file system. */ static void linkUpFirstComponents(Configuration conf, String path, FileSystem fsTarget, String info) { - int indexOf2ndSlash = path.indexOf('/', 1); - String firstComponent = path.substring(0, indexOf2ndSlash); + int indexOfEnd = path.indexOf('/', 1); + if (Shell.WINDOWS) { + indexOfEnd = path.indexOf('/', indexOfEnd + 1); + } + String firstComponent = path.substring(0, indexOfEnd); URI linkTarget = fsTarget.makeQualified(new Path(firstComponent)).toUri(); ConfigUtil.addLink(conf, firstComponent, linkTarget); Log.info("Added link for " + info + " " diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsTestSetup.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsTestSetup.java index ac63217fd4..fd519ff2a4 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsTestSetup.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsTestSetup.java @@ -25,6 +25,7 @@ import org.apache.hadoop.fs.FsConstants; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.viewfs.ConfigUtil; +import org.apache.hadoop.util.Shell; import org.mortbay.log.Log; @@ -120,8 +121,11 @@ static void setUpHomeDir(Configuration conf, FileContext fsTarget) { */ static void linkUpFirstComponents(Configuration conf, String path, FileContext fsTarget, String info) { - int indexOf2ndSlash = path.indexOf('/', 1); - String firstComponent = path.substring(0, indexOf2ndSlash); + int indexOfEnd = path.indexOf('/', 1); + if (Shell.WINDOWS) { + indexOfEnd = path.indexOf('/', indexOfEnd + 1); + } + String firstComponent = path.substring(0, indexOfEnd); URI linkTarget = fsTarget.makeQualified(new Path(firstComponent)).toUri(); ConfigUtil.addLink(conf, firstComponent, linkTarget); Log.info("Added link for " + info + " "