FTPFileSystem extends FileSystem { @VisibleForTesting FsAction getFsAction(int accessGroup, FTPFile ftpFile) { FsAction action = FsAction.NONE; if (ftpFile.hasPermission(accessGroup, FTPFile.READ_PERMISSION)) { action = action.or(FsAction.READ); } if (ftpFile.hasPermission(accessGroup, FTPFile.WRITE_PERMISSION)) { action = action.or(FsAction.WRITE); } if (ftpFile.hasPermission(accessGroup, FTPFile.EXECUTE_PERMISSION)) { action = action.or(FsAction.EXECUTE); } return action; }  @Override String getScheme(); @Override void initialize(URI uri, Configuration conf); @Override FSDataInputStream open(Path file, int bufferSize); @Override FSDataOutputStream create(Path file, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize,
      Progressable progress); @Override FSDataOutputStream append(Path f, int bufferSize,
      Progressable progress); @Override boolean delete(Path file, boolean recursive); @Override URI getUri(); @Override FileStatus[] listStatus(Path file); @Override FileStatus getFileStatus(Path file); @Override boolean mkdirs(Path file, FsPermission permission); @Override boolean rename(Path src, Path dst); @Override Path getWorkingDirectory(); @Override Path getHomeDirectory(); @Override void setWorkingDirectory(Path newDir); static final Logger LOG; static final int DEFAULT_BUFFER_SIZE; static final int DEFAULT_BLOCK_SIZE; static final String FS_FTP_USER_PREFIX; static final String FS_FTP_HOST; static final String FS_FTP_HOST_PORT; static final String FS_FTP_PASSWORD_PREFIX; static final String FS_FTP_DATA_CONNECTION_MODE; static final String FS_FTP_TRANSFER_MODE; static final String E_SAME_DIRECTORY_ONLY; }
@Test public void testGetFsAction(){ FTPFileSystem ftp = new FTPFileSystem(); int[] accesses = new int[] {FTPFile.USER_ACCESS, FTPFile.GROUP_ACCESS, FTPFile.WORLD_ACCESS}; FsAction[] actions = FsAction.values(); for(int i = 0; i < accesses.length; i++){ for(int j = 0; j < actions.length; j++){ enhancedAssertEquals(actions[j], ftp.getFsAction(accesses[i], getFTPFileOf(accesses[i], actions[j]))); } } }