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.assertThat(e.getMessage(), containsString(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.assertThat(e.getMessage(), containsString(ExceptionMessage.MOUNT_READONLY.getMessage(srcUri, 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.assertThat(e.getMessage(), containsString(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.assertThat(e.getMessage(), containsString(ExceptionMessage.MOUNT_READONLY.getMessage(dstUri, MOUNT_PATH)));
}
}
use of alluxio.exception.AccessControlException in project alluxio by Alluxio.
the class ReadOnlyMountIntegrationTest method chmod.
@Test
public void chmod() throws IOException, AlluxioException {
AlluxioURI uri = new AlluxioURI(FILE_PATH + "_chmod");
try {
mFileSystem.setAttribute(uri, SetAttributePOptions.newBuilder().setMode(new Mode((short) 0555).toProto()).build());
Assert.fail("chomd should not succeed under a readonly mount.");
} catch (AccessControlException e) {
Assert.assertThat(e.getMessage(), containsString(ExceptionMessage.MOUNT_READONLY.getMessage(uri, MOUNT_PATH)));
}
}
use of alluxio.exception.AccessControlException in project alluxio by Alluxio.
the class JournalCheckpointIntegrationTest method recoverUfsState.
@Test
public void recoverUfsState() throws Exception {
FileSystemMasterClient client = new RetryHandlingFileSystemMasterClient(MasterClientContext.newBuilder(ClientContext.create(ServerConfiguration.global())).build());
client.updateUfsMode(new AlluxioURI(""), UpdateUfsModePOptions.newBuilder().setUfsMode(UfsPMode.READ_ONLY).build());
backupAndRestore();
try {
mCluster.getClient().createDirectory(new AlluxioURI("/test"), CreateDirectoryPOptions.newBuilder().setWriteType(WritePType.THROUGH).build());
fail("Expected an exception to be thrown");
} catch (AccessControlException e) {
// Expected
}
}
use of alluxio.exception.AccessControlException in project alluxio by Alluxio.
the class MountTableTest method writableMount.
/**
* Tests check of writable mount points.
*/
@Test
public void writableMount() throws Exception {
String mountPath = "/mnt/foo";
AlluxioURI alluxioUri = new AlluxioURI("alluxio://localhost:1234" + mountPath);
addMount(alluxioUri.toString(), "hdfs://localhost:5678/foo", IdUtils.INVALID_MOUNT_ID);
try {
mMountTable.checkUnderWritableMountPoint(alluxioUri);
} catch (AccessControlException e) {
Assert.fail("Default mount point should be writable.");
}
try {
String path = mountPath + "/sub/directory";
alluxioUri = new AlluxioURI("alluxio://localhost:1234" + path);
mMountTable.checkUnderWritableMountPoint(alluxioUri);
} catch (AccessControlException e) {
Assert.fail("Default mount point should be writable.");
}
}
Aggregations