HDFS-11116. Fix javac warnings caused by deprecation of APIs in TestViewFsDefaultValue. Contributed by Yiqun Lin.
This commit is contained in:
parent
93eeb13164
commit
8848a8a76c
@ -681,9 +681,13 @@ public short getDefaultReplication(Path f) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FsServerDefaults getServerDefaults(Path f) throws IOException {
|
public FsServerDefaults getServerDefaults(Path f) throws IOException {
|
||||||
|
try {
|
||||||
InodeTree.ResolveResult<FileSystem> res =
|
InodeTree.ResolveResult<FileSystem> res =
|
||||||
fsState.resolve(getUriPath(f), true);
|
fsState.resolve(getUriPath(f), true);
|
||||||
return res.targetFileSystem.getServerDefaults(res.remainingPath);
|
return res.targetFileSystem.getServerDefaults(res.remainingPath);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new NotInMountpointException(f, "getServerDefaults");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,6 +63,7 @@ public class TestViewFsDefaultValue {
|
|||||||
|
|
||||||
static final String testFileDir = "/tmp/test/";
|
static final String testFileDir = "/tmp/test/";
|
||||||
static final String testFileName = testFileDir + "testFileStatusSerialziation";
|
static final String testFileName = testFileDir + "testFileStatusSerialziation";
|
||||||
|
static final String NOT_IN_MOUNTPOINT_FILENAME = "/NotInMountpointFile";
|
||||||
private static MiniDFSCluster cluster;
|
private static MiniDFSCluster cluster;
|
||||||
private static final FileSystemTestHelper fileSystemTestHelper = new FileSystemTestHelper();
|
private static final FileSystemTestHelper fileSystemTestHelper = new FileSystemTestHelper();
|
||||||
private static final Configuration CONF = new Configuration();
|
private static final Configuration CONF = new Configuration();
|
||||||
@ -70,6 +71,8 @@ public class TestViewFsDefaultValue {
|
|||||||
private static FileSystem vfs;
|
private static FileSystem vfs;
|
||||||
private static Path testFilePath;
|
private static Path testFilePath;
|
||||||
private static Path testFileDirPath;
|
private static Path testFileDirPath;
|
||||||
|
// Use NotInMountpoint path to trigger the exception
|
||||||
|
private static Path notInMountpointPath;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void clusterSetupAtBegining() throws IOException,
|
public static void clusterSetupAtBegining() throws IOException,
|
||||||
@ -86,12 +89,14 @@ public static void clusterSetupAtBegining() throws IOException,
|
|||||||
cluster.waitClusterUp();
|
cluster.waitClusterUp();
|
||||||
fHdfs = cluster.getFileSystem();
|
fHdfs = cluster.getFileSystem();
|
||||||
fileSystemTestHelper.createFile(fHdfs, testFileName);
|
fileSystemTestHelper.createFile(fHdfs, testFileName);
|
||||||
|
fileSystemTestHelper.createFile(fHdfs, NOT_IN_MOUNTPOINT_FILENAME);
|
||||||
Configuration conf = ViewFileSystemTestSetup.createConfig();
|
Configuration conf = ViewFileSystemTestSetup.createConfig();
|
||||||
ConfigUtil.addLink(conf, "/tmp", new URI(fHdfs.getUri().toString() +
|
ConfigUtil.addLink(conf, "/tmp", new URI(fHdfs.getUri().toString() +
|
||||||
"/tmp"));
|
"/tmp"));
|
||||||
vfs = FileSystem.get(FsConstants.VIEWFS_URI, conf);
|
vfs = FileSystem.get(FsConstants.VIEWFS_URI, conf);
|
||||||
testFileDirPath = new Path (testFileDir);
|
testFileDirPath = new Path (testFileDir);
|
||||||
testFilePath = new Path (testFileName);
|
testFilePath = new Path (testFileName);
|
||||||
|
notInMountpointPath = new Path(NOT_IN_MOUNTPOINT_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,7 +110,7 @@ public void testGetDefaultBlockSize()
|
|||||||
// but we are only looking at the defaultBlockSize, so this
|
// but we are only looking at the defaultBlockSize, so this
|
||||||
// test should still pass
|
// test should still pass
|
||||||
try {
|
try {
|
||||||
vfs.getDefaultBlockSize();
|
vfs.getDefaultBlockSize(notInMountpointPath);
|
||||||
fail("getServerDefaults on viewFs did not throw excetion!");
|
fail("getServerDefaults on viewFs did not throw excetion!");
|
||||||
} catch (NotInMountpointException e) {
|
} catch (NotInMountpointException e) {
|
||||||
assertEquals(vfs.getDefaultBlockSize(testFilePath),
|
assertEquals(vfs.getDefaultBlockSize(testFilePath),
|
||||||
@ -120,7 +125,7 @@ public void testGetDefaultBlockSize()
|
|||||||
public void testGetDefaultReplication()
|
public void testGetDefaultReplication()
|
||||||
throws IOException, URISyntaxException {
|
throws IOException, URISyntaxException {
|
||||||
try {
|
try {
|
||||||
vfs.getDefaultReplication();
|
vfs.getDefaultReplication(notInMountpointPath);
|
||||||
fail("getDefaultReplication on viewFs did not throw excetion!");
|
fail("getDefaultReplication on viewFs did not throw excetion!");
|
||||||
} catch (NotInMountpointException e) {
|
} catch (NotInMountpointException e) {
|
||||||
assertEquals(vfs.getDefaultReplication(testFilePath),
|
assertEquals(vfs.getDefaultReplication(testFilePath),
|
||||||
@ -135,7 +140,7 @@ public void testGetDefaultReplication()
|
|||||||
@Test
|
@Test
|
||||||
public void testServerDefaults() throws IOException {
|
public void testServerDefaults() throws IOException {
|
||||||
try {
|
try {
|
||||||
FsServerDefaults serverDefaults = vfs.getServerDefaults();
|
vfs.getServerDefaults(notInMountpointPath);
|
||||||
fail("getServerDefaults on viewFs did not throw excetion!");
|
fail("getServerDefaults on viewFs did not throw excetion!");
|
||||||
} catch (NotInMountpointException e) {
|
} catch (NotInMountpointException e) {
|
||||||
FsServerDefaults serverDefaults = vfs.getServerDefaults(testFilePath);
|
FsServerDefaults serverDefaults = vfs.getServerDefaults(testFilePath);
|
||||||
@ -215,6 +220,7 @@ public void testGetQuotaUsageWithQuotaDefined() throws IOException {
|
|||||||
@AfterClass
|
@AfterClass
|
||||||
public static void cleanup() throws IOException {
|
public static void cleanup() throws IOException {
|
||||||
fHdfs.delete(new Path(testFileName), true);
|
fHdfs.delete(new Path(testFileName), true);
|
||||||
|
fHdfs.delete(notInMountpointPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user