use of alluxio.worker.block.BlockMasterClientPool in project alluxio by Alluxio.
the class BlockWorkerDataReaderTest method before.
@Before
public void before() throws Exception {
BlockMasterClient blockMasterClient = mock(BlockMasterClient.class);
BlockMasterClientPool blockMasterClientPool = spy(new BlockMasterClientPool());
when(blockMasterClientPool.createNewResource()).thenReturn(blockMasterClient);
TieredBlockStore blockStore = new TieredBlockStore();
FileSystemMasterClient fileSystemMasterClient = mock(FileSystemMasterClient.class);
Sessions sessions = mock(Sessions.class);
// Connect to the real UFS for UFS read testing
UfsManager ufsManager = mock(UfsManager.class);
mRootUfs = ServerConfiguration.getString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS);
UfsManager.UfsClient ufsClient = new UfsManager.UfsClient(() -> UnderFileSystem.Factory.create(mRootUfs, UnderFileSystemConfiguration.defaults(ServerConfiguration.global())), new AlluxioURI(mRootUfs));
when(ufsManager.get(anyLong())).thenReturn(ufsClient);
mBlockWorker = new DefaultBlockWorker(blockMasterClientPool, fileSystemMasterClient, sessions, blockStore, ufsManager);
URIStatus dummyStatus = new URIStatus(new FileInfo().setBlockIds(Collections.singletonList(BLOCK_ID)));
InStreamOptions options = new InStreamOptions(dummyStatus, FileSystemOptions.openFileDefaults(mConf), mConf);
mDataReaderFactory = new BlockWorkerDataReader.Factory(mBlockWorker, BLOCK_ID, CHUNK_SIZE, options);
}
use of alluxio.worker.block.BlockMasterClientPool in project alluxio by Alluxio.
the class BlockWorkerRegisterStreamIntegrationTest method initBlockWorker.
public void initBlockWorker() throws Exception {
// Prepare a block worker
mBlockMasterClientPool = spy(new BlockMasterClientPool());
when(mBlockMasterClientPool.createNewResource()).thenReturn(mBlockMasterClient);
when(mBlockMasterClientPool.acquire()).thenReturn(mBlockMasterClient);
TieredBlockStore mBlockStore = spy(new TieredBlockStore());
FileSystemMasterClient mFileSystemMasterClient = mock(FileSystemMasterClient.class);
Sessions mSessions = mock(Sessions.class);
UfsManager mUfsManager = mock(UfsManager.class);
mBlockWorker = new DefaultBlockWorker(mBlockMasterClientPool, mFileSystemMasterClient, mSessions, mBlockStore, mUfsManager);
}
Aggregations