Search in sources :

Example 1 with MockFileOutStream

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

the class MigrateDefinitionRunTaskTest method before.

@Before
public void before() throws Exception {
    AlluxioConfiguration conf = ConfigurationTestUtils.defaults();
    mMockFileSystem = Mockito.mock(FileSystem.class);
    mMockFileSystemContext = PowerMockito.mock(FileSystemContext.class);
    when(mMockFileSystemContext.getClientContext()).thenReturn(ClientContext.create(conf));
    when(mMockFileSystemContext.getClusterConf()).thenReturn(conf);
    when(mMockFileSystemContext.getPathConf(any(AlluxioURI.class))).thenReturn(conf);
    mMockInStream = new MockFileInStream(TEST_SOURCE_CONTENTS);
    when(mMockFileSystem.openFile(eq(new AlluxioURI(TEST_SOURCE)), any(OpenFilePOptions.class))).thenReturn(mMockInStream);
    mMockOutStream = new MockFileOutStream(mMockFileSystemContext);
    when(mMockFileSystem.createFile(eq(new AlluxioURI(TEST_DESTINATION)), any(CreateFilePOptions.class))).thenReturn(mMockOutStream);
    mMockUfsManager = Mockito.mock(UfsManager.class);
}
Also used : UfsManager(alluxio.underfs.UfsManager) MockFileOutStream(alluxio.client.file.MockFileOutStream) FileSystem(alluxio.client.file.FileSystem) FileSystemContext(alluxio.client.file.FileSystemContext) CreateFilePOptions(alluxio.grpc.CreateFilePOptions) OpenFilePOptions(alluxio.grpc.OpenFilePOptions) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) MockFileInStream(alluxio.client.file.MockFileInStream) AlluxioURI(alluxio.AlluxioURI) Before(org.junit.Before)

Aggregations

AlluxioURI (alluxio.AlluxioURI)1 FileSystem (alluxio.client.file.FileSystem)1 FileSystemContext (alluxio.client.file.FileSystemContext)1 MockFileInStream (alluxio.client.file.MockFileInStream)1 MockFileOutStream (alluxio.client.file.MockFileOutStream)1 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)1 CreateFilePOptions (alluxio.grpc.CreateFilePOptions)1 OpenFilePOptions (alluxio.grpc.OpenFilePOptions)1 UfsManager (alluxio.underfs.UfsManager)1 Before (org.junit.Before)1