Java 类org.apache.hadoop.fs.FileContextTestHelper 实例源码

项目:hadoop-oss    文件:ViewFsBaseTest.java   
@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);  
}
项目:hadoop    文件:ViewFsBaseTest.java   
@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);  
}
项目:aliyun-oss-hadoop-fs    文件:ViewFsBaseTest.java   
@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);  
}
项目:big-c    文件:ViewFsBaseTest.java   
@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);  
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ViewFsBaseTest.java   
@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);  
}
项目:hadoop-plus    文件:ViewFsBaseTest.java   
@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);  
}
项目:hops    文件:ViewFsBaseTest.java   
@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);  
}
项目:hadoop-TCP    文件:ViewFsBaseTest.java   
@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);  
}
项目:hardfs    文件:ViewFsBaseTest.java   
@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);  
}
项目:hadoop-on-lustre2    文件:ViewFsBaseTest.java   
@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);  
}
项目:hadoop-oss    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:hadoop-oss    文件:ViewFsBaseTest.java   
@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
}
项目:hadoop-oss    文件:ViewFsTestSetup.java   
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;
}
项目:hadoop-oss    文件:TestChRootedFs.java   
/**
 * We would have liked renames across file system to fail but 
 * Unfortunately there is not way to distinguish the two file systems 
 * @throws IOException
 */
@Test
public void testRenameAcrossFs() throws IOException {
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true);
  // the root will get interpreted to the root of the chrooted fs.
  fc.rename(new Path("/newDir/dirFoo"), new Path("file:///dirFooBar"));
  FileContextTestHelper.isDir(fc, new Path("/dirFooBar"));
}
项目:hadoop    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:hadoop    文件:ViewFsBaseTest.java   
@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
}
项目:hadoop    文件:ViewFsTestSetup.java   
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;
}
项目:hadoop    文件:TestChRootedFs.java   
/**
 * We would have liked renames across file system to fail but 
 * Unfortunately there is not way to distinguish the two file systems 
 * @throws IOException
 */
@Test
public void testRenameAcrossFs() throws IOException {
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true);
  // the root will get interpreted to the root of the chrooted fs.
  fc.rename(new Path("/newDir/dirFoo"), new Path("file:///dirFooBar"));
  FileContextTestHelper.isDir(fc, new Path("/dirFooBar"));
}
项目:aliyun-oss-hadoop-fs    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:aliyun-oss-hadoop-fs    文件:ViewFsBaseTest.java   
@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
}
项目:aliyun-oss-hadoop-fs    文件:ViewFsTestSetup.java   
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;
}
项目:aliyun-oss-hadoop-fs    文件:TestChRootedFs.java   
/**
 * We would have liked renames across file system to fail but 
 * Unfortunately there is not way to distinguish the two file systems 
 * @throws IOException
 */
@Test
public void testRenameAcrossFs() throws IOException {
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true);
  // the root will get interpreted to the root of the chrooted fs.
  fc.rename(new Path("/newDir/dirFoo"), new Path("file:///dirFooBar"));
  FileContextTestHelper.isDir(fc, new Path("/dirFooBar"));
}
项目:big-c    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:big-c    文件:ViewFsBaseTest.java   
@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
}
项目:big-c    文件:ViewFsTestSetup.java   
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;
}
项目:big-c    文件:TestChRootedFs.java   
/**
 * We would have liked renames across file system to fail but 
 * Unfortunately there is not way to distinguish the two file systems 
 * @throws IOException
 */
@Test
public void testRenameAcrossFs() throws IOException {
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true);
  // the root will get interpreted to the root of the chrooted fs.
  fc.rename(new Path("/newDir/dirFoo"), new Path("file:///dirFooBar"));
  FileContextTestHelper.isDir(fc, new Path("/dirFooBar"));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ViewFsBaseTest.java   
@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
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ViewFsTestSetup.java   
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;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestChRootedFs.java   
/**
 * We would have liked renames across file system to fail but 
 * Unfortunately there is not way to distinguish the two file systems 
 * @throws IOException
 */
@Test
public void testRenameAcrossFs() throws IOException {
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true);
  // the root will get interpreted to the root of the chrooted fs.
  fc.rename(new Path("/newDir/dirFoo"), new Path("file:///dirFooBar"));
  FileContextTestHelper.isDir(fc, new Path("/dirFooBar"));
}
项目:hadoop-plus    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:hadoop-plus    文件:ViewFsBaseTest.java   
@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
}
项目:hadoop-plus    文件:ViewFsTestSetup.java   
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;
}
项目:hadoop-plus    文件:TestChRootedFs.java   
/**
 * We would have liked renames across file system to fail but 
 * Unfortunately there is not way to distinguish the two file systems 
 * @throws IOException
 */
@Test
public void testRenameAcrossFs() throws IOException {
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true);
  // the root will get interpreted to the root of the chrooted fs.
  fc.rename(new Path("/newDir/dirFoo"), new Path("file:///dirFooBar"));
  FileContextTestHelper.isDir(fc, new Path("/dirFooBar"));
}
项目:hops    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:hops    文件:ViewFsBaseTest.java   
@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
}
项目:hops    文件:ViewFsTestSetup.java   
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;
}
项目:hops    文件:TestChRootedFs.java   
/**
 * We would have liked renames across file system to fail but 
 * Unfortunately there is not way to distinguish the two file systems 
 * @throws IOException
 */
@Test
public void testRenameAcrossFs() throws IOException {
  fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, true);
  // the root will get interpreted to the root of the chrooted fs.
  fc.rename(new Path("/newDir/dirFoo"), new Path("file:///dirFooBar"));
  FileContextTestHelper.isDir(fc, new Path("/dirFooBar"));
}
项目:hadoop-TCP    文件:TestLocalFSFileContextMainOperations.java   
@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());
}
项目:hadoop-TCP    文件:ViewFsBaseTest.java   
@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
}