@Test public void testRename() throws IOException { fileContextTestHelper.createFile(fc, "/newDir/foo"); fc.rename(new Path("/newDir/foo"), new Path("/newDir/fooBar")); Assert.assertFalse(exists(fc, new Path("/newDir/foo"))); Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/foo"))); Assert.assertTrue(isFile(fc, fileContextTestHelper.getTestRootPath(fc,"/newDir/fooBar"))); Assert.assertTrue(isFile(fcTarget, new Path(chrootedTo,"newDir/fooBar"))); fc.mkdir(new Path("/newDir/dirFoo"), FileContext.DEFAULT_PERM, false); fc.rename(new Path("/newDir/dirFoo"), new Path("/newDir/dirFooBar")); Assert.assertFalse(exists(fc, new Path("/newDir/dirFoo"))); Assert.assertFalse(exists(fcTarget, new Path(chrootedTo,"newDir/dirFoo"))); Assert.assertTrue(isDir(fc, fileContextTestHelper.getTestRootPath(fc,"/newDir/dirFooBar"))); Assert.assertTrue(isDir(fcTarget, new Path(chrootedTo,"newDir/dirFooBar"))); }
@Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); }
ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } }
ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); }
ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override boolean isValidName(String src); @Override URI getUri(); String stripOutRoot(final Path p); @Override Path getHomeDirectory(); @Override Path getInitialWorkingDirectory(); Path getResolvedQualifiedPath(final Path f); @Override FSDataOutputStream createInternal(final Path f,
      final EnumSet<CreateFlag> flag, final FsPermission absolutePermission,
      final int bufferSize, final short replication, final long blockSize,
      final Progressable progress, final ChecksumOpt checksumOpt,
      final boolean createParent); @Override boolean delete(final Path f, final boolean recursive); @Override BlockLocation[] getFileBlockLocations(final Path f, final long start,
      final long len); @Override FileChecksum getFileChecksum(final Path f); @Override FileStatus getFileStatus(final Path f); void access(Path path, FsAction mode); @Override FileStatus getFileLinkStatus(final Path f); @Override FsStatus getFsStatus(); @Override FsServerDefaults getServerDefaults(); @Override int getUriDefaultPort(); @Override FileStatus[] listStatus(final Path f); @Override void mkdir(final Path dir, final FsPermission permission,
      final boolean createParent); @Override FSDataInputStream open(final Path f, final int bufferSize); @Override boolean truncate(final Path f, final long newLength); @Override void renameInternal(final Path src, final Path dst); @Override void renameInternal(final Path src, final Path dst, 
      final boolean overwrite); @Override void setOwner(final Path f, final String username,
      final String groupname); @Override void setPermission(final Path f, final FsPermission permission); @Override boolean setReplication(final Path f, final short replication); @Override void setTimes(final Path f, final long mtime, final long atime); @Override void modifyAclEntries(Path path, List<AclEntry> aclSpec); @Override void removeAclEntries(Path path, List<AclEntry> aclSpec); @Override void removeDefaultAcl(Path path); @Override void removeAcl(Path path); @Override void setAcl(Path path, List<AclEntry> aclSpec); @Override AclStatus getAclStatus(Path path); @Override void setXAttr(Path path, String name, byte[] value,
                       EnumSet<XAttrSetFlag> flag); @Override byte[] getXAttr(Path path, String name); @Override Map<String, byte[]> getXAttrs(Path path); @Override Map<String, byte[]> getXAttrs(Path path, List<String> names); @Override List<String> listXAttrs(Path path); @Override void removeXAttr(Path path, String name); @Override void setVerifyChecksum(final boolean verifyChecksum); @Override boolean supportsSymlinks(); @Override void createSymlink(final Path target, final Path link,
      final boolean createParent); @Override Path getLinkTarget(final Path f); @Override List<Token<?>> getDelegationTokens(String renewer); }
ChRootedFs extends AbstractFileSystem { @Override public void mkdir(final Path dir, final FsPermission permission, final boolean createParent) throws IOException, UnresolvedLinkException { myFs.mkdir(fullPath(dir), permission, createParent); } ChRootedFs(final AbstractFileSystem fs, final Path theRoot); @Override boolean isValidName(String src); @Override URI getUri(); String stripOutRoot(final Path p); @Override Path getHomeDirectory(); @Override Path getInitialWorkingDirectory(); Path getResolvedQualifiedPath(final Path f); @Override FSDataOutputStream createInternal(final Path f,
      final EnumSet<CreateFlag> flag, final FsPermission absolutePermission,
      final int bufferSize, final short replication, final long blockSize,
      final Progressable progress, final ChecksumOpt checksumOpt,
      final boolean createParent); @Override boolean delete(final Path f, final boolean recursive); @Override BlockLocation[] getFileBlockLocations(final Path f, final long start,
      final long len); @Override FileChecksum getFileChecksum(final Path f); @Override FileStatus getFileStatus(final Path f); void access(Path path, FsAction mode); @Override FileStatus getFileLinkStatus(final Path f); @Override FsStatus getFsStatus(); @Override FsServerDefaults getServerDefaults(); @Override int getUriDefaultPort(); @Override FileStatus[] listStatus(final Path f); @Override void mkdir(final Path dir, final FsPermission permission,
      final boolean createParent); @Override FSDataInputStream open(final Path f, final int bufferSize); @Override boolean truncate(final Path f, final long newLength); @Override void renameInternal(final Path src, final Path dst); @Override void renameInternal(final Path src, final Path dst, 
      final boolean overwrite); @Override void setOwner(final Path f, final String username,
      final String groupname); @Override void setPermission(final Path f, final FsPermission permission); @Override boolean setReplication(final Path f, final short replication); @Override void setTimes(final Path f, final long mtime, final long atime); @Override void modifyAclEntries(Path path, List<AclEntry> aclSpec); @Override void removeAclEntries(Path path, List<AclEntry> aclSpec); @Override void removeDefaultAcl(Path path); @Override void removeAcl(Path path); @Override void setAcl(Path path, List<AclEntry> aclSpec); @Override AclStatus getAclStatus(Path path); @Override void setXAttr(Path path, String name, byte[] value,
                       EnumSet<XAttrSetFlag> flag); @Override byte[] getXAttr(Path path, String name); @Override Map<String, byte[]> getXAttrs(Path path); @Override Map<String, byte[]> getXAttrs(Path path, List<String> names); @Override List<String> listXAttrs(Path path); @Override void removeXAttr(Path path, String name); @Override void setVerifyChecksum(final boolean verifyChecksum); @Override boolean supportsSymlinks(); @Override void createSymlink(final Path target, final Path link,
      final boolean createParent); @Override Path getLinkTarget(final Path f); @Override List<Token<?>> getDelegationTokens(String renewer);  }