Search in sources :

Example 41 with ConfigurationRule

use of alluxio.ConfigurationRule in project alluxio by Alluxio.

the class PermissionCheckTest method setStateSuccess.

@Test
public void setStateSuccess() throws Exception {
    // set unmask
    try (Closeable c = new ConfigurationRule(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK, "000", ServerConfiguration.global()).toResource()) {
        String file = PathUtils.concatPath(TEST_DIR_URI, "testState1");
        verifyCreateFile(TEST_USER_1, file, false);
        SetAttributePOptions expect = getNonDefaultSetState();
        SetAttributePOptions result = verifySetState(TEST_USER_2, file, expect);
        assertEquals(expect.getCommonOptions().getTtl(), result.getCommonOptions().getTtl());
        assertEquals(expect.getCommonOptions().getTtlAction(), result.getCommonOptions().getTtlAction());
        assertEquals(expect.getPinned(), result.getPinned());
    }
}
Also used : SetAttributePOptions(alluxio.grpc.SetAttributePOptions) Closeable(java.io.Closeable) ConfigurationRule(alluxio.ConfigurationRule) Test(org.junit.Test)

Example 42 with ConfigurationRule

use of alluxio.ConfigurationRule in project alluxio by Alluxio.

the class PermissionCheckTest method completeFileSuccess.

@Test
public void completeFileSuccess() throws Exception {
    // set unmask
    try (Closeable c = new ConfigurationRule(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK, "044", ServerConfiguration.global()).toResource()) {
        String file = PathUtils.concatPath(TEST_DIR_URI, "/testState1");
        verifyCreateFile(TEST_USER_1, file, false);
        CompleteFileContext expect = getNonDefaultCompleteFileContext();
        verifyCompleteFile(TEST_USER_2, file, expect);
    }
}
Also used : Closeable(java.io.Closeable) CompleteFileContext(alluxio.master.file.contexts.CompleteFileContext) ConfigurationRule(alluxio.ConfigurationRule) Test(org.junit.Test)

Aggregations

ConfigurationRule (alluxio.ConfigurationRule)42 Closeable (java.io.Closeable)42 Test (org.junit.Test)40 HashMap (java.util.HashMap)16 File (java.io.File)6 AlluxioURI (alluxio.AlluxioURI)5 PropertyKey (alluxio.conf.PropertyKey)5 SeekableUnderFileInputStream (alluxio.underfs.SeekableUnderFileInputStream)5 TieredIdentity (alluxio.wire.TieredIdentity)5 InputStream (java.io.InputStream)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 UnderFileSystemConfiguration (alluxio.underfs.UnderFileSystemConfiguration)4 LocalityTier (alluxio.wire.TieredIdentity.LocalityTier)4 WorkerNetAddress (alluxio.wire.WorkerNetAddress)4 Random (java.util.Random)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 URIStatus (alluxio.client.file.URIStatus)3 CreateFilePOptions (alluxio.grpc.CreateFilePOptions)2 SetAttributePOptions (alluxio.grpc.SetAttributePOptions)2 ConnectDetails (alluxio.master.MasterInquireClient.ConnectDetails)2