From 23fb417305736cb2feba1e71a15ca54cfc12379b Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Wed, 26 Oct 2011 18:59:30 +0000 Subject: [PATCH] svn merge -c 1166009 from trunk for HDFS-2284. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1189384 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop-common/src/main/resources/core-default.xml | 5 +++++ .../org/apache/hadoop/fs/FSMainOperationsBaseTest.java | 10 +++++----- .../apache/hadoop/fs/FileSystemContractBaseTest.java | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml index 01b08400da7..e5809a107d7 100644 --- a/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml +++ b/hadoop-common-project/hadoop-common/src/main/resources/core-default.xml @@ -317,6 +317,11 @@ org.apache.hadoop.hdfs.HsftpFileSystem + + fs.webhdfs.impl + org.apache.hadoop.hdfs.web.WebHdfsFileSystem + + fs.ftp.impl org.apache.hadoop.fs.ftp.FTPFileSystem diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java index 9205f640ec6..6b3963b41ad 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FSMainOperationsBaseTest.java @@ -32,6 +32,7 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mortbay.log.Log; import static org.apache.hadoop.fs.FileSystemTestHelper.*; @@ -62,8 +63,6 @@ public abstract class FSMainOperationsBaseTest { private static String TEST_DIR_AXX = "test/hadoop/axx"; private static int numBlocks = 2; - static final String LOCAL_FS_ROOT_URI = "file:///tmp/test"; - protected static FileSystem fSys; @@ -83,7 +82,7 @@ public abstract class FSMainOperationsBaseTest { } }; - private static byte[] data = getFileData(numBlocks, + protected static final byte[] data = getFileData(numBlocks, getDefaultBlockSize()); @Before @@ -183,7 +182,7 @@ public abstract class FSMainOperationsBaseTest { @Test public void testWDAbsolute() throws IOException { - Path absoluteDir = new Path(LOCAL_FS_ROOT_URI + "/existingDir"); + Path absoluteDir = new Path(fSys.getUri() + "/test/existingDir"); fSys.mkdirs(absoluteDir); fSys.setWorkingDirectory(absoluteDir); Assert.assertEquals(absoluteDir, fSys.getWorkingDirectory()); @@ -646,7 +645,7 @@ public abstract class FSMainOperationsBaseTest { writeReadAndDelete(getDefaultBlockSize() * 2); } - private void writeReadAndDelete(int len) throws IOException { + protected void writeReadAndDelete(int len) throws IOException { Path path = getTestRootPath(fSys, "test/hadoop/file"); fSys.mkdirs(path.getParent()); @@ -768,6 +767,7 @@ public abstract class FSMainOperationsBaseTest { rename(src, dst, false, false, false, Rename.NONE); Assert.fail("Should throw FileNotFoundException"); } catch (IOException e) { + Log.info("XXX", e); Assert.assertTrue(unwrapException(e) instanceof FileNotFoundException); } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java index 8b37f2aa6aa..94c4b0c31fa 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java @@ -45,7 +45,7 @@ import org.apache.hadoop.fs.Path; public abstract class FileSystemContractBaseTest extends TestCase { protected FileSystem fs; - private byte[] data = new byte[getBlockSize() * 2]; // two blocks of data + protected byte[] data = new byte[getBlockSize() * 2]; // two blocks of data { for (int i = 0; i < data.length; i++) { data[i] = (byte) (i % 10); @@ -215,7 +215,7 @@ public abstract class FileSystemContractBaseTest extends TestCase { writeReadAndDelete(getBlockSize() * 2); } - private void writeReadAndDelete(int len) throws IOException { + protected void writeReadAndDelete(int len) throws IOException { Path path = path("/test/hadoop/file"); fs.mkdirs(path.getParent()); @@ -256,7 +256,7 @@ public abstract class FileSystemContractBaseTest extends TestCase { assertEquals("Length", data.length, fs.getFileStatus(path).getLen()); try { - fs.create(path, false); + fs.create(path, false).close(); fail("Should throw IOException."); } catch (IOException e) { // Expected