YARN-6239. Fix javadoc warnings in YARN that caused by deprecated FileSystem APIs. 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/0f35443b Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0f35443b Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0f35443b Branch: refs/heads/YARN-5734 Commit: 0f35443bf262bf2b92ca01cc76178aeb32533ae2 Parents: ef48804 Author: Yiqun Lin <yq...@apache.org> Authored: Tue Feb 28 18:51:56 2017 +0800 Committer: Yiqun Lin <yq...@apache.org> Committed: Tue Feb 28 18:51:56 2017 +0800 ---------------------------------------------------------------------- .../TestFileSystemApplicationHistoryStore.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/0f35443b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java index bd6bea3..15a00d2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestFileSystemApplicationHistoryStore.java @@ -35,6 +35,7 @@ import static org.mockito.Mockito.verify; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.RawLocalFileSystem; @@ -49,6 +50,7 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Container import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; public class TestFileSystemApplicationHistoryStore extends ApplicationHistoryStoreTestUtils { @@ -271,7 +273,9 @@ public class TestFileSystemApplicationHistoryStore extends // Setup file system to inject startup conditions FileSystem fs = spy(new RawLocalFileSystem()); - doReturn(true).when(fs).isDirectory(any(Path.class)); + FileStatus fileStatus = Mockito.mock(FileStatus.class); + doReturn(true).when(fileStatus).isDirectory(); + doReturn(fileStatus).when(fs).getFileStatus(any(Path.class)); try { initAndStartStore(fs); @@ -280,7 +284,7 @@ public class TestFileSystemApplicationHistoryStore extends } // Make sure that directory creation was not attempted - verify(fs, never()).isDirectory(any(Path.class)); + verify(fileStatus, never()).isDirectory(); verify(fs, times(1)).mkdirs(any(Path.class)); } @@ -291,7 +295,9 @@ public class TestFileSystemApplicationHistoryStore extends // Setup file system to inject startup conditions FileSystem fs = spy(new RawLocalFileSystem()); - doReturn(false).when(fs).isDirectory(any(Path.class)); + FileStatus fileStatus = Mockito.mock(FileStatus.class); + doReturn(false).when(fileStatus).isDirectory(); + doReturn(fileStatus).when(fs).getFileStatus(any(Path.class)); doThrow(new IOException()).when(fs).mkdirs(any(Path.class)); try { @@ -302,7 +308,7 @@ public class TestFileSystemApplicationHistoryStore extends } // Make sure that directory creation was attempted - verify(fs, never()).isDirectory(any(Path.class)); + verify(fileStatus, never()).isDirectory(); verify(fs, times(1)).mkdirs(any(Path.class)); } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org