From 1d6793d0b7e26a792507a458cbe4b298ad84881e Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Wed, 7 Sep 2011 06:05:04 +0000 Subject: [PATCH] Commit the test and the conf changes in common for HDFS-2284. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1166009 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 8fc6017f6d..d4b4030559 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 9205f640ec..6b3963b41a 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.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 boolean accept(Path file) { } }; - private static byte[] data = getFileData(numBlocks, + protected static final byte[] data = getFileData(numBlocks, getDefaultBlockSize()); @Before @@ -183,7 +182,7 @@ public void testWorkingDirectory() throws Exception { @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 void testWriteReadAndDeleteTwoBlocks() throws Exception { 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 void testRenameNonExistentPath() throws Exception { 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 8b37f2aa6a..94c4b0c31f 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 @@ 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 void testWriteReadAndDeleteTwoBlocks() throws Exception { 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 void testOverwrite() throws IOException { 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