Search in sources :

Example 1 with GetStatusOptions

use of alluxio.client.file.options.GetStatusOptions in project alluxio by Alluxio.

the class BaseFileSystemTest method getStatusException.

/**
   * Ensures that an exception is propagated correctly when retrieving information.
   */
@Test
public void getStatusException() throws Exception {
    AlluxioURI file = new AlluxioURI("/file");
    Mockito.when(mFileSystemMasterClient.getStatus(file)).thenThrow(EXCEPTION);
    GetStatusOptions getStatusOptions = GetStatusOptions.defaults();
    try {
        mFileSystem.getStatus(file, getStatusOptions);
        Assert.fail(SHOULD_HAVE_PROPAGATED_MESSAGE);
    } catch (Exception e) {
        Assert.assertSame(EXCEPTION, e);
    }
}
Also used : GetStatusOptions(alluxio.client.file.options.GetStatusOptions) AlluxioURI(alluxio.AlluxioURI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with GetStatusOptions

use of alluxio.client.file.options.GetStatusOptions in project alluxio by Alluxio.

the class BaseFileSystemTest method getStatus.

/**
   * Tests for the {@link BaseFileSystem#getStatus(AlluxioURI, GetStatusOptions)} method.
   */
@Test
public void getStatus() throws Exception {
    AlluxioURI file = new AlluxioURI("/file");
    URIStatus status = new URIStatus(new FileInfo());
    Mockito.when(mFileSystemMasterClient.getStatus(file)).thenReturn(status);
    GetStatusOptions getStatusOptions = GetStatusOptions.defaults();
    Assert.assertSame(status, mFileSystem.getStatus(file, getStatusOptions));
    Mockito.verify(mFileSystemMasterClient).getStatus(file);
}
Also used : FileInfo(alluxio.wire.FileInfo) GetStatusOptions(alluxio.client.file.options.GetStatusOptions) AlluxioURI(alluxio.AlluxioURI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

AlluxioURI (alluxio.AlluxioURI)2 GetStatusOptions (alluxio.client.file.options.GetStatusOptions)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 FileInfo (alluxio.wire.FileInfo)1