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 su...@apache.org on 2012/12/17 00:22:26 UTC
svn commit: r1422713 [1/2] - in
/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs:
./ viewfs/
Author: suresh
Date: Sun Dec 16 23:22:22 2012
New Revision: 1422713
URL: http://svn.apache.org/viewvc?rev=1422713&view=rev
Log:
HDFS-4316. branch-trunk-win contains test code accidentally added during work on fixing tests on Windows. Contributed by Chris Nauroth.
Modified:
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FCStatisticsBaseTest.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextCreateMkdirBaseTest.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextPermissionBase.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextSymlinkBaseTest.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextUtilBase.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemTestHelper.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFSMainOperationsLocalFileSystem.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileContextDeleteOnExit.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextSymlink.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFs.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLocalFileSystem.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemWithAuthorityLocalFileSystem.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java
hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsTestSetup.java
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FCStatisticsBaseTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FCStatisticsBaseTest.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FCStatisticsBaseTest.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FCStatisticsBaseTest.java Sun Dec 16 23:22:22 2012
@@ -41,9 +41,6 @@ public abstract class FCStatisticsBaseTe
//fc should be set appropriately by the deriving test.
protected static FileContext fc = null;
-
- private final FileContextTestHelper fileContextTestHelper =
- new FileContextTestHelper();
@Test
public void testStatistics() throws IOException, URISyntaxException {
@@ -100,8 +97,4 @@ public abstract class FCStatisticsBaseTe
}
return URI.create(SchemeAuthString);
}
-
- protected Path getTestRootPath(FileContext fc, String pathString){
- return fileContextTestHelper.getTestRootPath(fc, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java Sun Dec 16 23:22:22 2012
@@ -65,8 +65,6 @@ public abstract class FSMainOperationsBa
protected static FileSystem fSys;
-
- private final FileSystemTestHelper fileSystemTestHelper;
final private static PathFilter DEFAULT_FILTER = new PathFilter() {
@Override
@@ -75,14 +73,6 @@ public abstract class FSMainOperationsBa
}
};
- public FSMainOperationsBaseTest() {
- this(new FileSystemTestHelper());
- }
-
- public FSMainOperationsBaseTest(FileSystemTestHelper fileSystemTestHelper) {
- this.fileSystemTestHelper = fileSystemTestHelper;
- }
-
//A test filter with returns any path containing a "b"
final private static PathFilter TEST_X_FILTER = new PathFilter() {
@Override
@@ -1144,12 +1134,4 @@ public abstract class FSMainOperationsBa
}
return false;
}
-
- protected Path getAbsoluteTestRootPath(FileSystem fSys) throws IOException {
- return fileSystemTestHelper.getAbsoluteTestRootPath(fSys);
- }
-
- protected Path getTestRootPath(FileSystem fSys, String pathString) {
- return fileSystemTestHelper.getTestRootPath(fSys, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextCreateMkdirBaseTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextCreateMkdirBaseTest.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextCreateMkdirBaseTest.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextCreateMkdirBaseTest.java Sun Dec 16 23:22:22 2012
@@ -52,8 +52,6 @@ import org.apache.commons.logging.impl.L
public abstract class FileContextCreateMkdirBaseTest {
protected static FileContext fc;
-
- private final FileContextTestHelper fileContextTestHelper;
{
try {
@@ -65,15 +63,6 @@ public abstract class FileContextCreateM
}
}
- public FileContextCreateMkdirBaseTest() {
- this(new FileContextTestHelper());
- }
-
- public FileContextCreateMkdirBaseTest(
- FileContextTestHelper fileContextTestHelper) {
-
- this.fileContextTestHelper = fileContextTestHelper;
- }
@Before
public void setUp() throws Exception {
@@ -138,8 +127,7 @@ public abstract class FileContextCreateM
@Test
public void testCreateNonRecursiveWithNonExistingDir() {
try {
- fileContextTestHelper.createFileNonRecursive(fc,
- getTestRootPath(fc, "NonExisting/foo"));
+ createFileNonRecursive(fc, getTestRootPath(fc, "NonExisting/foo"));
Assert.fail("Create with non existing parent dir should have failed");
} catch (IOException e) {
// As expected
@@ -161,12 +149,4 @@ public abstract class FileContextCreateM
createFile(fc, f);
Assert.assertTrue(isFile(fc, f));
}
-
- private Path getTestRootPath(FileContext fc) {
- return fileContextTestHelper.getTestRootPath(fc);
- }
-
- private Path getTestRootPath(FileContext fc, String pathString) {
- return fileContextTestHelper.getTestRootPath(fc, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java Sun Dec 16 23:22:22 2012
@@ -73,8 +73,6 @@ public abstract class FileContextMainOpe
}
protected static FileContext fc;
-
- private final FileContextTestHelper fileContextTestHelper;
final private static PathFilter DEFAULT_FILTER = new PathFilter() {
@Override
@@ -97,16 +95,6 @@ public abstract class FileContextMainOpe
private static byte[] data = getFileData(numBlocks,
getDefaultBlockSize());
- public FileContextMainOperationsBaseTest() {
- this(new FileContextTestHelper());
- }
-
- public FileContextMainOperationsBaseTest(
- FileContextTestHelper fileContextTestHelper) {
-
- this.fileContextTestHelper = fileContextTestHelper;
- }
-
@Before
public void setUp() throws Exception {
fc.mkdir(getTestRootPath(fc, "test"), FileContext.DEFAULT_PERM, true);
@@ -1202,12 +1190,4 @@ public abstract class FileContextMainOpe
}
return false;
}
-
- protected Path getAbsoluteTestRootPath(FileContext fc) throws IOException {
- return fileContextTestHelper.getAbsoluteTestRootPath(fc);
- }
-
- protected Path getTestRootPath(FileContext fc, String pathString) {
- return fileContextTestHelper.getTestRootPath(fc, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextPermissionBase.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextPermissionBase.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextPermissionBase.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextPermissionBase.java Sun Dec 16 23:22:22 2012
@@ -70,16 +70,6 @@ public abstract class FileContextPermiss
protected static FileContext fc;
- private final FileContextTestHelper fileContextTestHelper;
-
- public FileContextPermissionBase() {
- this(new FileContextTestHelper());
- }
-
- public FileContextPermissionBase(FileContextTestHelper fileContextTestHelper) {
- this.fileContextTestHelper = fileContextTestHelper;
- }
-
@Before
public void setUp() throws Exception {
fc.mkdir(getTestRootPath(fc), FileContext.DEFAULT_PERM, true);
@@ -104,7 +94,7 @@ public abstract class FileContextPermiss
}
String filename = "foo";
Path f = getTestRootPath(fc, filename);
- fileContextTestHelper.createFile(fc, filename);
+ createFile(fc, filename);
doFilePermissionCheck(FileContext.DEFAULT_PERM.applyUMask(fc.getUMask()),
fc.getFileStatus(f).getPermission());
}
@@ -119,7 +109,7 @@ public abstract class FileContextPermiss
String filename = "foo";
Path f = getTestRootPath(fc, filename);
- fileContextTestHelper.createFile(fc, f);
+ createFile(fc, f);
try {
// create files and manipulate them.
@@ -221,12 +211,4 @@ public abstract class FileContextPermiss
FsPermission getFileMask() {
return FILE_MASK_ZERO;
}
-
- private Path getTestRootPath(FileContext fc) {
- return fileContextTestHelper.getTestRootPath(fc);
- }
-
- private Path getTestRootPath(FileContext fc, String pathString) {
- return fileContextTestHelper.getTestRootPath(fc, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextSymlinkBaseTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextSymlinkBaseTest.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextSymlinkBaseTest.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextSymlinkBaseTest.java Sun Dec 16 23:22:22 2012
@@ -45,8 +45,6 @@ public abstract class FileContextSymlink
protected static FileContext fc;
- private final FileContextTestHelper fileContextTestHelper;
-
abstract protected String getScheme();
abstract protected String testBaseDir1() throws IOException;
abstract protected String testBaseDir2() throws IOException;
@@ -81,16 +79,6 @@ public abstract class FileContextSymlink
CreateOpts.blockSize(blockSize));
}
- public FileContextSymlinkBaseTest() {
- this(new FileContextTestHelper());
- }
-
- public FileContextSymlinkBaseTest(
- FileContextTestHelper fileContextTestHelper) {
-
- this.fileContextTestHelper = fileContextTestHelper;
- }
-
@Before
public void setUp() throws Exception {
fc.mkdir(new Path(testBaseDir1()), FileContext.DEFAULT_PERM, true);
@@ -1365,8 +1353,4 @@ public abstract class FileContextSymlink
assertEquals(2, fc.getFileStatus(file).getModificationTime());
}
}
-
- protected String getAbsoluteTestRootDir(FileContext fc) throws IOException {
- return fileContextTestHelper.getAbsoluteTestRootDir(fc);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java Sun Dec 16 23:22:22 2012
@@ -25,7 +25,6 @@ import java.util.EnumSet;
import org.apache.hadoop.fs.Options.CreateOpts;
import org.apache.hadoop.fs.Options.CreateOpts.BlockSize;
import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.util.Shell;
import org.junit.Assert;
/**
@@ -39,16 +38,9 @@ public final class FileContextTestHelper
private static final int DEFAULT_NUM_BLOCKS = 2;
private static String absTestRootDir = null;
- private final boolean stripDriveSpec;
-
- public FileContextTestHelper() {
- this(false);
- }
+ /** Hidden constructor */
+ private FileContextTestHelper() {}
- public FileContextTestHelper(boolean stripDriveSpec) {
- this.stripDriveSpec = stripDriveSpec;
- }
-
public static int getDefaultBlockSize() {
return DEFAULT_BLOCK_SIZE;
}
@@ -60,40 +52,38 @@ public final class FileContextTestHelper
}
return data;
}
-
- public Path getTestRootPath(FileContext fc) {
- return fc.makeQualified(new Path(stripDriveSpec(TEST_ROOT_DIR,
- stripDriveSpec)));
+
+ public static Path getTestRootPath(FileContext fc) {
+ return fc.makeQualified(new Path(TEST_ROOT_DIR));
}
- public Path getTestRootPath(FileContext fc, String pathString) {
- return fc.makeQualified(new Path(
- stripDriveSpec(TEST_ROOT_DIR, stripDriveSpec), pathString));
+ public static Path getTestRootPath(FileContext fc, String pathString) {
+ return fc.makeQualified(new Path(TEST_ROOT_DIR, pathString));
}
// the getAbsolutexxx method is needed because the root test dir
// can be messed up by changing the working dir.
- public String getAbsoluteTestRootDir(FileContext fc)
+ public static String getAbsoluteTestRootDir(FileContext fc)
throws IOException {
if (absTestRootDir == null) {
- String testRootDir = stripDriveSpec(TEST_ROOT_DIR, stripDriveSpec);
- if (new Path(testRootDir).isAbsolute()) {
- absTestRootDir = testRootDir;
+ if (new Path(TEST_ROOT_DIR).isAbsolute()) {
+ absTestRootDir = TEST_ROOT_DIR;
} else {
absTestRootDir = fc.getWorkingDirectory().toString() + "/"
- + testRootDir;
+ + TEST_ROOT_DIR;
}
}
return absTestRootDir;
}
- public Path getAbsoluteTestRootPath(FileContext fc) throws IOException {
+ public static Path getAbsoluteTestRootPath(FileContext fc) throws IOException {
return fc.makeQualified(new Path(getAbsoluteTestRootDir(fc)));
}
- public Path getDefaultWorkingDirectory(FileContext fc) throws IOException {
+ public static Path getDefaultWorkingDirectory(FileContext fc)
+ throws IOException {
return getTestRootPath(fc, "/user/" + System.getProperty("user.name"))
.makeQualified(fc.getDefaultFileSystem().getUri(),
fc.getWorkingDirectory());
@@ -126,12 +116,12 @@ public final class FileContextTestHelper
return createFile(fc, path, DEFAULT_NUM_BLOCKS, CreateOpts.createParent());
}
- public long createFile(FileContext fc, String name) throws IOException {
+ public static long createFile(FileContext fc, String name) throws IOException {
Path path = getTestRootPath(fc, name);
return createFile(fc, path);
}
- public long createFileNonRecursive(FileContext fc, String name)
+ public static long createFileNonRecursive(FileContext fc, String name)
throws IOException {
Path path = getTestRootPath(fc, name);
return createFileNonRecursive(fc, path);
@@ -200,12 +190,14 @@ public final class FileContextTestHelper
return buffer;
}
- public FileStatus containsPath(FileContext fc, Path path, FileStatus[] dirList)
+ public static FileStatus containsPath(FileContext fc, Path path,
+ FileStatus[] dirList)
throws IOException {
return containsPath(getTestRootPath(fc, path.toString()), dirList);
}
- public FileStatus containsPath(Path path, FileStatus[] dirList)
+ public static FileStatus containsPath(Path path,
+ FileStatus[] dirList)
throws IOException {
for(int i = 0; i < dirList.length; i ++) {
if (path.equals(dirList[i].getPath()))
@@ -214,7 +206,7 @@ public final class FileContextTestHelper
return null;
}
- public FileStatus containsPath(FileContext fc, String path,
+ public static FileStatus containsPath(FileContext fc, String path,
FileStatus[] dirList)
throws IOException {
return containsPath(fc, new Path(path), dirList);
@@ -249,15 +241,4 @@ public final class FileContextTestHelper
}
Assert.assertEquals(aFc.makeQualified(new Path(path)), s.getPath());
}
-
- private static String stripDriveSpec(String pathString, boolean strip) {
- if (strip && Shell.WINDOWS && pathString.length() >= 2 &&
- Character.toUpperCase(pathString.charAt(0)) >= 'A' &&
- Character.toUpperCase(pathString.charAt(0)) <= 'Z' &&
- pathString.charAt(1) == ':') {
-
- return pathString.substring(2);
- }
- return pathString;
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextUtilBase.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextUtilBase.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextUtilBase.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextUtilBase.java Sun Dec 16 23:22:22 2012
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.fs;
+import static org.apache.hadoop.fs.FileContextTestHelper.getTestRootPath;
import static org.apache.hadoop.fs.FileContextTestHelper.readFile;
import static org.apache.hadoop.fs.FileContextTestHelper.writeFile;
import static org.junit.Assert.assertTrue;
@@ -44,8 +45,6 @@ import org.junit.Test;
*/
public abstract class FileContextUtilBase {
protected FileContext fc;
- private final FileContextTestHelper fileContextTestHelper =
- new FileContextTestHelper();
{
try {
@@ -106,12 +105,4 @@ public abstract class FileContextUtilBas
assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(),
readFile(fc,file2,ts.getBytes().length)));
}
-
- private Path getTestRootPath(FileContext fc) {
- return fileContextTestHelper.getTestRootPath(fc);
- }
-
- private Path getTestRootPath(FileContext fc, String pathString) {
- return fileContextTestHelper.getTestRootPath(fc, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemTestHelper.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemTestHelper.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemTestHelper.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemTestHelper.java Sun Dec 16 23:22:22 2012
@@ -25,7 +25,6 @@ import java.util.Random;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.util.Shell;
import org.junit.Assert;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
@@ -42,16 +41,8 @@ public final class FileSystemTestHelper
private static final short DEFAULT_NUM_REPL = 1;
private static String absTestRootDir = null;
- private final boolean stripDriveSpec;
-
/** Hidden constructor */
- public FileSystemTestHelper() {
- this(false);
- }
-
- public FileSystemTestHelper(boolean stripDriveSpec) {
- this.stripDriveSpec = stripDriveSpec;
- }
+ private FileSystemTestHelper() {}
public static void addFileSystemForTesting(URI uri, Configuration conf,
FileSystem fs) throws IOException {
@@ -74,17 +65,15 @@ public final class FileSystemTestHelper
/*
* get testRootPath qualified for fSys
*/
- public Path getTestRootPath(FileSystem fSys) {
- return fSys.makeQualified(new Path(stripDriveSpec(TEST_ROOT_DIR,
- this.stripDriveSpec)));
+ public static Path getTestRootPath(FileSystem fSys) {
+ return fSys.makeQualified(new Path(TEST_ROOT_DIR));
}
/*
* get testRootPath + pathString qualified for fSys
*/
- public Path getTestRootPath(FileSystem fSys, String pathString) {
- return fSys.makeQualified(new Path(
- stripDriveSpec(TEST_ROOT_DIR, this.stripDriveSpec), pathString));
+ public static Path getTestRootPath(FileSystem fSys, String pathString) {
+ return fSys.makeQualified(new Path(TEST_ROOT_DIR, pathString));
}
@@ -93,25 +82,26 @@ public final class FileSystemTestHelper
// is often relative to the working directory of process
// running the unit tests.
- String getAbsoluteTestRootDir(FileSystem fSys) throws IOException {
+ static String getAbsoluteTestRootDir(FileSystem fSys)
+ throws IOException {
// NOTE: can't cache because of different filesystems!
//if (absTestRootDir == null)
- String testRootDir = stripDriveSpec(TEST_ROOT_DIR, this.stripDriveSpec);
- if (new Path(testRootDir).isAbsolute()) {
- absTestRootDir = testRootDir;
+ if (new Path(TEST_ROOT_DIR).isAbsolute()) {
+ absTestRootDir = TEST_ROOT_DIR;
} else {
absTestRootDir = fSys.getWorkingDirectory().toString() + "/"
- + testRootDir;
+ + TEST_ROOT_DIR;
}
//}
return absTestRootDir;
}
- public Path getAbsoluteTestRootPath(FileSystem fSys) throws IOException {
+ public static Path getAbsoluteTestRootPath(FileSystem fSys) throws IOException {
return fSys.makeQualified(new Path(getAbsoluteTestRootDir(fSys)));
}
- public Path getDefaultWorkingDirectory(FileSystem fSys) throws IOException {
+ public static Path getDefaultWorkingDirectory(FileSystem fSys)
+ throws IOException {
return getTestRootPath(fSys, "/user/" + System.getProperty("user.name"))
.makeQualified(fSys.getUri(),
fSys.getWorkingDirectory());
@@ -146,7 +136,7 @@ public final class FileSystemTestHelper
return createFile(fSys, path, DEFAULT_NUM_BLOCKS, DEFAULT_BLOCK_SIZE, DEFAULT_NUM_REPL, true);
}
- public long createFile(FileSystem fSys, String name) throws IOException {
+ public static long createFile(FileSystem fSys, String name) throws IOException {
Path path = getTestRootPath(fSys, name);
return createFile(fSys, path);
}
@@ -198,7 +188,7 @@ public final class FileSystemTestHelper
return s;
}
- public FileStatus containsPath(FileSystem fSys, Path path,
+ public static FileStatus containsPath(FileSystem fSys, Path path,
FileStatus[] dirList)
throws IOException {
for(int i = 0; i < dirList.length; i ++) {
@@ -209,7 +199,8 @@ public final class FileSystemTestHelper
return null;
}
- public static FileStatus containsPath(Path path, FileStatus[] dirList)
+ public static FileStatus containsPath(Path path,
+ FileStatus[] dirList)
throws IOException {
for(int i = 0; i < dirList.length; i ++) {
if (path.equals(dirList[i].getPath()))
@@ -219,7 +210,7 @@ public final class FileSystemTestHelper
}
- public FileStatus containsPath(FileSystem fSys, String path, FileStatus[] dirList)
+ public static FileStatus containsPath(FileSystem fSys, String path, FileStatus[] dirList)
throws IOException {
return containsPath(fSys, new Path(path), dirList);
}
@@ -273,15 +264,4 @@ public final class FileSystemTestHelper
return fs.getDelegationToken(renewer);
}
}
-
- private static String stripDriveSpec(String pathString, boolean strip) {
- if (strip && Shell.WINDOWS && pathString.length() >= 2 &&
- Character.toUpperCase(pathString.charAt(0)) >= 'A' &&
- Character.toUpperCase(pathString.charAt(0)) <= 'Z' &&
- pathString.charAt(1) == ':') {
-
- return pathString.substring(2);
- }
- return pathString;
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFSMainOperationsLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFSMainOperationsLocalFileSystem.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFSMainOperationsLocalFileSystem.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFSMainOperationsLocalFileSystem.java Sun Dec 16 23:22:22 2012
@@ -52,7 +52,8 @@ public class TestFSMainOperationsLocalFi
@Test
@Override
public void testWDAbsolute() throws IOException {
- Path absoluteDir = getTestRootPath(fSys, "test/existingDir");
+ Path absoluteDir = FileSystemTestHelper.getTestRootPath(fSys,
+ "test/existingDir");
fSys.mkdirs(absoluteDir);
fSys.setWorkingDirectory(absoluteDir);
Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileContextDeleteOnExit.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileContextDeleteOnExit.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileContextDeleteOnExit.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileContextDeleteOnExit.java Sun Dec 16 23:22:22 2012
@@ -36,9 +36,6 @@ public class TestFileContextDeleteOnExit
private static int numBlocks = 2;
private FileContext fc;
-
- private final FileContextTestHelper fileContextTestHelper =
- new FileContextTestHelper();
@Before
public void setup() throws IOException {
@@ -89,12 +86,4 @@ public class TestFileContextDeleteOnExit
Assert.assertFalse(exists(fc, file2));
Assert.assertFalse(exists(fc, dir));
}
-
- private Path getTestRootPath(FileContext fc) {
- return this.fileContextTestHelper.getTestRootPath(fc);
- }
-
- private Path getTestRootPath(FileContext fc, String pathString) {
- return this.fileContextTestHelper.getTestRootPath(fc, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextSymlink.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextSymlink.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextSymlink.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFSFileContextSymlink.java Sun Dec 16 23:22:22 2012
@@ -25,6 +25,7 @@ import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.FileUtil;
+import static org.apache.hadoop.fs.FileContextTestHelper.*;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.Before;
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalFsFCStatistics.java Sun Dec 16 23:22:22 2012
@@ -25,6 +25,8 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
+import static org.apache.hadoop.fs.FileContextTestHelper.*;
+
/**
* <p>
* Tests the File Context Statistics for {@link LocalFileSystem}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFileSystem.java Sun Dec 16 23:22:22 2012
@@ -41,15 +41,12 @@ public class TestChRootedFileSystem {
FileSystem fSysTarget; //
Path chrootedTo;
- private final FileSystemTestHelper fileSystemTestHelper =
- new FileSystemTestHelper();
-
@Before
public void setUp() throws Exception {
// create the test root on local_fs
Configuration conf = new Configuration();
fSysTarget = FileSystem.getLocal(conf);
- chrootedTo = fileSystemTestHelper.getAbsoluteTestRootPath(fSysTarget);
+ chrootedTo = FileSystemTestHelper.getAbsoluteTestRootPath(fSysTarget);
// In case previous test was killed before cleanup
fSysTarget.delete(chrootedTo, true);
@@ -110,12 +107,12 @@ public class TestChRootedFileSystem {
// Create file
- fileSystemTestHelper.createFile(fSys, "/foo");
+ FileSystemTestHelper.createFile(fSys, "/foo");
Assert.assertTrue(fSys.isFile(new Path("/foo")));
Assert.assertTrue(fSysTarget.isFile(new Path(chrootedTo, "foo")));
// Create file with recursive dir
- fileSystemTestHelper.createFile(fSys, "/newDir/foo");
+ FileSystemTestHelper.createFile(fSys, "/newDir/foo");
Assert.assertTrue(fSys.isFile(new Path("/newDir/foo")));
Assert.assertTrue(fSysTarget.isFile(new Path(chrootedTo,"newDir/foo")));
@@ -125,7 +122,7 @@ public class TestChRootedFileSystem {
Assert.assertFalse(fSysTarget.exists(new Path(chrootedTo, "newDir/foo")));
// Create file with a 2 component dirs recursively
- fileSystemTestHelper.createFile(fSys, "/newDir/newDir2/foo");
+ FileSystemTestHelper.createFile(fSys, "/newDir/newDir2/foo");
Assert.assertTrue(fSys.isFile(new Path("/newDir/newDir2/foo")));
Assert.assertTrue(fSysTarget.isFile(new Path(chrootedTo,"newDir/newDir2/foo")));
@@ -138,11 +135,11 @@ public class TestChRootedFileSystem {
@Test
public void testMkdirDelete() throws IOException {
- fSys.mkdirs(fileSystemTestHelper.getTestRootPath(fSys, "/dirX"));
+ fSys.mkdirs(FileSystemTestHelper.getTestRootPath(fSys, "/dirX"));
Assert.assertTrue(fSys.isDirectory(new Path("/dirX")));
Assert.assertTrue(fSysTarget.isDirectory(new Path(chrootedTo,"dirX")));
- fSys.mkdirs(fileSystemTestHelper.getTestRootPath(fSys, "/dirX/dirY"));
+ fSys.mkdirs(FileSystemTestHelper.getTestRootPath(fSys, "/dirX/dirY"));
Assert.assertTrue(fSys.isDirectory(new Path("/dirX/dirY")));
Assert.assertTrue(fSysTarget.isDirectory(new Path(chrootedTo,"dirX/dirY")));
@@ -160,12 +157,11 @@ public class TestChRootedFileSystem {
@Test
public void testRename() throws IOException {
// Rename a file
- fileSystemTestHelper.createFile(fSys, "/newDir/foo");
+ FileSystemTestHelper.createFile(fSys, "/newDir/foo");
fSys.rename(new Path("/newDir/foo"), new Path("/newDir/fooBar"));
Assert.assertFalse(fSys.exists(new Path("/newDir/foo")));
Assert.assertFalse(fSysTarget.exists(new Path(chrootedTo,"newDir/foo")));
- Assert.assertTrue(fSys.isFile(fileSystemTestHelper.getTestRootPath(fSys,
- "/newDir/fooBar")));
+ Assert.assertTrue(fSys.isFile(FileSystemTestHelper.getTestRootPath(fSys,"/newDir/fooBar")));
Assert.assertTrue(fSysTarget.isFile(new Path(chrootedTo,"newDir/fooBar")));
@@ -174,8 +170,7 @@ public class TestChRootedFileSystem {
fSys.rename(new Path("/newDir/dirFoo"), new Path("/newDir/dirFooBar"));
Assert.assertFalse(fSys.exists(new Path("/newDir/dirFoo")));
Assert.assertFalse(fSysTarget.exists(new Path(chrootedTo,"newDir/dirFoo")));
- Assert.assertTrue(fSys.isDirectory(fileSystemTestHelper.getTestRootPath(
- fSys, "/newDir/dirFooBar")));
+ Assert.assertTrue(fSys.isDirectory(FileSystemTestHelper.getTestRootPath(fSys,"/newDir/dirFooBar")));
Assert.assertTrue(fSysTarget.isDirectory(new Path(chrootedTo,"newDir/dirFooBar")));
}
@@ -219,10 +214,10 @@ public class TestChRootedFileSystem {
- fileSystemTestHelper.createFile(fSys, "/foo");
- fileSystemTestHelper.createFile(fSys, "/bar");
+ FileSystemTestHelper.createFile(fSys, "/foo");
+ FileSystemTestHelper.createFile(fSys, "/bar");
fSys.mkdirs(new Path("/dirX"));
- fSys.mkdirs(fileSystemTestHelper.getTestRootPath(fSys, "/dirY"));
+ fSys.mkdirs(FileSystemTestHelper.getTestRootPath(fSys, "/dirY"));
fSys.mkdirs(new Path("/dirX/dirXX"));
dirPaths = fSys.listStatus(new Path("/"));
@@ -287,7 +282,7 @@ public class TestChRootedFileSystem {
/* Filesystem impls (RawLocal and DistributedFileSystem do not check
* for existing of working dir
- absoluteDir = fileSystemTestHelper.getTestRootPath(fSys, "nonexistingPath");
+ absoluteDir = getTestRootPath(fSys, "nonexistingPath");
try {
fSys.setWorkingDirectory(absoluteDir);
Assert.fail("cd to non existing dir should have failed");
@@ -312,7 +307,7 @@ public class TestChRootedFileSystem {
@Test
public void testResolvePath() throws IOException {
Assert.assertEquals(chrootedTo, fSys.resolvePath(new Path("/")));
- fileSystemTestHelper.createFile(fSys, "/foo");
+ FileSystemTestHelper.createFile(fSys, "/foo");
Assert.assertEquals(new Path(chrootedTo, "foo"),
fSys.resolvePath(new Path("/foo")));
}
@@ -364,4 +359,4 @@ public class TestChRootedFileSystem {
@Override
public void initialize(URI name, Configuration conf) throws IOException {}
}
-}
+}
\ No newline at end of file
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFs.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFs.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFs.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestChRootedFs.java Sun Dec 16 23:22:22 2012
@@ -44,14 +44,11 @@ public class TestChRootedFs {
FileContext fcTarget; //
Path chrootedTo;
- private final FileContextTestHelper fileContextTestHelper =
- new FileContextTestHelper();
-
@Before
public void setUp() throws Exception {
// create the test root on local_fs
fcTarget = FileContext.getLocalFSFileContext();
- chrootedTo = fileContextTestHelper.getAbsoluteTestRootPath(fcTarget);
+ chrootedTo = FileContextTestHelper.getAbsoluteTestRootPath(fcTarget);
// In case previous test was killed before cleanup
fcTarget.delete(chrootedTo, true);
@@ -110,12 +107,12 @@ public class TestChRootedFs {
// Create file
- fileContextTestHelper.createFileNonRecursive(fc, "/foo");
+ FileContextTestHelper.createFileNonRecursive(fc, "/foo");
Assert.assertTrue(isFile(fc, new Path("/foo")));
Assert.assertTrue(isFile(fcTarget, new Path(chrootedTo, "foo")));
// Create file with recursive dir
- fileContextTestHelper.createFile(fc, "/newDir/foo");
+ FileContextTestHelper.createFile(fc, "/newDir/foo");
Assert.assertTrue(isFile(fc, new Path("/newDir/foo")));
Assert.assertTrue(isFile(fcTarget, new Path(chrootedTo,"newDir/foo")));
@@ -125,7 +122,7 @@ public class TestChRootedFs {
Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/foo")));
// Create file with a 2 component dirs recursively
- fileContextTestHelper.createFile(fc, "/newDir/newDir2/foo");
+ FileContextTestHelper.createFile(fc, "/newDir/newDir2/foo");
Assert.assertTrue(isFile(fc, new Path("/newDir/newDir2/foo")));
Assert.assertTrue(isFile(fcTarget, new Path(chrootedTo,"newDir/newDir2/foo")));
@@ -138,13 +135,11 @@ public class TestChRootedFs {
@Test
public void testMkdirDelete() throws IOException {
- fc.mkdir(fileContextTestHelper.getTestRootPath(fc, "/dirX"),
- FileContext.DEFAULT_PERM, false);
+ fc.mkdir(FileContextTestHelper.getTestRootPath(fc, "/dirX"), FileContext.DEFAULT_PERM, false);
Assert.assertTrue(isDir(fc, new Path("/dirX")));
Assert.assertTrue(isDir(fcTarget, new Path(chrootedTo,"dirX")));
- fc.mkdir(fileContextTestHelper.getTestRootPath(fc, "/dirX/dirY"),
- FileContext.DEFAULT_PERM, false);
+ fc.mkdir(FileContextTestHelper.getTestRootPath(fc, "/dirX/dirY"), FileContext.DEFAULT_PERM, false);
Assert.assertTrue(isDir(fc, new Path("/dirX/dirY")));
Assert.assertTrue(isDir(fcTarget, new Path(chrootedTo,"dirX/dirY")));
@@ -162,12 +157,11 @@ public class TestChRootedFs {
@Test
public void testRename() throws IOException {
// Rename a file
- fileContextTestHelper.createFile(fc, "/newDir/foo");
+ FileContextTestHelper.createFile(fc, "/newDir/foo");
fc.rename(new Path("/newDir/foo"), new Path("/newDir/fooBar"));
Assert.assertFalse(exists(fc, new Path("/newDir/foo")));
Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/foo")));
- Assert.assertTrue(isFile(fc,
- fileContextTestHelper.getTestRootPath(fc,"/newDir/fooBar")));
+ Assert.assertTrue(isFile(fc, FileContextTestHelper.getTestRootPath(fc,"/newDir/fooBar")));
Assert.assertTrue(isFile(fcTarget, new Path(chrootedTo,"newDir/fooBar")));
@@ -176,8 +170,7 @@ public class TestChRootedFs {
fc.rename(new Path("/newDir/dirFoo"), new Path("/newDir/dirFooBar"));
Assert.assertFalse(exists(fc, new Path("/newDir/dirFoo")));
Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/dirFoo")));
- Assert.assertTrue(isDir(fc,
- fileContextTestHelper.getTestRootPath(fc,"/newDir/dirFooBar")));
+ Assert.assertTrue(isDir(fc, FileContextTestHelper.getTestRootPath(fc,"/newDir/dirFooBar")));
Assert.assertTrue(isDir(fcTarget, new Path(chrootedTo,"newDir/dirFooBar")));
}
@@ -211,10 +204,10 @@ public class TestChRootedFs {
- fileContextTestHelper.createFileNonRecursive(fc, "/foo");
- fileContextTestHelper.createFileNonRecursive(fc, "/bar");
+ FileContextTestHelper.createFileNonRecursive(fc, "/foo");
+ FileContextTestHelper.createFileNonRecursive(fc, "/bar");
fc.mkdir(new Path("/dirX"), FileContext.DEFAULT_PERM, false);
- fc.mkdir(fileContextTestHelper.getTestRootPath(fc, "/dirY"),
+ fc.mkdir(FileContextTestHelper.getTestRootPath(fc, "/dirY"),
FileContext.DEFAULT_PERM, false);
fc.mkdir(new Path("/dirX/dirXX"), FileContext.DEFAULT_PERM, false);
@@ -222,16 +215,16 @@ public class TestChRootedFs {
Assert.assertEquals(4, dirPaths.length);
// Note the the file status paths are the full paths on target
- fs = fileContextTestHelper.containsPath(fcTarget, "foo", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcTarget, "foo", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue(fs.isFile());
- fs = fileContextTestHelper.containsPath(fcTarget, "bar", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcTarget, "bar", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue(fs.isFile());
- fs = fileContextTestHelper.containsPath(fcTarget, "dirX", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcTarget, "dirX", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue(fs.isDirectory());
- fs = fileContextTestHelper.containsPath(fcTarget, "dirY", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcTarget, "dirY", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue(fs.isDirectory());
}
@@ -282,7 +275,7 @@ public class TestChRootedFs {
fc.mkdir(new Path("newDir"), FileContext.DEFAULT_PERM, true);
Assert.assertTrue(isDir(fc, new Path(absoluteDir, "newDir")));
- absoluteDir = fileContextTestHelper.getTestRootPath(fc, "nonexistingPath");
+ absoluteDir = getTestRootPath(fc, "nonexistingPath");
try {
fc.setWorkingDirectory(absoluteDir);
Assert.fail("cd to non existing dir should have failed");
@@ -306,7 +299,7 @@ public class TestChRootedFs {
@Test
public void testResolvePath() throws IOException {
Assert.assertEquals(chrootedTo, fc.getDefaultFileSystem().resolvePath(new Path("/")));
- fileContextTestHelper.createFile(fc, "/foo");
+ FileContextTestHelper.createFile(fc, "/foo");
Assert.assertEquals(new Path(chrootedTo, "foo"),
fc.getDefaultFileSystem().resolvePath(new Path("/foo")));
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestFSMainOperationsLocalFileSystem.java Sun Dec 16 23:22:22 2012
@@ -53,7 +53,8 @@ public class TestFSMainOperationsLocalFi
@Test
@Override
public void testWDAbsolute() throws IOException {
- Path absoluteDir = getTestRootPath(fSys, "test/existingDir");
+ Path absoluteDir = FileSystemTestHelper.getTestRootPath(fSys,
+ "test/existingDir");
fSys.mkdirs(absoluteDir);
fSys.setWorkingDirectory(absoluteDir);
Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory());
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemDelegation.java Sun Dec 16 23:22:22 2012
@@ -52,7 +52,7 @@ public class TestViewFileSystemDelegatio
conf.set("fs."+scheme+".impl", clazz.getName());
FakeFileSystem fs = (FakeFileSystem)FileSystem.get(uri, conf);
assertEquals(uri, fs.getUri());
- Path targetPath = new FileSystemTestHelper().getAbsoluteTestRootPath(fs);
+ Path targetPath = FileSystemTestHelper.getAbsoluteTestRootPath(fs);
ConfigUtil.addLink(conf, "/mounts/"+scheme, targetPath.toUri());
return fs;
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLocalFileSystem.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLocalFileSystem.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemLocalFileSystem.java Sun Dec 16 23:22:22 2012
@@ -51,7 +51,7 @@ public class TestViewFileSystemLocalFile
@Override
@After
public void tearDown() throws Exception {
- fsTarget.delete(getTestRootPath(fsTarget), true);
+ fsTarget.delete(FileSystemTestHelper.getTestRootPath(fsTarget), true);
super.tearDown();
}
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemWithAuthorityLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemWithAuthorityLocalFileSystem.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemWithAuthorityLocalFileSystem.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemWithAuthorityLocalFileSystem.java Sun Dec 16 23:22:22 2012
@@ -59,7 +59,7 @@ public class TestViewFileSystemWithAutho
@Override
@After
public void tearDown() throws Exception {
- fsTarget.delete(getTestRootPath(fsTarget), true);
+ fsTarget.delete(FileSystemTestHelper.getTestRootPath(fsTarget), true);
super.tearDown();
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsTrash.java Sun Dec 16 23:22:22 2012
@@ -36,9 +36,6 @@ public class TestViewFsTrash {
FileSystem fsView;
Configuration conf;
- private final FileSystemTestHelper fileSystemTestHelper =
- new FileSystemTestHelper();
-
static class TestLFS extends LocalFileSystem {
Path home;
TestLFS() throws IOException {
@@ -57,8 +54,8 @@ public class TestViewFsTrash {
@Before
public void setUp() throws Exception {
fsTarget = FileSystem.getLocal(new Configuration());
- fsTarget.mkdirs(new Path(fileSystemTestHelper.getTestRootPath(fsTarget),
- "dir1"));
+ fsTarget.mkdirs(new Path(FileSystemTestHelper.
+ getTestRootPath(fsTarget), "dir1"));
conf = ViewFileSystemTestSetup.createConfig();
fsView = ViewFileSystemTestSetup.setupForViewFileSystem(conf, fsTarget);
conf.set("fs.defaultFS", FsConstants.VIEWFS_URI.toString());
@@ -73,7 +70,7 @@ public class TestViewFsTrash {
@Test
public void testTrash() throws IOException {
- TestTrash.trashShell(conf, fileSystemTestHelper.getTestRootPath(fsView),
+ TestTrash.trashShell(conf, FileSystemTestHelper.getTestRootPath(fsView),
fsTarget, new Path(fsTarget.getHomeDirectory(), ".Trash/Current"));
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemBaseTest.java Sun Dec 16 23:22:22 2012
@@ -69,15 +69,6 @@ public class ViewFileSystemBaseTest {
Path targetTestRoot;
Configuration conf;
- private final FileSystemTestHelper fileSystemTestHelper;
-
- public ViewFileSystemBaseTest() {
- this(new FileSystemTestHelper());
- }
-
- public ViewFileSystemBaseTest(FileSystemTestHelper fileSystemTestHelper) {
- this.fileSystemTestHelper = fileSystemTestHelper;
- }
@Before
public void setUp() throws Exception {
@@ -103,11 +94,11 @@ public class ViewFileSystemBaseTest {
@After
public void tearDown() throws Exception {
- fsTarget.delete(getTestRootPath(fsTarget), true);
+ fsTarget.delete(FileSystemTestHelper.getTestRootPath(fsTarget), true);
}
void initializeTargetTestRoot() throws IOException {
- targetTestRoot = getAbsoluteTestRootPath(fsTarget);
+ targetTestRoot = FileSystemTestHelper.getAbsoluteTestRootPath(fsTarget);
// In case previous test was killed before cleanup
fsTarget.delete(targetTestRoot, true);
@@ -208,7 +199,7 @@ public class ViewFileSystemBaseTest {
@Test
public void testOperationsThroughMountLinks() throws IOException {
// Create file
- fileSystemTestHelper.createFile(fsView, "/user/foo");
+ FileSystemTestHelper.createFile(fsView, "/user/foo");
Assert.assertTrue("Created file should be type file",
fsView.isFile(new Path("/user/foo")));
Assert.assertTrue("Target of created file should be type file",
@@ -223,7 +214,7 @@ public class ViewFileSystemBaseTest {
fsTarget.exists(new Path(targetTestRoot,"user/foo")));
// Create file with a 2 component dirs
- fileSystemTestHelper.createFile(fsView, "/internalDir/linkToDir2/foo");
+ FileSystemTestHelper.createFile(fsView, "/internalDir/linkToDir2/foo");
Assert.assertTrue("Created file should be type file",
fsView.isFile(new Path("/internalDir/linkToDir2/foo")));
Assert.assertTrue("Target of created file should be type file",
@@ -239,15 +230,14 @@ public class ViewFileSystemBaseTest {
// Create file with a 3 component dirs
- fileSystemTestHelper.createFile(fsView,
- "/internalDir/internalDir2/linkToDir3/foo");
+ FileSystemTestHelper.createFile(fsView, "/internalDir/internalDir2/linkToDir3/foo");
Assert.assertTrue("Created file should be type file",
fsView.isFile(new Path("/internalDir/internalDir2/linkToDir3/foo")));
Assert.assertTrue("Target of created file should be type file",
fsTarget.isFile(new Path(targetTestRoot,"dir3/foo")));
// Recursive Create file with missing dirs
- fileSystemTestHelper.createFile(fsView,
+ FileSystemTestHelper.createFile(fsView,
"/internalDir/linkToDir2/missingDir/miss2/foo");
Assert.assertTrue("Created file should be type file",
fsView.isFile(new Path("/internalDir/linkToDir2/missingDir/miss2/foo")));
@@ -266,13 +256,14 @@ public class ViewFileSystemBaseTest {
// mkdir
- fsView.mkdirs(getTestRootPath(fsView, "/user/dirX"));
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX"));
Assert.assertTrue("New dir should be type dir",
fsView.isDirectory(new Path("/user/dirX")));
Assert.assertTrue("Target of new dir should be of type dir",
fsTarget.isDirectory(new Path(targetTestRoot,"user/dirX")));
- fsView.mkdirs(getTestRootPath(fsView, "/user/dirX/dirY"));
+ fsView.mkdirs(
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX/dirY"));
Assert.assertTrue("New dir should be type dir",
fsView.isDirectory(new Path("/user/dirX/dirY")));
Assert.assertTrue("Target of new dir should be of type dir",
@@ -294,14 +285,14 @@ public class ViewFileSystemBaseTest {
Assert.assertFalse(fsTarget.exists(new Path(targetTestRoot,"user/dirX")));
// Rename a file
- fileSystemTestHelper.createFile(fsView, "/user/foo");
+ FileSystemTestHelper.createFile(fsView, "/user/foo");
fsView.rename(new Path("/user/foo"), new Path("/user/fooBar"));
Assert.assertFalse("Renamed src should not exist",
fsView.exists(new Path("/user/foo")));
Assert.assertFalse("Renamed src should not exist in target",
fsTarget.exists(new Path(targetTestRoot,"user/foo")));
Assert.assertTrue("Renamed dest should exist as file",
- fsView.isFile(getTestRootPath(fsView, "/user/fooBar")));
+ fsView.isFile(FileSystemTestHelper.getTestRootPath(fsView,"/user/fooBar")));
Assert.assertTrue("Renamed dest should exist as file in target",
fsTarget.isFile(new Path(targetTestRoot,"user/fooBar")));
@@ -312,7 +303,7 @@ public class ViewFileSystemBaseTest {
Assert.assertFalse("Renamed src should not exist in target",
fsTarget.exists(new Path(targetTestRoot,"user/dirFoo")));
Assert.assertTrue("Renamed dest should exist as dir",
- fsView.isDirectory(getTestRootPath(fsView, "/user/dirFooBar")));
+ fsView.isDirectory(FileSystemTestHelper.getTestRootPath(fsView,"/user/dirFooBar")));
Assert.assertTrue("Renamed dest should exist as dir in target",
fsTarget.isDirectory(new Path(targetTestRoot,"user/dirFooBar")));
@@ -331,12 +322,12 @@ public class ViewFileSystemBaseTest {
// rename across mount points that point to same target also fail
@Test(expected=IOException.class)
public void testRenameAcrossMounts1() throws IOException {
- fileSystemTestHelper.createFile(fsView, "/user/foo");
+ FileSystemTestHelper.createFile(fsView, "/user/foo");
fsView.rename(new Path("/user/foo"), new Path("/user2/fooBarBar"));
/* - code if we had wanted this to suceed
Assert.assertFalse(fSys.exists(new Path("/user/foo")));
Assert.assertFalse(fSysLocal.exists(new Path(targetTestRoot,"user/foo")));
- Assert.assertTrue(fSys.isFile(getTestRootPath(fSys, "/user2/fooBarBar")));
+ Assert.assertTrue(fSys.isFile(FileSystemTestHelper.getTestRootPath(fSys,"/user2/fooBarBar")));
Assert.assertTrue(fSysLocal.isFile(new Path(targetTestRoot,"user/fooBarBar")));
*/
}
@@ -347,7 +338,7 @@ public class ViewFileSystemBaseTest {
@Test(expected=IOException.class)
public void testRenameAcrossMounts2() throws IOException {
- fileSystemTestHelper.createFile(fsView, "/user/foo");
+ FileSystemTestHelper.createFile(fsView, "/user/foo");
fsView.rename(new Path("/user/foo"), new Path("/data/fooBar"));
}
@@ -356,7 +347,8 @@ public class ViewFileSystemBaseTest {
@Test
public void testGetBlockLocations() throws IOException {
Path targetFilePath = new Path(targetTestRoot,"data/largeFile");
- fileSystemTestHelper.createFile(fsTarget, targetFilePath, 10, 1024);
+ FileSystemTestHelper.createFile(fsTarget,
+ targetFilePath, 10, 1024);
Path viewFilePath = new Path("/data/largeFile");
Assert.assertTrue("Created File should be type File",
fsView.isFile(viewFilePath));
@@ -402,22 +394,19 @@ public class ViewFileSystemBaseTest {
FileStatus[] dirPaths = fsView.listStatus(new Path("/"));
FileStatus fs;
Assert.assertEquals(getExpectedDirPaths(), dirPaths.length);
- fs = fileSystemTestHelper.containsPath(fsView, "/user", dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/user", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
- fs = fileSystemTestHelper.containsPath(fsView, "/data", dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/data", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
- fs = fileSystemTestHelper.containsPath(fsView, "/internalDir",
- dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/internalDir", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isDirectory());
- fs = fileSystemTestHelper.containsPath(fsView, "/danglingLink",
- dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/danglingLink", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
- fs = fileSystemTestHelper.containsPath(fsView, "/linkToAFile",
- dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/linkToAFile", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
@@ -427,12 +416,11 @@ public class ViewFileSystemBaseTest {
dirPaths = fsView.listStatus(new Path("/internalDir"));
Assert.assertEquals(2, dirPaths.length);
- fs = fileSystemTestHelper.containsPath(fsView, "/internalDir/internalDir2",
- dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/internalDir/internalDir2", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isDirectory());
- fs = fileSystemTestHelper.containsPath(fsView, "/internalDir/linkToDir2",
- dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/internalDir/linkToDir2",
+ dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
}
@@ -448,22 +436,22 @@ public class ViewFileSystemBaseTest {
Assert.assertEquals(0, dirPaths.length);
// add a file
- long len = fileSystemTestHelper.createFile(fsView, "/data/foo");
+ long len = FileSystemTestHelper.createFile(fsView, "/data/foo");
dirPaths = fsView.listStatus(new Path("/data"));
Assert.assertEquals(1, dirPaths.length);
- fs = fileSystemTestHelper.containsPath(fsView, "/data/foo", dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/data/foo", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("Created file shoudl appear as a file", fs.isFile());
Assert.assertEquals(len, fs.getLen());
// add a dir
- fsView.mkdirs(getTestRootPath(fsView, "/data/dirX"));
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/data/dirX"));
dirPaths = fsView.listStatus(new Path("/data"));
Assert.assertEquals(2, dirPaths.length);
- fs = fileSystemTestHelper.containsPath(fsView, "/data/foo", dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/data/foo", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("Created file shoudl appear as a file", fs.isFile());
- fs = fileSystemTestHelper.containsPath(fsView, "/data/dirX", dirPaths);
+ fs = FileSystemTestHelper.containsPath(fsView, "/data/dirX", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("Created dir should appear as a dir", fs.isDirectory());
}
@@ -516,16 +504,18 @@ public class ViewFileSystemBaseTest {
@Test
public void testResolvePathThroughMountPoints() throws IOException {
- fileSystemTestHelper.createFile(fsView, "/user/foo");
+ FileSystemTestHelper.createFile(fsView, "/user/foo");
Assert.assertEquals(new Path(targetTestRoot,"user/foo"),
fsView.resolvePath(new Path("/user/foo")));
- fsView.mkdirs(getTestRootPath(fsView, "/user/dirX"));
+ fsView.mkdirs(
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX"));
Assert.assertEquals(new Path(targetTestRoot,"user/dirX"),
fsView.resolvePath(new Path("/user/dirX")));
- fsView.mkdirs(getTestRootPath(fsView, "/user/dirX/dirY"));
+ fsView.mkdirs(
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX/dirY"));
Assert.assertEquals(new Path(targetTestRoot,"user/dirX/dirY"),
fsView.resolvePath(new Path("/user/dirX/dirY")));
}
@@ -543,7 +533,8 @@ public class ViewFileSystemBaseTest {
@Test(expected=FileNotFoundException.class)
public void testResolvePathMissingThroughMountPoints2() throws IOException {
- fsView.mkdirs(getTestRootPath(fsView, "/user/dirX"));
+ fsView.mkdirs(
+ FileSystemTestHelper.getTestRootPath(fsView, "/user/dirX"));
fsView.resolvePath(new Path("/user/dirX/nonExisting"));
}
@@ -559,55 +550,57 @@ public class ViewFileSystemBaseTest {
// Mkdir on existing internal mount table succeed except for /
@Test(expected=AccessControlException.class)
public void testInternalMkdirSlash() throws IOException {
- fsView.mkdirs(getTestRootPath(fsView, "/"));
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/"));
}
public void testInternalMkdirExisting1() throws IOException {
Assert.assertTrue("mkdir of existing dir should succeed",
- fsView.mkdirs(getTestRootPath(fsView, "/internalDir")));
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView,
+ "/internalDir")));
}
public void testInternalMkdirExisting2() throws IOException {
Assert.assertTrue("mkdir of existing dir should succeed",
- fsView.mkdirs(getTestRootPath(fsView, "/internalDir/linkToDir2")));
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView,
+ "/internalDir/linkToDir2")));
}
// Mkdir for new internal mount table should fail
@Test(expected=AccessControlException.class)
public void testInternalMkdirNew() throws IOException {
- fsView.mkdirs(getTestRootPath(fsView, "/dirNew"));
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/dirNew"));
}
@Test(expected=AccessControlException.class)
public void testInternalMkdirNew2() throws IOException {
- fsView.mkdirs(getTestRootPath(fsView, "/internalDir/dirNew"));
+ fsView.mkdirs(FileSystemTestHelper.getTestRootPath(fsView, "/internalDir/dirNew"));
}
// Create File on internal mount table should fail
@Test(expected=AccessControlException.class)
public void testInternalCreate1() throws IOException {
- fileSystemTestHelper.createFile(fsView, "/foo"); // 1 component
+ FileSystemTestHelper.createFile(fsView, "/foo"); // 1 component
}
@Test(expected=AccessControlException.class)
public void testInternalCreate2() throws IOException { // 2 component
- fileSystemTestHelper.createFile(fsView, "/internalDir/foo");
+ FileSystemTestHelper.createFile(fsView, "/internalDir/foo");
}
@Test(expected=AccessControlException.class)
public void testInternalCreateMissingDir() throws IOException {
- fileSystemTestHelper.createFile(fsView, "/missingDir/foo");
+ FileSystemTestHelper.createFile(fsView, "/missingDir/foo");
}
@Test(expected=AccessControlException.class)
public void testInternalCreateMissingDir2() throws IOException {
- fileSystemTestHelper.createFile(fsView, "/missingDir/miss2/foo");
+ FileSystemTestHelper.createFile(fsView, "/missingDir/miss2/foo");
}
@Test(expected=AccessControlException.class)
public void testInternalCreateMissingDir3() throws IOException {
- fileSystemTestHelper.createFile(fsView, "/internalDir/miss2/foo");
+ FileSystemTestHelper.createFile(fsView, "/internalDir/miss2/foo");
}
// Delete on internal mount table should fail
@@ -669,18 +662,4 @@ public class ViewFileSystemBaseTest {
public void testInternalSetOwner() throws IOException {
fsView.setOwner(new Path("/internalDir"), "foo", "bar");
}
-
- protected Path getAbsoluteTestRootPath(FileSystem fSys) throws IOException {
- return fileSystemTestHelper.getAbsoluteTestRootPath(fSys);
- }
-
- protected Path getTestRootPath(FileSystem fSys) throws IOException {
- return fileSystemTestHelper.getTestRootPath(fSys);
- }
-
- protected Path getTestRootPath(FileSystem fSys, String pathString)
- throws IOException {
-
- return fileSystemTestHelper.getTestRootPath(fSys, pathString);
- }
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFileSystemTestSetup.java Sun Dec 16 23:22:22 2012
@@ -50,9 +50,6 @@ public class ViewFileSystemTestSetup {
static public String ViewFSTestDir = "/testDir";
- private static final FileSystemTestHelper FILE_SYSTEM_TEST_HELPER =
- new FileSystemTestHelper();
-
/**
*
* @param fsTarget - the target fs of the view fs.
@@ -63,14 +60,14 @@ public class ViewFileSystemTestSetup {
/**
* create the test root on local_fs - the mount table will point here
*/
- Path targetOfTests = FILE_SYSTEM_TEST_HELPER.getTestRootPath(fsTarget);
+ Path targetOfTests = FileSystemTestHelper.getTestRootPath(fsTarget);
// In case previous test was killed before cleanup
fsTarget.delete(targetOfTests, true);
fsTarget.mkdirs(targetOfTests);
// Set up viewfs link for test dir as described above
- String testDir = FILE_SYSTEM_TEST_HELPER.getTestRootPath(fsTarget).toUri()
+ String testDir = FileSystemTestHelper.getTestRootPath(fsTarget).toUri()
.getPath();
linkUpFirstComponents(conf, testDir, fsTarget, "test dir");
@@ -96,7 +93,7 @@ public class ViewFileSystemTestSetup {
* delete the test directory in the target fs
*/
static public void tearDown(FileSystem fsTarget) throws Exception {
- Path targetOfTests = FILE_SYSTEM_TEST_HELPER.getTestRootPath(fsTarget);
+ Path targetOfTests = FileSystemTestHelper.getTestRootPath(fsTarget);
fsTarget.delete(targetOfTests, true);
}
Modified: hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java?rev=1422713&r1=1422712&r2=1422713&view=diff
==============================================================================
--- hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java (original)
+++ hadoop/common/branches/branch-trunk-win/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java Sun Dec 16 23:22:22 2012
@@ -76,16 +76,6 @@ public class ViewFsBaseTest {
FileContext xfcViewWithAuthority; // same as fsView but with authority
URI schemeWithAuthority;
- private final FileContextTestHelper fileContextTestHelper;
-
- public ViewFsBaseTest() {
- this(new FileContextTestHelper());
- }
-
- public ViewFsBaseTest(FileContextTestHelper fileContextTestHelper) {
- this.fileContextTestHelper = fileContextTestHelper;
- }
-
@Before
public void setUp() throws Exception {
initializeTargetTestRoot();
@@ -99,7 +89,7 @@ public class ViewFsBaseTest {
FileContext.DEFAULT_PERM, true);
fcTarget.mkdir(new Path(targetTestRoot,"dir3"),
FileContext.DEFAULT_PERM, true);
- fileContextTestHelper.createFile(fcTarget, new Path(targetTestRoot,"aFile"));
+ FileContextTestHelper.createFile(fcTarget, new Path(targetTestRoot,"aFile"));
// Now we use the mount fs to set links to user and dir
@@ -128,7 +118,7 @@ public class ViewFsBaseTest {
}
void initializeTargetTestRoot() throws IOException {
- targetTestRoot = fileContextTestHelper.getAbsoluteTestRootPath(fcTarget);
+ targetTestRoot = FileContextTestHelper.getAbsoluteTestRootPath(fcTarget);
// In case previous test was killed before cleanup
fcTarget.delete(targetTestRoot, true);
@@ -137,7 +127,7 @@ public class ViewFsBaseTest {
@After
public void tearDown() throws Exception {
- fcTarget.delete(fileContextTestHelper.getTestRootPath(fcTarget), true);
+ fcTarget.delete(FileContextTestHelper.getTestRootPath(fcTarget), true);
}
@Test
@@ -191,7 +181,7 @@ public class ViewFsBaseTest {
@Test
public void testOperationsThroughMountLinks() throws IOException {
// Create file
- fileContextTestHelper.createFileNonRecursive(fcView, "/user/foo");
+ FileContextTestHelper.createFileNonRecursive(fcView, "/user/foo");
Assert.assertTrue("Create file should be file",
isFile(fcView, new Path("/user/foo")));
Assert.assertTrue("Target of created file should be type file",
@@ -206,7 +196,7 @@ public class ViewFsBaseTest {
exists(fcTarget, new Path(targetTestRoot,"user/foo")));
// Create file with a 2 component dirs
- fileContextTestHelper.createFileNonRecursive(fcView,
+ FileContextTestHelper.createFileNonRecursive(fcView,
"/internalDir/linkToDir2/foo");
Assert.assertTrue("Created file should be type file",
isFile(fcView, new Path("/internalDir/linkToDir2/foo")));
@@ -223,7 +213,7 @@ public class ViewFsBaseTest {
// Create file with a 3 component dirs
- fileContextTestHelper.createFileNonRecursive(fcView,
+ FileContextTestHelper.createFileNonRecursive(fcView,
"/internalDir/internalDir2/linkToDir3/foo");
Assert.assertTrue("Created file should be of type file",
isFile(fcView, new Path("/internalDir/internalDir2/linkToDir3/foo")));
@@ -231,7 +221,7 @@ public class ViewFsBaseTest {
isFile(fcTarget, new Path(targetTestRoot,"dir3/foo")));
// Recursive Create file with missing dirs
- fileContextTestHelper.createFile(fcView,
+ FileContextTestHelper.createFile(fcView,
"/internalDir/linkToDir2/missingDir/miss2/foo");
Assert.assertTrue("Created file should be of type file",
isFile(fcView, new Path("/internalDir/linkToDir2/missingDir/miss2/foo")));
@@ -249,15 +239,15 @@ public class ViewFsBaseTest {
// mkdir
- fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
+ fcView.mkdir(FileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
FileContext.DEFAULT_PERM, false);
Assert.assertTrue("New dir should be type dir",
isDir(fcView, new Path("/user/dirX")));
Assert.assertTrue("Target of new dir should be of type dir",
isDir(fcTarget, new Path(targetTestRoot,"user/dirX")));
- fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView,
- "/user/dirX/dirY"), FileContext.DEFAULT_PERM, false);
+ fcView.mkdir(FileContextTestHelper.getTestRootPath(fcView, "/user/dirX/dirY"),
+ FileContext.DEFAULT_PERM, false);
Assert.assertTrue("New dir should be type dir",
isDir(fcView, new Path("/user/dirX/dirY")));
Assert.assertTrue("Target of new dir should be of type dir",
@@ -280,13 +270,13 @@ public class ViewFsBaseTest {
exists(fcTarget, new Path(targetTestRoot,"user/dirX")));
// Rename a file
- fileContextTestHelper.createFile(fcView, "/user/foo");
+ FileContextTestHelper.createFile(fcView, "/user/foo");
fcView.rename(new Path("/user/foo"), new Path("/user/fooBar"));
Assert.assertFalse("Renamed src should not exist",
exists(fcView, new Path("/user/foo")));
Assert.assertFalse(exists(fcTarget, new Path(targetTestRoot,"user/foo")));
Assert.assertTrue(isFile(fcView,
- fileContextTestHelper.getTestRootPath(fcView,"/user/fooBar")));
+ FileContextTestHelper.getTestRootPath(fcView,"/user/fooBar")));
Assert.assertTrue(isFile(fcTarget, new Path(targetTestRoot,"user/fooBar")));
fcView.mkdir(new Path("/user/dirFoo"), FileContext.DEFAULT_PERM, false);
@@ -297,7 +287,7 @@ public class ViewFsBaseTest {
exists(fcTarget, new Path(targetTestRoot,"user/dirFoo")));
Assert.assertTrue("Renamed dest should exist as dir",
isDir(fcView,
- fileContextTestHelper.getTestRootPath(fcView,"/user/dirFooBar")));
+ FileContextTestHelper.getTestRootPath(fcView,"/user/dirFooBar")));
Assert.assertTrue("Renamed dest should exist as dir in target",
isDir(fcTarget,new Path(targetTestRoot,"user/dirFooBar")));
@@ -319,13 +309,13 @@ public class ViewFsBaseTest {
// rename across mount points that point to same target also fail
@Test(expected=IOException.class)
public void testRenameAcrossMounts1() throws IOException {
- fileContextTestHelper.createFile(fcView, "/user/foo");
+ FileContextTestHelper.createFile(fcView, "/user/foo");
fcView.rename(new Path("/user/foo"), new Path("/user2/fooBarBar"));
/* - code if we had wanted this to succeed
Assert.assertFalse(exists(fc, new Path("/user/foo")));
Assert.assertFalse(exists(fclocal, new Path(targetTestRoot,"user/foo")));
Assert.assertTrue(isFile(fc,
- fileContextTestHelper.getTestRootPath(fc,"/user2/fooBarBar")));
+ FileContextTestHelper.getTestRootPath(fc,"/user2/fooBarBar")));
Assert.assertTrue(isFile(fclocal,
new Path(targetTestRoot,"user/fooBarBar")));
*/
@@ -337,7 +327,7 @@ public class ViewFsBaseTest {
@Test(expected=IOException.class)
public void testRenameAcrossMounts2() throws IOException {
- fileContextTestHelper.createFile(fcView, "/user/foo");
+ FileContextTestHelper.createFile(fcView, "/user/foo");
fcView.rename(new Path("/user/foo"), new Path("/data/fooBar"));
}
@@ -349,7 +339,7 @@ public class ViewFsBaseTest {
@Test
public void testGetBlockLocations() throws IOException {
Path targetFilePath = new Path(targetTestRoot,"data/largeFile");
- fileContextTestHelper.createFile(fcTarget, targetFilePath, 10, 1024);
+ FileContextTestHelper.createFile(fcTarget, targetFilePath, 10, 1024);
Path viewFilePath = new Path("/data/largeFile");
checkFileStatus(fcView, viewFilePath.toString(), fileType.isFile);
BlockLocation[] viewBL = fcView.getFileBlockLocations(viewFilePath,
@@ -392,19 +382,19 @@ public class ViewFsBaseTest {
FileStatus[] dirPaths = fcView.util().listStatus(new Path("/"));
FileStatus fs;
Assert.assertEquals(7, dirPaths.length);
- fs = fileContextTestHelper.containsPath(fcView, "/user", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcView, "/user", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
- fs = fileContextTestHelper.containsPath(fcView, "/data", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcView, "/data", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
- fs = fileContextTestHelper.containsPath(fcView, "/internalDir", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcView, "/internalDir", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("InternalDirs should appear as dir", fs.isDirectory());
- fs = fileContextTestHelper.containsPath(fcView, "/danglingLink", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcView, "/danglingLink", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
- fs = fileContextTestHelper.containsPath(fcView, "/linkToAFile", dirPaths);
+ fs = FileContextTestHelper.containsPath(fcView, "/linkToAFile", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
@@ -414,12 +404,12 @@ public class ViewFsBaseTest {
dirPaths = fcView.util().listStatus(new Path("/internalDir"));
Assert.assertEquals(2, dirPaths.length);
- fs = fileContextTestHelper.containsPath(fcView,
+ fs = FileContextTestHelper.containsPath(fcView,
"/internalDir/internalDir2", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("InternalDirs should appear as dir",fs.isDirectory());
- fs = fileContextTestHelper.containsPath(fcView, "/internalDir/linkToDir2",
- dirPaths);
+ fs = FileContextTestHelper.containsPath(fcView,
+ "/internalDir/linkToDir2", dirPaths);
Assert.assertNotNull(fs);
Assert.assertTrue("A mount should appear as symlink", fs.isSymlink());
}
@@ -544,19 +534,19 @@ public class ViewFsBaseTest {
@Test
public void testResolvePathThroughMountPoints() throws IOException {
- fileContextTestHelper.createFile(fcView, "/user/foo");
+ FileContextTestHelper.createFile(fcView, "/user/foo");
Assert.assertEquals(new Path(targetTestRoot,"user/foo"),
fcView.resolvePath(new Path("/user/foo")));
fcView.mkdir(
- fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
+ FileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
FileContext.DEFAULT_PERM, false);
Assert.assertEquals(new Path(targetTestRoot,"user/dirX"),
fcView.resolvePath(new Path("/user/dirX")));
fcView.mkdir(
- fileContextTestHelper.getTestRootPath(fcView, "/user/dirX/dirY"),
+ FileContextTestHelper.getTestRootPath(fcView, "/user/dirX/dirY"),
FileContext.DEFAULT_PERM, false);
Assert.assertEquals(new Path(targetTestRoot,"user/dirX/dirY"),
fcView.resolvePath(new Path("/user/dirX/dirY")));
@@ -576,7 +566,7 @@ public class ViewFsBaseTest {
@Test(expected=FileNotFoundException.class)
public void testResolvePathMissingThroughMountPoints2() throws IOException {
fcView.mkdir(
- fileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
+ FileContextTestHelper.getTestRootPath(fcView, "/user/dirX"),
FileContext.DEFAULT_PERM, false);
fcView.resolvePath(new Path("/user/dirX/nonExisting"));
}
@@ -594,58 +584,58 @@ public class ViewFsBaseTest {
// Mkdir on internal mount table should fail
@Test(expected=AccessControlException.class)
public void testInternalMkdirSlash() throws IOException {
- fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/"),
+ fcView.mkdir(FileContextTestHelper.getTestRootPath(fcView, "/"),
FileContext.DEFAULT_PERM, false);
}
@Test(expected=AccessControlException.class)
public void testInternalMkdirExisting1() throws IOException {
- fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/internalDir"),
- FileContext.DEFAULT_PERM, false);
+ fcView.mkdir(FileContextTestHelper.getTestRootPath(fcView, "/internalDir"),
+ FileContext.DEFAULT_PERM, false);
}
@Test(expected=AccessControlException.class)
public void testInternalMkdirExisting2() throws IOException {
- fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView,
+ fcView.mkdir(FileContextTestHelper.getTestRootPath(fcView,
"/internalDir/linkToDir2"),
FileContext.DEFAULT_PERM, false);
}
@Test(expected=AccessControlException.class)
public void testInternalMkdirNew() throws IOException {
- fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView, "/dirNew"),
+ fcView.mkdir(FileContextTestHelper.getTestRootPath(fcView, "/dirNew"),
FileContext.DEFAULT_PERM, false);
}
@Test(expected=AccessControlException.class)
public void testInternalMkdirNew2() throws IOException {
- fcView.mkdir(fileContextTestHelper.getTestRootPath(fcView,
- "/internalDir/dirNew"), FileContext.DEFAULT_PERM, false);
+ fcView.mkdir(FileContextTestHelper.getTestRootPath(fcView, "/internalDir/dirNew"),
+ FileContext.DEFAULT_PERM, false);
}
// Create on internal mount table should fail
@Test(expected=AccessControlException.class)
public void testInternalCreate1() throws IOException {
- fileContextTestHelper.createFileNonRecursive(fcView, "/foo"); // 1 component
+ FileContextTestHelper.createFileNonRecursive(fcView, "/foo"); // 1 component
}
@Test(expected=AccessControlException.class)
public void testInternalCreate2() throws IOException { // 2 component
- fileContextTestHelper.createFileNonRecursive(fcView, "/internalDir/foo");
+ FileContextTestHelper.createFileNonRecursive(fcView, "/internalDir/foo");
}
@Test(expected=AccessControlException.class)
public void testInternalCreateMissingDir() throws IOException {
- fileContextTestHelper.createFile(fcView, "/missingDir/foo");
+ FileContextTestHelper.createFile(fcView, "/missingDir/foo");
}
@Test(expected=AccessControlException.class)
public void testInternalCreateMissingDir2() throws IOException {
- fileContextTestHelper.createFile(fcView, "/missingDir/miss2/foo");
+ FileContextTestHelper.createFile(fcView, "/missingDir/miss2/foo");
}
@Test(expected=AccessControlException.class)
public void testInternalCreateMissingDir3() throws IOException {
- fileContextTestHelper.createFile(fcView, "/internalDir/miss2/foo");
+ FileContextTestHelper.createFile(fcView, "/internalDir/miss2/foo");
}
// Delete on internal mount table should fail