hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject [02/50] hadoop git commit: HDFS-11116. Fix javac warnings caused by deprecation of APIs in TestViewFsDefaultValue. Contributed by Yiqun Lin.
Date Thu, 17 Nov 2016 02:02:04 GMT
HDFS-11116. Fix javac warnings caused by deprecation of APIs in TestViewFsDefaultValue. Contributed
by Yiqun Lin.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8848a8a7
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8848a8a7
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8848a8a7

Branch: refs/heads/YARN-4752
Commit: 8848a8a76c7eadebb15b347171057f906f6fc69b
Parents: 93eeb13
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Fri Nov 11 13:44:10 2016 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Fri Nov 11 13:45:30 2016 +0900

----------------------------------------------------------------------
 .../org/apache/hadoop/fs/viewfs/ViewFileSystem.java     | 10 +++++++---
 .../apache/hadoop/fs/viewfs/TestViewFsDefaultValue.java | 12 +++++++++---
 2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8848a8a7/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
index acafc6c..e2ebe1b 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java
@@ -681,9 +681,13 @@ public class ViewFileSystem extends FileSystem {
 
   @Override
   public FsServerDefaults getServerDefaults(Path f) throws IOException {
-    InodeTree.ResolveResult<FileSystem> res =
-      fsState.resolve(getUriPath(f), true);
-    return res.targetFileSystem.getServerDefaults(res.remainingPath);    
+    try {
+      InodeTree.ResolveResult<FileSystem> res =
+          fsState.resolve(getUriPath(f), true);
+      return res.targetFileSystem.getServerDefaults(res.remainingPath);
+    } catch (FileNotFoundException e) {
+      throw new NotInMountpointException(f, "getServerDefaults");
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8848a8a7/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsDefaultValue.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsDefaultValue.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsDefaultValue.java
index 8d7d2da..03e19f6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsDefaultValue.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsDefaultValue.java
@@ -63,6 +63,7 @@ public class TestViewFsDefaultValue {
   
   static final String testFileDir = "/tmp/test/";
   static final String testFileName = testFileDir + "testFileStatusSerialziation";
+  static final String NOT_IN_MOUNTPOINT_FILENAME = "/NotInMountpointFile";
   private static MiniDFSCluster cluster;
   private static final FileSystemTestHelper fileSystemTestHelper = new FileSystemTestHelper();

   private static final Configuration CONF = new Configuration();
@@ -70,6 +71,8 @@ public class TestViewFsDefaultValue {
   private static FileSystem vfs;
   private static Path testFilePath;
   private static Path testFileDirPath;
+  // Use NotInMountpoint path to trigger the exception
+  private static Path notInMountpointPath;
 
   @BeforeClass
   public static void clusterSetupAtBegining() throws IOException,
@@ -86,12 +89,14 @@ public class TestViewFsDefaultValue {
     cluster.waitClusterUp();
     fHdfs = cluster.getFileSystem();
     fileSystemTestHelper.createFile(fHdfs, testFileName);
+    fileSystemTestHelper.createFile(fHdfs, NOT_IN_MOUNTPOINT_FILENAME);
     Configuration conf = ViewFileSystemTestSetup.createConfig();
     ConfigUtil.addLink(conf, "/tmp", new URI(fHdfs.getUri().toString() +
       "/tmp"));
     vfs = FileSystem.get(FsConstants.VIEWFS_URI, conf);
     testFileDirPath = new Path (testFileDir);
     testFilePath = new Path (testFileName);
+    notInMountpointPath = new Path(NOT_IN_MOUNTPOINT_FILENAME);
   }
 
 
@@ -105,7 +110,7 @@ public class TestViewFsDefaultValue {
     // but we are only looking at the defaultBlockSize, so this 
     // test should still pass
     try {
-      vfs.getDefaultBlockSize();
+      vfs.getDefaultBlockSize(notInMountpointPath);
       fail("getServerDefaults on viewFs did not throw excetion!");
     } catch (NotInMountpointException e) {
       assertEquals(vfs.getDefaultBlockSize(testFilePath), 
@@ -120,7 +125,7 @@ public class TestViewFsDefaultValue {
   public void testGetDefaultReplication()
       throws IOException, URISyntaxException {
     try {
-      vfs.getDefaultReplication();
+      vfs.getDefaultReplication(notInMountpointPath);
       fail("getDefaultReplication on viewFs did not throw excetion!");
     } catch (NotInMountpointException e) {
       assertEquals(vfs.getDefaultReplication(testFilePath), 
@@ -135,7 +140,7 @@ public class TestViewFsDefaultValue {
   @Test
   public void testServerDefaults() throws IOException {
     try {
-      FsServerDefaults serverDefaults = vfs.getServerDefaults();
+      vfs.getServerDefaults(notInMountpointPath);
       fail("getServerDefaults on viewFs did not throw excetion!");
     } catch (NotInMountpointException e) {
       FsServerDefaults serverDefaults = vfs.getServerDefaults(testFilePath);
@@ -215,6 +220,7 @@ public class TestViewFsDefaultValue {
   @AfterClass
   public static void cleanup() throws IOException {
     fHdfs.delete(new Path(testFileName), true);
+    fHdfs.delete(notInMountpointPath, true);
   }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message