HDFS-10415. TestDistributedFileSystem#MyDistributedFileSystem attempts to set up statistics before initialize() is called (Mingliang Liu via cmccabe)
This commit is contained in:
parent
f7189d6a1c
commit
14907d9b8c
|
@ -229,13 +229,19 @@ public class TestDistributedFileSystem {
|
||||||
|
|
||||||
private static class MyDistributedFileSystem extends DistributedFileSystem {
|
private static class MyDistributedFileSystem extends DistributedFileSystem {
|
||||||
MyDistributedFileSystem() {
|
MyDistributedFileSystem() {
|
||||||
statistics = new FileSystem.Statistics("myhdfs"); // can't mock finals
|
|
||||||
dfs = mock(DFSClient.class);
|
dfs = mock(DFSClient.class);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(Path p) {
|
public boolean exists(Path p) {
|
||||||
return true; // trick out deleteOnExit
|
return true; // trick out deleteOnExit
|
||||||
}
|
}
|
||||||
|
// Symlink resolution doesn't work with a mock, since it doesn't
|
||||||
|
// have a valid Configuration to resolve paths to the right FileSystem.
|
||||||
|
// Just call the DFSClient directly to register the delete
|
||||||
|
@Override
|
||||||
|
public boolean delete(Path f, final boolean recursive) throws IOException {
|
||||||
|
return dfs.delete(f.toUri().getPath(), recursive);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue