Search in sources :

Example 6 with AccessControlException

use of alluxio.exception.AccessControlException in project alluxio by Alluxio.

the class ReadOnlyMountIntegrationTest method renameFile.

@Test
public void renameFile() throws IOException, AlluxioException {
    AlluxioURI srcUri = new AlluxioURI(FILE_PATH);
    AlluxioURI dstUri = new AlluxioURI(FILE_PATH + "_renamed");
    try {
        mFileSystem.rename(srcUri, dstUri);
        Assert.fail("rename should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(srcUri, MOUNT_PATH));
    }
    srcUri = new AlluxioURI(SUB_FILE_PATH);
    dstUri = new AlluxioURI(SUB_FILE_PATH + "_renamed");
    try {
        mFileSystem.rename(srcUri, dstUri);
        Assert.fail("rename should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(srcUri, MOUNT_PATH));
    }
}
Also used : AccessControlException(alluxio.exception.AccessControlException) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 7 with AccessControlException

use of alluxio.exception.AccessControlException in project alluxio by Alluxio.

the class ReadOnlyMountIntegrationTest method createFile.

@Test
public void createFile() throws IOException, AlluxioException {
    CreateFileOptions writeBoth = CreateFileOptions.defaults().setWriteType(WriteType.CACHE_THROUGH);
    AlluxioURI uri = new AlluxioURI(FILE_PATH + "_create");
    try {
        mFileSystem.createFile(uri, writeBoth).close();
        Assert.fail("createFile should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(uri, MOUNT_PATH));
    }
    uri = new AlluxioURI(SUB_FILE_PATH + "_create");
    try {
        mFileSystem.createFile(uri, writeBoth).close();
        Assert.fail("createFile should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(uri, MOUNT_PATH));
    }
}
Also used : CreateFileOptions(alluxio.client.file.options.CreateFileOptions) AccessControlException(alluxio.exception.AccessControlException) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 8 with AccessControlException

use of alluxio.exception.AccessControlException in project alluxio by Alluxio.

the class ReadOnlyMountIntegrationTest method createDirectory.

@Test
public void createDirectory() throws IOException, AlluxioException {
    AlluxioURI uri = new AlluxioURI(PathUtils.concatPath(MOUNT_PATH, "create"));
    try {
        mFileSystem.createDirectory(uri);
        Assert.fail("createDirectory should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(uri, MOUNT_PATH));
    }
    uri = new AlluxioURI(PathUtils.concatPath(SUB_DIR_PATH, "create"));
    try {
        mFileSystem.createDirectory(uri);
        Assert.fail("createDirectory should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(uri, MOUNT_PATH));
    }
}
Also used : AccessControlException(alluxio.exception.AccessControlException) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 9 with AccessControlException

use of alluxio.exception.AccessControlException in project alluxio by Alluxio.

the class ReadOnlyMountIntegrationTest method renameFileDst.

@Test
public void renameFileDst() throws IOException, AlluxioException {
    AlluxioURI srcUri = new AlluxioURI("/tmp");
    AlluxioURI dstUri = new AlluxioURI(FILE_PATH + "_renamed");
    try {
        mFileSystem.rename(srcUri, dstUri);
        Assert.fail("rename should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(dstUri, MOUNT_PATH));
    }
    dstUri = new AlluxioURI(SUB_FILE_PATH + "_renamed");
    try {
        mFileSystem.rename(srcUri, dstUri);
        Assert.fail("rename should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(dstUri, MOUNT_PATH));
    }
}
Also used : AccessControlException(alluxio.exception.AccessControlException) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 10 with AccessControlException

use of alluxio.exception.AccessControlException in project alluxio by Alluxio.

the class ReadOnlyMountIntegrationTest method renameDirectory.

@Test
public void renameDirectory() throws IOException, AlluxioException {
    AlluxioURI srcUri = new AlluxioURI(SUB_DIR_PATH);
    AlluxioURI dstUri = new AlluxioURI(SUB_DIR_PATH + "_renamed");
    try {
        mFileSystem.rename(srcUri, dstUri);
        Assert.fail("renameDirectory should not succeed under a readonly mount.");
    } catch (AccessControlException e) {
        Assert.assertEquals(e.getMessage(), ExceptionMessage.MOUNT_READONLY.getMessage(srcUri, MOUNT_PATH));
    }
}
Also used : AccessControlException(alluxio.exception.AccessControlException) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Aggregations

AccessControlException (alluxio.exception.AccessControlException)18 AlluxioURI (alluxio.AlluxioURI)11 Test (org.junit.Test)9 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)5 InvalidPathException (alluxio.exception.InvalidPathException)3 Inode (alluxio.master.file.meta.Inode)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 AlluxioException (alluxio.exception.AlluxioException)2 FileInfo (alluxio.wire.FileInfo)2 CreateFileOptions (alluxio.client.file.options.CreateFileOptions)1 FileAlreadyCompletedException (alluxio.exception.FileAlreadyCompletedException)1 FileAlreadyExistsException (alluxio.exception.FileAlreadyExistsException)1 InvalidFileSizeException (alluxio.exception.InvalidFileSizeException)1 UnexpectedAlluxioException (alluxio.exception.UnexpectedAlluxioException)1 InodeFile (alluxio.master.file.meta.InodeFile)1 LockedInodePath (alluxio.master.file.meta.LockedInodePath)1 MountTable (alluxio.master.file.meta.MountTable)1 MountInfo (alluxio.master.file.meta.options.MountInfo)1 MountOptions (alluxio.master.file.options.MountOptions)1