http://git-wip-us.apache.org/repos/asf/hadoop/blob/860d49aa/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/filesystem.md ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/filesystem.md b/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/filesystem.md index b18b5f6..201d397 100644 --- a/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/filesystem.md +++ b/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/filesystem.md @@ -419,7 +419,7 @@ If the filesystem is not location aware, it SHOULD return BlockLocation(["localhost:9866"] , ["localhost"], ["/default/localhost"] - 0, F.getLen()) + 0, f.getLen()) ] ;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/860d49aa/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDefaultUri.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDefaultUri.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDefaultUri.java index f232735..b84d66a 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDefaultUri.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDefaultUri.java @@ -21,14 +21,14 @@ import static org.apache.hadoop.fs.FileSystem.FS_DEFAULT_NAME_KEY; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; import java.io.IOException; import java.net.URI; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.test.GenericTestUtils; + import org.junit.Test; +import static org.apache.hadoop.test.LambdaTestUtils.*; /** * Test default URI related APIs in {@link FileSystem}. @@ -69,15 +69,12 @@ public class TestDefaultUri { } @Test - public void tetGetDefaultUriNoSchemeTrailingSlash() { + public void tetGetDefaultUriNoSchemeTrailingSlash() throws Exception { conf.set(FS_DEFAULT_NAME_KEY, "nn_host/"); - try { - FileSystem.getDefaultUri(conf); - fail("Expect IAE: No scheme in default FS"); - } catch (IllegalArgumentException e) { - GenericTestUtils.assertExceptionContains( - "No scheme in default FS", e); - } + intercept(IllegalArgumentException.class, + "No scheme in default FS", + () -> FileSystem.getDefaultUri(conf)); + } @Test @@ -88,28 +85,19 @@ public class TestDefaultUri { } @Test - public void tetFsGetNoScheme() throws IOException { + public void tetFsGetNoScheme() throws Exception { // Bare host name or address indicates hdfs scheme conf.set(FS_DEFAULT_NAME_KEY, "nn_host"); - try { - FileSystem.get(conf); - fail("Expect IOE: No FileSystem for scheme: hdfs"); - } catch (IOException e) { - GenericTestUtils.assertExceptionContains( - "No FileSystem for scheme: hdfs", e); - } + intercept(UnsupportedFileSystemException.class, "hdfs", + () -> FileSystem.get(conf)); } @Test - public void tetFsGetNoSchemeTrailingSlash() throws IOException { + public void tetFsGetNoSchemeTrailingSlash() throws Exception { // Bare host name or address with trailing slash is invalid conf.set(FS_DEFAULT_NAME_KEY, "nn_host/"); - try { - FileSystem.get(conf); - fail("Expect IAE: No scheme in default FS"); - } catch (IllegalArgumentException e) { - GenericTestUtils.assertExceptionContains( - "No scheme in default FS", e); - } + intercept(IllegalArgumentException.class, + "No scheme in default FS", + () -> FileSystem.get(conf)); } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/860d49aa/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemCaching.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemCaching.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemCaching.java index 07b07dc..69ef71e 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemCaching.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemCaching.java @@ -95,16 +95,14 @@ public class TestFileSystemCaching { try { fs = FileSystem.get(URI.create("//host"), conf); fail("got fs with auth but no scheme"); - } catch (Exception e) { - assertEquals("No FileSystem for scheme: null", e.getMessage()); + } catch (UnsupportedFileSystemException e) { } - + // no scheme, different auth try { fs = FileSystem.get(URI.create("//host2"), conf); fail("got fs with auth but no scheme"); - } catch (Exception e) { - assertEquals("No FileSystem for scheme: null", e.getMessage()); + } catch (UnsupportedFileSystemException e) { } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
