本文整理汇总了Java中org.apache.hadoop.fs.FileSystemTestHelper.addFileSystemForTesting方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystemTestHelper.addFileSystemForTesting方法的具体用法?Java FileSystemTestHelper.addFileSystemForTesting怎么用?Java FileSystemTestHelper.addFileSystemForTesting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.FileSystemTestHelper
的用法示例。
在下文中一共展示了FileSystemTestHelper.addFileSystemForTesting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.hadoop.fs.FileSystemTestHelper; //导入方法依赖的package包/类
@Before
public void init() throws URISyntaxException, IOException {
dfs = mock(DistributedFileSystem.class);
conf = new Configuration();
uri = new URI("hdfs://" + SERVICE_VALUE);
FileSystemTestHelper.addFileSystemForTesting(uri, conf, dfs);
}
示例2: testSecureHAToken
import org.apache.hadoop.fs.FileSystemTestHelper; //导入方法依赖的package包/类
@Test
public void testSecureHAToken() throws IOException, InterruptedException {
Configuration conf = DFSTestUtil.newHAConfiguration(LOGICAL_NAME);
conf.setBoolean(DFSConfigKeys
.DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY, true);
MiniDFSCluster cluster = null;
WebHdfsFileSystem fs = null;
try {
cluster = new MiniDFSCluster.Builder(conf).nnTopology(topo)
.numDataNodes(0).build();
HATestUtil.setFailoverConfigurations(cluster, conf, LOGICAL_NAME);
cluster.waitActive();
fs = spy((WebHdfsFileSystem) FileSystem.get(WEBHDFS_URI, conf));
FileSystemTestHelper.addFileSystemForTesting(WEBHDFS_URI, conf, fs);
cluster.transitionToActive(0);
Token<?> token = fs.getDelegationToken(null);
cluster.shutdownNameNode(0);
cluster.transitionToActive(1);
token.renew(conf);
token.cancel(conf);
verify(fs).renewDelegationToken(token);
verify(fs).cancelDelegationToken(token);
} finally {
IOUtils.cleanup(null, fs);
if (cluster != null) {
cluster.shutdown();
}
}
}
示例3: init
import org.apache.hadoop.fs.FileSystemTestHelper; //导入方法依赖的package包/类
@Before
public void init() throws URISyntaxException, IOException {
dfs = mock(DistributedFileSystem.class);
conf = new Configuration();
uri = new URI("hdfs://" + SERVICE_VALUE);
FileSystemTestHelper.addFileSystemForTesting(uri, conf, dfs);
}