Search in sources :

Example 6 with SetAndRestoreConfiguration

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);
    }
}
Also used : SetAttributeOptions(alluxio.master.file.options.SetAttributeOptions) SetAndRestoreConfiguration(alluxio.SetAndRestoreConfiguration) Test(org.junit.Test)

Example 7 with SetAndRestoreConfiguration

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());
    }
}
Also used : SetAttributeOptions(alluxio.master.file.options.SetAttributeOptions) SetAndRestoreConfiguration(alluxio.SetAndRestoreConfiguration) Test(org.junit.Test)

Example 8 with SetAndRestoreConfiguration

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);
    }
}
Also used : SetAndRestoreConfiguration(alluxio.SetAndRestoreConfiguration) CompleteFileOptions(alluxio.master.file.options.CompleteFileOptions) Test(org.junit.Test)

Aggregations

SetAndRestoreConfiguration (alluxio.SetAndRestoreConfiguration)8 Test (org.junit.Test)7 CompleteFileOptions (alluxio.master.file.options.CompleteFileOptions)2 SetAttributeOptions (alluxio.master.file.options.SetAttributeOptions)2