Search in sources :

Example 6 with FileSystemMasterClient

use of alluxio.client.file.FileSystemMasterClient in project alluxio by Alluxio.

the class LineageFileOutStreamTest method persistHandledByMaster.

@Test
public void persistHandledByMaster() throws Exception {
    FileSystemContext context = PowerMockito.mock(FileSystemContext.class);
    FileSystemMasterClient client = PowerMockito.mock(FileSystemMasterClient.class);
    Mockito.when(context.acquireMasterClientResource()).thenReturn(new DummyCloseableResource<>(client));
    LineageFileOutStream stream = new LineageFileOutStream(context, new AlluxioURI("/path"), OutStreamOptions.defaults().setWriteType(WriteType.ASYNC_THROUGH));
    stream.close();
    // The lineage file out stream doesn't manage asynchronous persistence.
    Mockito.verify(client, Mockito.times(0)).scheduleAsyncPersist(new AlluxioURI("/path"));
}
Also used : FileSystemMasterClient(alluxio.client.file.FileSystemMasterClient) FileSystemContext(alluxio.client.file.FileSystemContext) AlluxioURI(alluxio.AlluxioURI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 7 with FileSystemMasterClient

use of alluxio.client.file.FileSystemMasterClient in project alluxio by Alluxio.

the class LineageFileSystemTest method before.

/**
   * Sets up all dependencies before running a test.
   */
@Before
public void before() throws Exception {
    mLineageMasterClient = PowerMockito.mock(LineageMasterClient.class);
    mLineageContext = PowerMockito.mock(LineageContext.class);
    FileSystemContext fileSystemContext = PowerMockito.mock(FileSystemContext.class);
    Mockito.when(mLineageContext.acquireMasterClient()).thenReturn(mLineageMasterClient);
    FileSystemMasterClient fileSystemMasterClient = PowerMockito.mock(FileSystemMasterClient.class);
    Mockito.when(fileSystemContext.acquireMasterClient()).thenReturn(fileSystemMasterClient);
    Mockito.when(fileSystemMasterClient.getStatus(Mockito.any(AlluxioURI.class))).thenReturn(new URIStatus(new FileInfo()));
    mAlluxioLineageFileSystem = LineageFileSystem.get(fileSystemContext, mLineageContext);
}
Also used : FileSystemMasterClient(alluxio.client.file.FileSystemMasterClient) FileInfo(alluxio.wire.FileInfo) FileSystemContext(alluxio.client.file.FileSystemContext) URIStatus(alluxio.client.file.URIStatus) AlluxioURI(alluxio.AlluxioURI) Before(org.junit.Before)

Aggregations

FileSystemMasterClient (alluxio.client.file.FileSystemMasterClient)7 AlluxioURI (alluxio.AlluxioURI)5 Test (org.junit.Test)4 FileSystemContext (alluxio.client.file.FileSystemContext)2 URIStatus (alluxio.client.file.URIStatus)1 ConnectionFailedException (alluxio.exception.ConnectionFailedException)1 FileInfo (alluxio.wire.FileInfo)1 IOException (java.io.IOException)1 Before (org.junit.Before)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1