HADOOP-13605. Clean up FileSystem javadocs, logging; improve diagnostics on FS load. Contributed by Steve Loughran
This commit is contained in:
parent
de4894936a
commit
860d49aa6a
File diff suppressed because it is too large
Load Diff
|
@ -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())
|
||||
] ;
|
||||
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue