hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: HADOOP-14843. Improve FsPermission symbolic parsing unit test coverage. Contributed by Bharat Viswanadham
Date Tue, 12 Sep 2017 22:00:54 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 10803bf08 -> c314a6635


HADOOP-14843. Improve FsPermission symbolic parsing unit test coverage. Contributed by Bharat
Viswanadham

(cherry picked from commit 86f4d1c66c8b541465ff769e5d951305c41c715c)

Conflicts:
	hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java


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

Branch: refs/heads/branch-2
Commit: c314a66353be9e535fa6a1a1728d680914a19cea
Parents: 10803bf
Author: Jason Lowe <jlowe@apache.org>
Authored: Tue Sep 12 16:51:08 2017 -0500
Committer: Jason Lowe <jlowe@apache.org>
Committed: Tue Sep 12 17:00:22 2017 -0500

----------------------------------------------------------------------
 .../hadoop/fs/permission/TestFsPermission.java  | 56 ++++++++++++++++++++
 1 file changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c314a663/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java
index fd86bcd..fe389c8 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/permission/TestFsPermission.java
@@ -132,6 +132,62 @@ public class TestFsPermission extends TestCase {
     }
   }
 
+  public void testFsSymbolicConstructorWithNormalInput() {
+
+    // Test cases for symbolic representation
+
+    //Added both Octal and short representation to show with sticky bit
+
+    assertEquals(777, new FsPermission("+rwx").toOctal());
+    assertEquals(0777, new FsPermission("+rwx").toShort());
+
+    assertEquals(444, new FsPermission("+r").toOctal());
+    assertEquals(0444, new FsPermission("+r").toShort());
+
+    assertEquals(222, new FsPermission("+w").toOctal());
+    assertEquals(0222, new FsPermission("+w").toShort());
+
+    assertEquals(111, new FsPermission("+x").toOctal());
+    assertEquals(0111, new FsPermission("+x").toShort());
+
+    assertEquals(666, new FsPermission("+rw").toOctal());
+    assertEquals(0666, new FsPermission("+rw").toShort());
+
+    assertEquals(333, new FsPermission("+wx").toOctal());
+    assertEquals(0333, new FsPermission("+wx").toShort());
+
+    assertEquals(555, new FsPermission("+rx").toOctal());
+    assertEquals(0555, new FsPermission("+rx").toShort());
+
+
+    // Test case is to test with repeated values in mode.
+    // Repeated value in input will be ignored as duplicate.
+
+    assertEquals(666, new FsPermission("+rwr").toOctal());
+    assertEquals(0666, new FsPermission("+rwr").toShort());
+
+    assertEquals(000, new FsPermission("-rwr").toOctal());
+    assertEquals(0000, new FsPermission("-rwr").toShort());
+
+    assertEquals(1666, new FsPermission("+rwrt").toOctal());
+    assertEquals(01666, new FsPermission("+rwrt").toShort());
+
+    assertEquals(000, new FsPermission("-rwrt").toOctal());
+    assertEquals(0000, new FsPermission("-rwrt").toShort());
+
+    assertEquals(1777, new FsPermission("+rwxt").toOctal());
+    assertEquals(01777, new FsPermission("+rwxt").toShort());
+
+
+    assertEquals(000, new FsPermission("-rt").toOctal());
+    assertEquals(0000, new FsPermission("-rt").toShort());
+
+    assertEquals(000, new FsPermission("-rwx").toOctal());
+    assertEquals(0000, new FsPermission("-rwx").toShort());
+
+  }
+
+
   public void testSymbolicPermission() {
     for (int i = 0; i < SYMBOLIC.length; ++i) {
       short val = 0777;


---------------------------------------------------------------------
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