use of alluxio.master.file.options.MountOptions in project alluxio by Alluxio.
the class MountTableTest method readOnlyMount.
/**
* Tests check of readonly mount points.
*/
@Test
public void readOnlyMount() throws Exception {
MountOptions options = MountOptions.defaults().setReadOnly(true);
String mountPath = "/mnt/foo";
AlluxioURI alluxioUri = new AlluxioURI("alluxio://localhost:1234" + mountPath);
mMountTable.add(alluxioUri, new AlluxioURI("hdfs://localhost:5678/foo"), options);
try {
mMountTable.checkUnderWritableMountPoint(alluxioUri);
Assert.fail("Readonly mount point should not be writable.");
} catch (AccessControlException e) {
// Exception expected
Assert.assertEquals(ExceptionMessage.MOUNT_READONLY.getMessage(alluxioUri, mountPath), e.getMessage());
}
try {
String path = mountPath + "/sub/directory";
alluxioUri = new AlluxioURI("alluxio://localhost:1234" + path);
mMountTable.checkUnderWritableMountPoint(alluxioUri);
Assert.fail("Readonly mount point should not be writable.");
} catch (AccessControlException e) {
// Exception expected
Assert.assertEquals(ExceptionMessage.MOUNT_READONLY.getMessage(alluxioUri, mountPath), e.getMessage());
}
}
use of alluxio.master.file.options.MountOptions in project alluxio by Alluxio.
the class MountInfoTest method getFields.
/**
* Tests getting fields of {@link MountInfo}.
*/
@Test
public void getFields() {
AlluxioURI uri = new AlluxioURI("alluxio://localhost:19998/test");
MountOptions options = MountOptions.defaults();
MountInfo info = new MountInfo(uri, options);
Assert.assertEquals(uri, info.getUfsUri());
Assert.assertEquals(options, info.getOptions());
}
use of alluxio.master.file.options.MountOptions in project alluxio by Alluxio.
the class FileSystemMaster method mountFromEntry.
/**
* @param entry the entry to use
* @throws FileAlreadyExistsException if the mount point already exists
* @throws InvalidPathException if an invalid path is encountered
* @throws IOException if an I/O exception occurs
*/
private void mountFromEntry(AddMountPointEntry entry) throws FileAlreadyExistsException, InvalidPathException, IOException {
AlluxioURI alluxioURI = new AlluxioURI(entry.getAlluxioPath());
AlluxioURI ufsURI = new AlluxioURI(entry.getUfsPath());
try (LockedInodePath inodePath = mInodeTree.lockInodePath(alluxioURI, InodeTree.LockMode.WRITE)) {
mountInternal(inodePath, ufsURI, true, /* replayed */
new MountOptions(entry));
}
}
Aggregations