hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvasu...@apache.org
Subject [31/50] [abbrv] hadoop git commit: HADOOP-13240. TestAclCommands.testSetfaclValidations fail. Contributed by John Zhuge.
Date Mon, 25 Jul 2016 17:26:17 GMT
HADOOP-13240. TestAclCommands.testSetfaclValidations fail. Contributed by John Zhuge.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/43cf6b10
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/43cf6b10
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/43cf6b10

Branch: refs/heads/YARN-3926
Commit: 43cf6b101dacd96bacfd199826b717f6946109af
Parents: ecff7d0
Author: Chris Nauroth <cnauroth@apache.org>
Authored: Thu Jul 21 14:12:31 2016 -0700
Committer: Chris Nauroth <cnauroth@apache.org>
Committed: Thu Jul 21 14:12:31 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/fs/shell/AclCommands.java |  4 +++
 .../apache/hadoop/fs/shell/TestAclCommands.java | 34 ++++++++++++--------
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/43cf6b10/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
index 51a2255..9a54040 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
@@ -213,6 +213,10 @@ class AclCommands extends FsCommand {
               "Missing either <acl_spec> or <path>");
         }
         aclEntries = AclEntry.parseAclSpec(args.removeFirst(), !cf.getOpt("x"));
+        if (aclEntries.isEmpty()) {
+          throw new HadoopIllegalArgumentException(
+              "Missing <acl_spec> entry");
+        }
       }
 
       if (args.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/43cf6b10/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestAclCommands.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestAclCommands.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestAclCommands.java
index 3b9d397..5637e70 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestAclCommands.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestAclCommands.java
@@ -43,48 +43,54 @@ import org.apache.hadoop.ipc.RpcNoSuchMethodException;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.ToolRunner;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 
 public class TestAclCommands {
+  @Rule
+  public TemporaryFolder testFolder = new TemporaryFolder();
+
+  private String path;
 
   private Configuration conf = null;
 
   @Before
   public void setup() throws IOException {
     conf = new Configuration();
+    path = testFolder.newFile("file").getPath();
   }
 
   @Test
   public void testGetfaclValidations() throws Exception {
     assertFalse("getfacl should fail without path",
-        0 == runCommand(new String[] { "-getfacl" }));
+        0 == runCommand(new String[] {"-getfacl"}));
     assertFalse("getfacl should fail with extra argument",
-        0 == runCommand(new String[] { "-getfacl", "/test", "extraArg" }));
+        0 == runCommand(new String[] {"-getfacl", path, "extraArg"}));
   }
 
   @Test
   public void testSetfaclValidations() throws Exception {
     assertFalse("setfacl should fail without options",
-        0 == runCommand(new String[] { "-setfacl", "/" }));
+        0 == runCommand(new String[] {"-setfacl", path}));
     assertFalse("setfacl should fail without options -b, -k, -m, -x or --set",
-        0 == runCommand(new String[] { "-setfacl", "-R", "/" }));
+        0 == runCommand(new String[] {"-setfacl", "-R", path}));
     assertFalse("setfacl should fail without path",
-        0 == runCommand(new String[] { "-setfacl" }));
+        0 == runCommand(new String[] {"-setfacl"}));
     assertFalse("setfacl should fail without aclSpec",
-        0 == runCommand(new String[] { "-setfacl", "-m", "/path" }));
+        0 == runCommand(new String[] {"-setfacl", "-m", path}));
     assertFalse("setfacl should fail with conflicting options",
-        0 == runCommand(new String[] { "-setfacl", "-m", "/path" }));
+        0 == runCommand(new String[] {"-setfacl", "-m", path}));
     assertFalse("setfacl should fail with extra arguments",
-        0 == runCommand(new String[] { "-setfacl", "/path", "extra" }));
+        0 == runCommand(new String[] {"-setfacl", path, "extra"}));
     assertFalse("setfacl should fail with extra arguments",
-        0 == runCommand(new String[] { "-setfacl", "--set",
-            "default:user::rwx", "/path", "extra" }));
+        0 == runCommand(new String[] {"-setfacl", "--set",
+            "default:user::rwx", path, "extra"}));
     assertFalse("setfacl should fail with permissions for -x",
-        0 == runCommand(new String[] { "-setfacl", "-x", "user:user1:rwx",
-            "/path" }));
+        0 == runCommand(new String[] {"-setfacl", "-x", "user:user1:rwx",
+            path}));
     assertFalse("setfacl should fail ACL spec missing",
-        0 == runCommand(new String[] { "-setfacl", "-m",
-            "", "/path" }));
+        0 == runCommand(new String[] {"-setfacl", "-m", "", path}));
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message