本文整理汇总了Java中org.apache.hadoop.hdfs.server.common.Storage.StorageDirType类的典型用法代码示例。如果您正苦于以下问题:Java StorageDirType类的具体用法?Java StorageDirType怎么用?Java StorageDirType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StorageDirType类属于org.apache.hadoop.hdfs.server.common.Storage包,在下文中一共展示了StorageDirType类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mockStorageDirectory
import org.apache.hadoop.hdfs.server.common.Storage.StorageDirType; //导入依赖的package包/类
/**
* Make a mock storage directory that returns some set of file contents.
* @param type type of storage dir
* @param previousExists should we mock that the previous/ dir exists?
* @param fileNames the names of files contained in current/
*/
static StorageDirectory mockStorageDirectory(
StorageDirType type,
boolean previousExists,
String... fileNames) {
StorageDirectory sd = mock(StorageDirectory.class);
doReturn(type).when(sd).getStorageDirType();
// Version file should always exist
doReturn(mockFile(true)).when(sd).getVersionFile();
doReturn(mockFile(true)).when(sd).getRoot();
// Previous dir optionally exists
doReturn(mockFile(previousExists))
.when(sd).getPreviousDir();
// Return a mock 'current' directory which has the given paths
File[] files = new File[fileNames.length];
for (int i = 0; i < fileNames.length; i++) {
files[i] = new File(fileNames[i]);
}
File mockDir = Mockito.spy(new File("/dir/current"));
doReturn(files).when(mockDir).listFiles();
doReturn(mockDir).when(sd).getCurrentDir();
return sd;
}
示例2: dirIterator
import org.apache.hadoop.hdfs.server.common.Storage.StorageDirType; //导入依赖的package包/类
public Iterator<StorageDirectory> dirIterator(StorageDirType dirType) {
return storage.dirIterator(dirType);
}