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));
}
}
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));
}
}
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));
}
}
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));
}
}
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));
}
}
Aggregations