HADOOP-14843. Improve FsPermission symbolic parsing unit test coverage. Contributed by Bharat Viswanadham
This commit is contained in:
parent
2ffe93ab60
commit
86f4d1c66c
@ -138,6 +138,63 @@ public void testFsPermission() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
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());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSymbolicPermission() {
|
||||
for (int i = 0; i < SYMBOLIC.length; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user