Search in sources :

Example 1 with UnmountPOptions

use of alluxio.grpc.UnmountPOptions in project alluxio by Alluxio.

the class BaseFileSystemTest method unmount.

/**
 * Tests for the {@link BaseFileSystem#unmount(AlluxioURI, UnmountPOptions)} method.
 */
@Test
public void unmount() throws Exception {
    AlluxioURI path = new AlluxioURI("/");
    UnmountPOptions unmountOptions = UnmountPOptions.getDefaultInstance();
    doNothing().when(mFileSystemMasterClient).unmount(path);
    mFileSystem.unmount(path, unmountOptions);
    verify(mFileSystemMasterClient).unmount(path);
}
Also used : UnmountPOptions(alluxio.grpc.UnmountPOptions) AlluxioURI(alluxio.AlluxioURI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with UnmountPOptions

use of alluxio.grpc.UnmountPOptions in project alluxio by Alluxio.

the class BaseFileSystemTest method unmountException.

/**
 * Ensures that an exception is propagated successfully when unmounting a path.
 */
@Test
public void unmountException() throws Exception {
    AlluxioURI path = new AlluxioURI("/");
    UnmountPOptions unmountOptions = UnmountPOptions.getDefaultInstance();
    doThrow(EXCEPTION).when(mFileSystemMasterClient).unmount(path);
    try {
        mFileSystem.unmount(path, unmountOptions);
        fail(SHOULD_HAVE_PROPAGATED_MESSAGE);
    } catch (Exception e) {
        assertSame(EXCEPTION, e);
    }
}
Also used : UnmountPOptions(alluxio.grpc.UnmountPOptions) AlluxioURI(alluxio.AlluxioURI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with UnmountPOptions

use of alluxio.grpc.UnmountPOptions in project alluxio by Alluxio.

the class BaseFileSystem method unmount.

@Override
public void unmount(AlluxioURI path, UnmountPOptions options) throws IOException, AlluxioException {
    checkUri(path);
    rpc(client -> {
        UnmountPOptions mergedOptions = FileSystemOptions.unmountDefaults(mFsContext.getPathConf(path)).toBuilder().mergeFrom(options).build();
        client.unmount(path);
        LOG.debug("Unmounted {}, options: {}", path.getPath(), mergedOptions);
        return null;
    });
}
Also used : UnmountPOptions(alluxio.grpc.UnmountPOptions)

Aggregations

UnmountPOptions (alluxio.grpc.UnmountPOptions)3 AlluxioURI (alluxio.AlluxioURI)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2