Source:
public void testListStatusACL() throws IOException { String testfilename = "testFileACL"; String childDirectoryName = "testDirectoryACL"; TEST_DIR.mkdirs(); File infile = new File(TEST_DIR, testfilename); final byte[] content = "dingos".getBytes(); try (FileOutputStream fos = new FileOutputStream(infile)) { fos.write(content); } assertEquals(content.length, infile.length()); File childDir = new File(TEST_DIR, childDirectoryName); childDir.mkdirs(); Configuration conf = new Configuration(); ConfigUtil.addLink(conf, "/file", infile.toURI()); ConfigUtil.addLink(conf, "/dir", childDir.toURI()); conf.setBoolean(Constants.CONFIG_VIEWFS_MOUNT_LINKS_AS_SYMLINKS, false); try (FileSystem vfs = FileSystem.get(FsConstants.VIEWFS_URI, conf)) { assertEquals(ViewFileSystem.class, vfs.getClass()); FileStatus[] statuses = vfs.listStatus(new Path("/")); FileSystem localFs = FileSystem.getLocal(conf); FileStatus fileStat = localFs.getFileStatus(new Path(infile.getPath())); FileStatus dirStat = localFs.getFileStatus(new Path(childDir.getPath())); for (FileStatus status : statuses) { if (status.getPath().getName().equals("file")) { assertEquals(fileStat.getPermission(), status.getPermission()); } else { assertEquals(dirStat.getPermission(), status.getPermission()); } } localFs.setPermission(new Path(infile.getPath()), FsPermission.valueOf("-rwxr--r--")); localFs.setPermission(new Path(childDir.getPath()), FsPermission.valueOf("-r--rwxr--")); statuses = vfs.listStatus(new Path("/")); for (FileStatus status : statuses) { if (status.getPath().getName().equals("file")) { assertEquals(FsPermission.valueOf("-rwxr--r--"), status.getPermission()); assertEquals(false, status.isDirectory()); } else { assertEquals(FsPermission.valueOf("-r--rwxr--"), status.getPermission()); assertEquals(true, status.isDirectory()); } } } }

Target:
public void testListStatusACL() throws IOException { String testfilename = "testFileACL"; String childDirectoryName = "testDirectoryACL"; TEST_DIR.mkdirs(); File infile = new File(TEST_DIR, testfilename); final byte[] content = "dingos".getBytes(); try (FileOutputStream fos = new FileOutputStream(infile)) { fos.write(content); } assertEquals(content.length, infile.length()); File childDir = new File(TEST_DIR, childDirectoryName); childDir.mkdirs(); Configuration conf = new Configuration(); ConfigUtil.addLink(conf, "/file", infile.toURI()); ConfigUtil.addLink(conf, "/dir", childDir.toURI()); conf.setBoolean(Constants.CONFIG_VIEWFS_MOUNT_LINKS_AS_SYMLINKS, false); try (FileSystem vfs = FileSystem.get(FsConstants.VIEWFS_URI, conf)) { assertEquals(ViewFileSystem.class, vfs.getClass()); FileStatus[] statuses = vfs.listStatus(new Path("/")); FileSystem localFs = FileSystem.getLocal(conf); FileStatus fileStat = localFs.getFileStatus(new Path(infile.getPath())); FileStatus dirStat = localFs.getFileStatus(new Path(childDir.getPath())); for (FileStatus status : statuses) { if (status.getPath().getName().equals("file")) { assertEquals(fileStat.getPermission(), status.getPermission()); } else { assertEquals(dirStat.getPermission(), status.getPermission()); } } localFs.setPermission(new Path(infile.getPath()), FsPermission.valueOf("-rwxr--r--")); localFs.setPermission(new Path(childDir.getPath()), FsPermission.valueOf("-r--rwxr--")); statuses = vfs.listStatus(new Path("/")); for (FileStatus status : statuses) { if (status.getPath().getName().equals("file")) { assertEquals(FsPermission.valueOf("-rwxr--r--"), status.getPermission()); assertFalse(status.isDirectory()); } else { assertEquals(FsPermission.valueOf("-r--rwxr--"), status.getPermission()); assertTrue(status.isDirectory()); } } } }