当前位置: 首页>>代码示例>>Java>>正文


Java FileContextTestHelper.getTestRootPath方法代码示例

本文整理汇总了Java中org.apache.hadoop.fs.FileContextTestHelper.getTestRootPath方法的典型用法代码示例。如果您正苦于以下问题:Java FileContextTestHelper.getTestRootPath方法的具体用法?Java FileContextTestHelper.getTestRootPath怎么用?Java FileContextTestHelper.getTestRootPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.fs.FileContextTestHelper的用法示例。


在下文中一共展示了FileContextTestHelper.getTestRootPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupForViewFsLocalFs

import org.apache.hadoop.fs.FileContextTestHelper; //导入方法依赖的package包/类
static public FileContext setupForViewFsLocalFs(FileContextTestHelper helper) throws Exception {
  /**
   * create the test root on local_fs - the  mount table will point here
   */
  FileContext fsTarget = FileContext.getLocalFSFileContext();
  Path targetOfTests = helper.getTestRootPath(fsTarget);
  // In case previous test was killed before cleanup
  fsTarget.delete(targetOfTests, true);
  
  fsTarget.mkdir(targetOfTests, FileContext.DEFAULT_PERM, true);
  Configuration conf = new Configuration();
  
  // Set up viewfs link for test dir as described above
  String testDir = helper.getTestRootPath(fsTarget).toUri()
      .getPath();
  linkUpFirstComponents(conf, testDir, fsTarget, "test dir");
  
  
  // Set up viewfs link for home dir as described above
  setUpHomeDir(conf, fsTarget);
    
  // the test path may be relative to working dir - we need to make that work:
  // Set up viewfs link for wd as described above
  String wdDir = fsTarget.getWorkingDirectory().toUri().getPath();
  linkUpFirstComponents(conf, wdDir, fsTarget, "working dir");
  
  FileContext fc = FileContext.getFileContext(FsConstants.VIEWFS_URI, conf);
  fc.setWorkingDirectory(new Path(wdDir)); // in case testdir relative to wd.
  Log.info("Working dir is: " + fc.getWorkingDirectory());
  //System.out.println("SRCOfTests = "+ getTestRootPath(fc, "test"));
  //System.out.println("TargetOfTests = "+ targetOfTests.toUri());
  return fc;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:34,代码来源:ViewFsTestSetup.java

示例2: tearDownForViewFsLocalFs

import org.apache.hadoop.fs.FileContextTestHelper; //导入方法依赖的package包/类
/**
 * 
 * delete the test directory in the target local fs
 */
static public void tearDownForViewFsLocalFs(FileContextTestHelper helper) throws Exception {
  FileContext fclocal = FileContext.getLocalFSFileContext();
  Path targetOfTests = helper.getTestRootPath(fclocal);
  fclocal.delete(targetOfTests, true);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:ViewFsTestSetup.java


注:本文中的org.apache.hadoop.fs.FileContextTestHelper.getTestRootPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。