use of alluxio.SetAndRestoreConfiguration in project alluxio by Alluxio.
the class PermissionCheckTest method setStateFail.
@Test
public void setStateFail() throws Exception {
// set unmask
try (SetAndRestoreConfiguration c = new SetAndRestoreConfiguration(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK, "066")) {
String file = PathUtils.concatPath(TEST_DIR_URI, "testState1");
verifyCreateFile(TEST_USER_1, file, false);
SetAttributeOptions expect = getNonDefaultSetState();
mThrown.expect(AccessControlException.class);
mThrown.expectMessage(ExceptionMessage.PERMISSION_DENIED.getMessage(toExceptionMessage(TEST_USER_2.getUser(), Mode.Bits.WRITE, file, "testState1")));
verifySetState(TEST_USER_2, file, expect);
}
}
use of alluxio.SetAndRestoreConfiguration in project alluxio by Alluxio.
the class PermissionCheckTest method setStateSuccess.
@Test
public void setStateSuccess() throws Exception {
// set unmask
try (SetAndRestoreConfiguration c = new SetAndRestoreConfiguration(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK, "000")) {
String file = PathUtils.concatPath(TEST_DIR_URI, "testState1");
verifyCreateFile(TEST_USER_1, file, false);
SetAttributeOptions expect = getNonDefaultSetState();
SetAttributeOptions result = verifySetState(TEST_USER_2, file, expect);
Assert.assertEquals(expect.getTtl(), result.getTtl());
Assert.assertEquals(expect.getTtlAction(), result.getTtlAction());
Assert.assertEquals(expect.getPinned(), result.getPinned());
}
}
use of alluxio.SetAndRestoreConfiguration in project alluxio by Alluxio.
the class PermissionCheckTest method completeFileSuccess.
@Test
public void completeFileSuccess() throws Exception {
// set unmask
try (SetAndRestoreConfiguration c = new SetAndRestoreConfiguration(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK, "044")) {
String file = PathUtils.concatPath(TEST_DIR_URI, "/testState1");
verifyCreateFile(TEST_USER_1, file, false);
CompleteFileOptions expect = getNonDefaultCompleteFileOptions();
verifyCompleteFile(TEST_USER_2, file, expect);
}
}
Aggregations