HADOOP-14192. Aliyun OSS FileSystem contract test should implement getTestBaseDir(). Contributed by Mingliang Liu

This commit is contained in:
Mingliang Liu 2017-03-16 15:24:46 -07:00
parent 7536815039
commit 86035c1644
1 changed files with 4 additions and 31 deletions

View File

@ -38,8 +38,8 @@ import java.io.IOException;
public class TestAliyunOSSFileSystemContract public class TestAliyunOSSFileSystemContract
extends FileSystemContractBaseTest { extends FileSystemContractBaseTest {
public static final String TEST_FS_OSS_NAME = "test.fs.oss.name"; public static final String TEST_FS_OSS_NAME = "test.fs.oss.name";
private static String testRootPath = private static Path testRootPath =
AliyunOSSTestUtils.generateUniqueTestPath(); new Path(AliyunOSSTestUtils.generateUniqueTestPath());
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {
@ -49,20 +49,8 @@ public class TestAliyunOSSFileSystemContract
} }
@Override @Override
public void tearDown() throws Exception { public Path getTestBaseDir() {
if (fs != null) { return testRootPath;
fs.delete(super.path(testRootPath), true);
}
super.tearDown();
}
@Override
protected Path path(String path) {
if (path.startsWith("/")) {
return super.path(testRootPath + path);
} else {
return super.path(testRootPath + "/" + path);
}
} }
@Override @Override
@ -228,19 +216,4 @@ public class TestAliyunOSSFileSystemContract
} }
} }
public void testWorkingDirectory() throws Exception {
Path workDir = super.path(this.getDefaultWorkingDirectory());
assertEquals(workDir, this.fs.getWorkingDirectory());
this.fs.setWorkingDirectory(super.path("."));
assertEquals(workDir, this.fs.getWorkingDirectory());
this.fs.setWorkingDirectory(super.path(".."));
assertEquals(workDir.getParent(), this.fs.getWorkingDirectory());
Path relativeDir = super.path("hadoop");
this.fs.setWorkingDirectory(relativeDir);
assertEquals(relativeDir, this.fs.getWorkingDirectory());
Path absoluteDir = super.path("/test/hadoop");
this.fs.setWorkingDirectory(absoluteDir);
assertEquals(absoluteDir, this.fs.getWorkingDirectory());
}
} }