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


Java FileContextTestHelper.createFile方法代码示例

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


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

示例1: testGetBlockLocations

import org.apache.hadoop.fs.FileContextTestHelper; //导入方法依赖的package包/类
@Test
public void testGetBlockLocations() throws IOException {
  Path targetFilePath = new Path(targetTestRoot,"data/largeFile");
  FileContextTestHelper.createFile(fcTarget, targetFilePath, 10, 1024);
  Path viewFilePath = new Path("/data/largeFile");
  checkFileStatus(fcView, viewFilePath.toString(), fileType.isFile);
  BlockLocation[] viewBL = fcView.getFileBlockLocations(viewFilePath,
      0, 10240+100);
  Assert.assertEquals(SupportsBlocks ? 10 : 1, viewBL.length);
  BlockLocation[] targetBL = fcTarget.getFileBlockLocations(targetFilePath, 0, 10240+100);
  compareBLs(viewBL, targetBL);
  
  
  // Same test but now get it via the FileStatus Parameter
  fcView.getFileBlockLocations(viewFilePath, 0, 10240+100);
  targetBL = fcTarget.getFileBlockLocations(targetFilePath, 0, 10240+100);
  compareBLs(viewBL, targetBL);  
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:19,代码来源:ViewFsBaseTest.java

示例2: testDefaultFilePermission

import org.apache.hadoop.fs.FileContextTestHelper; //导入方法依赖的package包/类
@Test
public void testDefaultFilePermission() throws IOException {
  Path file = fileContextTestHelper.getTestRootPath(fc,
      "testDefaultFilePermission");
  FileContextTestHelper.createFile(fc, file);
  FsPermission expect = FileContext.FILE_DEFAULT_PERM.applyUMask(fc.getUMask());
  Assert.assertEquals(expect, fc.getFileStatus(file)
      .getPermission());
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:TestLocalFSFileContextMainOperations.java

示例3: setUp

import org.apache.hadoop.fs.FileContextTestHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
  initializeTargetTestRoot();
  
  // Make  user and data dirs - we creates links to them in the mount table
  fcTarget.mkdir(new Path(targetTestRoot,"user"),
      FileContext.DEFAULT_PERM, true);
  fcTarget.mkdir(new Path(targetTestRoot,"data"),
      FileContext.DEFAULT_PERM, true);
  fcTarget.mkdir(new Path(targetTestRoot,"dir2"),
      FileContext.DEFAULT_PERM, true);
  fcTarget.mkdir(new Path(targetTestRoot,"dir3"),
      FileContext.DEFAULT_PERM, true);
  FileContextTestHelper.createFile(fcTarget, new Path(targetTestRoot,"aFile"));
  
  
  // Now we use the mount fs to set links to user and dir
  // in the test root
  
  // Set up the defaultMT in the config with our mount point links
  conf = new Configuration();
  ConfigUtil.addLink(conf, "/targetRoot", targetTestRoot.toUri());
  ConfigUtil.addLink(conf, "/user",
      new Path(targetTestRoot,"user").toUri());
  ConfigUtil.addLink(conf, "/user2",
      new Path(targetTestRoot,"user").toUri());
  ConfigUtil.addLink(conf, "/data",
      new Path(targetTestRoot,"data").toUri());
  ConfigUtil.addLink(conf, "/internalDir/linkToDir2",
      new Path(targetTestRoot,"dir2").toUri());
  ConfigUtil.addLink(conf, "/internalDir/internalDir2/linkToDir3",
      new Path(targetTestRoot,"dir3").toUri());
  ConfigUtil.addLink(conf, "/danglingLink",
      new Path(targetTestRoot,"missingTarget").toUri());
  ConfigUtil.addLink(conf, "/linkToAFile",
      new Path(targetTestRoot,"aFile").toUri());
  
  fcView = FileContext.getFileContext(FsConstants.VIEWFS_URI, conf);
  // Also try viewfs://default/    - note authority is name of mount table
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:41,代码来源:ViewFsBaseTest.java


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