HADOOP-13928. TestAdlFileContextMainOperationsLive.testGetFileContext1 runtime error. (John Zhuge via lei)
This commit is contained in:
parent
2604e82eba
commit
ed09c1418d
|
@ -160,7 +160,7 @@ public abstract class DelegateToFileSystem extends AbstractFileSystem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getUriDefaultPort() {
|
public int getUriDefaultPort() {
|
||||||
return DELEGATE_TO_FS_DEFAULT_PORT;
|
return getDefaultPortIfDefined(fsImpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,19 +33,29 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public class TestDelegateToFsCheckPath {
|
public class TestDelegateToFsCheckPath {
|
||||||
@Test
|
@Test
|
||||||
public void testCheckPathWithoutDefaultPorts() throws URISyntaxException,
|
public void testCheckPathWithoutDefaultPort() throws URISyntaxException,
|
||||||
IOException {
|
IOException {
|
||||||
URI uri = new URI("dummy://dummy-host");
|
URI uri = new URI("dummy://dummy-host");
|
||||||
AbstractFileSystem afs = new DummyDelegateToFileSystem(uri);
|
AbstractFileSystem afs = new DummyDelegateToFileSystem(uri,
|
||||||
|
new UnOverrideDefaultPortFileSystem());
|
||||||
afs.checkPath(new Path("dummy://dummy-host"));
|
afs.checkPath(new Path("dummy://dummy-host"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCheckPathWithDefaultPort() throws URISyntaxException,
|
||||||
|
IOException {
|
||||||
|
URI uri = new URI(String.format("dummy://dummy-host:%d",
|
||||||
|
OverrideDefaultPortFileSystem.DEFAULT_PORT));
|
||||||
|
AbstractFileSystem afs = new DummyDelegateToFileSystem(uri,
|
||||||
|
new OverrideDefaultPortFileSystem());
|
||||||
|
afs.checkPath(new Path("dummy://dummy-host/user/john/test"));
|
||||||
|
}
|
||||||
|
|
||||||
private static class DummyDelegateToFileSystem
|
private static class DummyDelegateToFileSystem
|
||||||
extends DelegateToFileSystem {
|
extends DelegateToFileSystem {
|
||||||
public DummyDelegateToFileSystem(URI uri) throws URISyntaxException,
|
public DummyDelegateToFileSystem(URI uri, FileSystem fs)
|
||||||
IOException {
|
throws URISyntaxException, IOException {
|
||||||
super(uri, new UnOverrideDefaultPortFileSystem(), new Configuration(),
|
super(uri, fs, new Configuration(), "dummy", false);
|
||||||
"dummy", false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,4 +133,17 @@ public class TestDelegateToFsCheckPath {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OverrideDefaultPortFileSystem defines default port.
|
||||||
|
*/
|
||||||
|
private static class OverrideDefaultPortFileSystem
|
||||||
|
extends UnOverrideDefaultPortFileSystem {
|
||||||
|
private static final int DEFAULT_PORT = 1234;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDefaultPort() {
|
||||||
|
return DEFAULT_PORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue