@Override @SuppressFBWarnings( value = "DMI_HARDCODED_ABSOLUTE_FILENAME", justification = "Findbugs doesn't like the use of an absolute path. However, we need one " + "here so that generated journals are portable across machines") public void apply(FileSystem fs) throws Exception { new File(LOCAL_FS_MOUNT_DIR).mkdirs(); fs.mount(ALLUXIO_MOUNT_PATH, UFS_MOUNT_PATH); new File(LOCAL_FS_UNMOUNT_DIR).mkdirs(); fs.mount(ALLUXIO_UNMOUNT_PATH, UFS_UNMOUNT_PATH); fs.unmount(ALLUXIO_UNMOUNT_PATH); }
@Override public int run(CommandLine cl) throws AlluxioException, IOException { String[] args = cl.getArgs(); if (args.length == 0) { Map<String, MountPointInfo> mountTable = mFileSystem.getMountTable(); UfsCommand.printMountInfo(mountTable); return 0; } AlluxioURI alluxioPath = new AlluxioURI(args[0]); AlluxioURI ufsPath = new AlluxioURI(args[1]); MountPOptions.Builder optionsBuilder = MountPOptions.newBuilder(); if (cl.hasOption(READONLY_OPTION.getLongOpt())) { optionsBuilder.setReadOnly(true); } if (cl.hasOption(SHARED_OPTION.getLongOpt())) { optionsBuilder.setShared(true); } if (cl.hasOption(OPTION_OPTION.getLongOpt())) { Properties properties = cl.getOptionProperties(OPTION_OPTION.getLongOpt()); optionsBuilder.putAllProperties(Maps.fromProperties(properties)); } mFileSystem.mount(alluxioPath, ufsPath, optionsBuilder.build()); System.out.println("Mounted " + ufsPath + " at " + alluxioPath); return 0; }
/** * Tests for the {@link BaseFileSystem#mount(AlluxioURI, AlluxioURI, MountPOptions)} method. */ @Test public void mount() throws Exception { AlluxioURI alluxioPath = new AlluxioURI("/t"); AlluxioURI ufsPath = new AlluxioURI("/u"); MountPOptions mountOptions = MountPOptions.getDefaultInstance(); doNothing().when(mFileSystemMasterClient).mount(alluxioPath, ufsPath, mountOptions); mFileSystem.mount(alluxioPath, ufsPath, mountOptions); verify(mFileSystemMasterClient).mount(alluxioPath, ufsPath, mountOptions); verifyFilesystemContextAcquiredAndReleased(); }
/** * Ensures that an exception is propagated correctly when mounting a path. */ @Test public void mountException() throws Exception { AlluxioURI alluxioPath = new AlluxioURI("/t"); AlluxioURI ufsPath = new AlluxioURI("/u"); MountPOptions mountOptions = MountPOptions.getDefaultInstance(); doThrow(EXCEPTION).when(mFileSystemMasterClient) .mount(alluxioPath, ufsPath, mountOptions); try { mFileSystem.mount(alluxioPath, ufsPath, mountOptions); fail(SHOULD_HAVE_PROPAGATED_MESSAGE); } catch (Exception e) { assertSame(EXCEPTION, e); } verifyFilesystemContextAcquiredAndReleased(); }
fs.mount(alluxioUri, ufsUri); } catch (InvalidPathException e) {