|
@@ -18,9 +18,25 @@
|
|
|
|
|
|
package org.apache.hadoop.hdfs.web;
|
|
|
|
|
|
+import static org.apache.hadoop.fs.permission.AclEntryScope.ACCESS;
|
|
|
+import static org.apache.hadoop.fs.permission.AclEntryScope.DEFAULT;
|
|
|
+import static org.apache.hadoop.fs.permission.AclEntryType.GROUP;
|
|
|
+import static org.apache.hadoop.fs.permission.AclEntryType.MASK;
|
|
|
+import static org.apache.hadoop.fs.permission.AclEntryType.OTHER;
|
|
|
+import static org.apache.hadoop.fs.permission.AclEntryType.USER;
|
|
|
+import static org.apache.hadoop.fs.permission.FsAction.ALL;
|
|
|
+import static org.apache.hadoop.fs.permission.FsAction.NONE;
|
|
|
+import static org.apache.hadoop.fs.permission.FsAction.READ;
|
|
|
+import static org.apache.hadoop.fs.permission.FsAction.READ_EXECUTE;
|
|
|
+import static org.apache.hadoop.fs.permission.FsAction.READ_WRITE;
|
|
|
+import static org.apache.hadoop.hdfs.server.namenode.AclTestHelpers.aclEntry;
|
|
|
+import static org.junit.Assert.assertArrayEquals;
|
|
|
+
|
|
|
+import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URISyntaxException;
|
|
|
import java.security.PrivilegedExceptionAction;
|
|
|
+import java.util.List;
|
|
|
import java.util.Random;
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
@@ -31,18 +47,27 @@ import org.apache.hadoop.fs.FSDataInputStream;
|
|
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.fs.Path;
|
|
|
+import org.apache.hadoop.fs.permission.AclEntry;
|
|
|
+import org.apache.hadoop.fs.permission.AclStatus;
|
|
|
import org.apache.hadoop.fs.permission.FsAction;
|
|
|
import org.apache.hadoop.fs.permission.FsPermission;
|
|
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|
|
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
|
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
|
|
import org.apache.hadoop.hdfs.TestDFSClientRetries;
|
|
|
+import org.apache.hadoop.hdfs.protocol.AclException;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;
|
|
|
+import org.apache.hadoop.io.IOUtils;
|
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
|
import org.apache.log4j.Level;
|
|
|
+import org.junit.AfterClass;
|
|
|
import org.junit.Assert;
|
|
|
+import org.junit.Before;
|
|
|
+import org.junit.BeforeClass;
|
|
|
import org.junit.Test;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+
|
|
|
/** Test WebHDFS */
|
|
|
public class TestWebHDFS {
|
|
|
static final Log LOG = LogFactory.getLog(TestWebHDFS.class);
|
|
@@ -51,6 +76,35 @@ public class TestWebHDFS {
|
|
|
|
|
|
static final long systemStartTime = System.nanoTime();
|
|
|
|
|
|
+ private static MiniDFSCluster testCluster;
|
|
|
+ private static Configuration testConf;
|
|
|
+ private static FileSystem testFs;
|
|
|
+ private static int pathCount = 0;
|
|
|
+ private static Path tmpPath;
|
|
|
+
|
|
|
+ @BeforeClass
|
|
|
+ public static void init() throws Exception {
|
|
|
+ testConf = WebHdfsTestUtil.createConf();
|
|
|
+
|
|
|
+ testCluster = new MiniDFSCluster.Builder(testConf).numDataNodes(1).build();
|
|
|
+ testCluster.waitActive();
|
|
|
+ testFs = WebHdfsTestUtil.getWebHdfsFileSystem(testConf, WebHdfsFileSystem.SCHEME);
|
|
|
+ }
|
|
|
+
|
|
|
+ @AfterClass
|
|
|
+ public static void shutdown() throws Exception {
|
|
|
+ IOUtils.cleanup(null, testFs);
|
|
|
+ if (testCluster != null) {
|
|
|
+ testCluster.shutdown();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Before
|
|
|
+ public void setUp() {
|
|
|
+ pathCount += 1;
|
|
|
+ tmpPath = new Path("/p" + pathCount);
|
|
|
+ }
|
|
|
+
|
|
|
/** A timer for measuring performance. */
|
|
|
static class Ticker {
|
|
|
final String name;
|
|
@@ -300,4 +354,648 @@ public class TestWebHDFS {
|
|
|
Assert.assertTrue(conf.getBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY,
|
|
|
false));
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testModifyAclEntries() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", READ_EXECUTE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testModifyAclEntriesOnlyAccess() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_EXECUTE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testModifyAclEntriesOnlyDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, "foo", READ_EXECUTE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testModifyAclEntriesMinimal() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_WRITE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_WRITE),
|
|
|
+ aclEntry(ACCESS, GROUP, READ) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testModifyAclEntriesMinimalDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testModifyAclEntriesCustomMask() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, MASK, NONE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testModifyAclEntriesStickyBit() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)01750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", READ_EXECUTE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testModifyAclEntriesPathNotFound() throws IOException {
|
|
|
+ // Path has not been created.
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=AclException.class)
|
|
|
+ public void testModifyAclEntriesDefaultOnFile() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.modifyAclEntries(tmpPath, aclSpec);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclEntries() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo"),
|
|
|
+ aclEntry(DEFAULT, USER, "foo"));
|
|
|
+ testFs.removeAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclEntriesOnlyAccess() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, USER, "bar", READ_WRITE),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo"));
|
|
|
+ testFs.removeAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "bar", READ_WRITE),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_WRITE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclEntriesOnlyDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "bar", READ_EXECUTE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, "foo"));
|
|
|
+ testFs.removeAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "bar", READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclEntriesMinimal() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo"),
|
|
|
+ aclEntry(ACCESS, MASK));
|
|
|
+ System.out.println("AclSpec :"+aclSpec);
|
|
|
+ testFs.removeAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] { }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclEntriesMinimalDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo"),
|
|
|
+ aclEntry(ACCESS, MASK),
|
|
|
+ aclEntry(DEFAULT, USER, "foo"),
|
|
|
+ aclEntry(DEFAULT, MASK));
|
|
|
+ testFs.removeAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclEntriesStickyBit() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)01750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo"),
|
|
|
+ aclEntry(DEFAULT, USER, "foo"));
|
|
|
+ testFs.removeAclEntries(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testRemoveAclEntriesPathNotFound() throws IOException {
|
|
|
+ // Path has not been created.
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, "foo"));
|
|
|
+ testFs.removeAclEntries(tmpPath, aclSpec);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveDefaultAcl() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.removeDefaultAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveDefaultAclOnlyAccess() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.removeDefaultAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveDefaultAclOnlyDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.removeDefaultAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] { }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveDefaultAclMinimal() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ testFs.removeDefaultAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] { }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveDefaultAclStickyBit() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)01750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.removeDefaultAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testRemoveDefaultAclPathNotFound() throws IOException {
|
|
|
+ // Path has not been created.
|
|
|
+ testFs.removeDefaultAcl(tmpPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAcl() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.removeAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] { }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclMinimalAcl() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ testFs.removeAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] { }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testRemoveAclStickyBit() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)01750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.removeAcl(tmpPath);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] { }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testRemoveAclPathNotFound() throws IOException {
|
|
|
+ // Path has not been created.
|
|
|
+ testFs.removeAcl(tmpPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetAcl() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, ALL),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetAclOnlyAccess() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetAclOnlyDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, ALL),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetAclMinimal() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, GROUP, READ),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] { }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetAclMinimalDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetAclCustomMask() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ),
|
|
|
+ aclEntry(ACCESS, MASK, ALL),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetAclStickyBit() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)01750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, ALL),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=FileNotFoundException.class)
|
|
|
+ public void testSetAclPathNotFound() throws IOException {
|
|
|
+ // Path has not been created.
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test(expected=AclException.class)
|
|
|
+ public void testSetAclDefaultOnFile() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetPermission() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short)0700));
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, ALL),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetPermissionOnlyAccess() throws IOException {
|
|
|
+ testFs.create(tmpPath).close();
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short) 0640));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, READ_WRITE),
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short)0600));
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(ACCESS, USER, "foo", READ),
|
|
|
+ aclEntry(ACCESS, GROUP, READ) }, returned);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSetPermissionOnlyDefault() throws IOException {
|
|
|
+ FileSystem.mkdirs(testFs, tmpPath, FsPermission.createImmutable((short)0750));
|
|
|
+ List<AclEntry> aclSpec = Lists.newArrayList(
|
|
|
+ aclEntry(ACCESS, USER, ALL),
|
|
|
+ aclEntry(ACCESS, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(ACCESS, OTHER, NONE),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL));
|
|
|
+ testFs.setAcl(tmpPath, aclSpec);
|
|
|
+ testFs.setPermission(tmpPath, FsPermission.createImmutable((short)0700));
|
|
|
+ AclStatus s = testFs.getAclStatus(tmpPath);
|
|
|
+ AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
|
|
|
+ assertArrayEquals(new AclEntry[] {
|
|
|
+ aclEntry(DEFAULT, USER, ALL),
|
|
|
+ aclEntry(DEFAULT, USER, "foo", ALL),
|
|
|
+ aclEntry(DEFAULT, GROUP, READ_EXECUTE),
|
|
|
+ aclEntry(DEFAULT, MASK, ALL),
|
|
|
+ aclEntry(DEFAULT, OTHER, NONE) }, returned);
|
|
|
+ }
|
|
|
}
|