YARN-6239. Fix javadoc warnings in YARN that caused by deprecated FileSystem APIs. Contributed by Yiqun Lin.
This commit is contained in:
parent
ef488044d0
commit
0f35443bf2
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue