use of alluxio.worker.block.options.OpenUfsBlockOptions in project alluxio by Alluxio.
the class UnderFileSystemBlockStoreTest method before.
@Before
public void before() throws Exception {
mAlluxioBlockStore = Mockito.mock(BlockStore.class);
LockBlockTOptions options = new LockBlockTOptions();
options.setMaxUfsReadConcurrency(5);
options.setBlockSize(TEST_BLOCK_SIZE);
options.setOffset(TEST_BLOCK_SIZE);
options.setUfsPath(mFolder.newFile().getAbsolutePath());
mOpenUfsBlockOptions = new OpenUfsBlockOptions(options);
}
use of alluxio.worker.block.options.OpenUfsBlockOptions in project alluxio by Alluxio.
the class BlockWorkerTest method closeUnderFileSystemBlock.
@Test
public void closeUnderFileSystemBlock() throws Exception {
long blockId = mRandom.nextLong();
LockBlockTOptions lockBlockTOptions = new LockBlockTOptions();
lockBlockTOptions.setMaxUfsReadConcurrency(10);
lockBlockTOptions.setUfsPath("/a");
OpenUfsBlockOptions openUfsBlockOptions = new OpenUfsBlockOptions(lockBlockTOptions);
long sessionId = 1;
for (; sessionId < 11; sessionId++) {
Assert.assertTrue(mBlockWorker.openUfsBlock(sessionId, blockId, openUfsBlockOptions));
mBlockWorker.closeUfsBlock(sessionId, blockId);
}
Assert.assertTrue(mBlockWorker.openUfsBlock(sessionId, blockId, openUfsBlockOptions));
}
use of alluxio.worker.block.options.OpenUfsBlockOptions in project alluxio by Alluxio.
the class BlockWorkerTest method openUnderFileSystemBlock.
@Test
public void openUnderFileSystemBlock() throws Exception {
long blockId = mRandom.nextLong();
LockBlockTOptions lockBlockTOptions = new LockBlockTOptions();
lockBlockTOptions.setMaxUfsReadConcurrency(10);
lockBlockTOptions.setUfsPath("/a");
OpenUfsBlockOptions openUfsBlockOptions = new OpenUfsBlockOptions(lockBlockTOptions);
long sessionId = 1;
for (; sessionId < 11; sessionId++) {
Assert.assertTrue(mBlockWorker.openUfsBlock(sessionId, blockId, openUfsBlockOptions));
}
Assert.assertFalse(mBlockWorker.openUfsBlock(sessionId, blockId, openUfsBlockOptions));
}
use of alluxio.worker.block.options.OpenUfsBlockOptions in project alluxio by Alluxio.
the class UnderFileSystemBlockReaderTest method before.
@Before
public void before() throws Exception {
Configuration.set(PropertyKey.UNDERFS_ADDRESS, mFolder.getRoot().getAbsolutePath());
String testFilePath = mFolder.newFile().getAbsolutePath();
byte[] buffer = BufferUtils.getIncreasingByteArray((int) TEST_BLOCK_SIZE * 2);
BufferUtils.writeBufferToFile(testFilePath, buffer);
mAlluxioBlockStore = Mockito.mock(BlockStore.class);
mTempBlockMeta = Mockito.mock(TempBlockMeta.class);
Mockito.when(mAlluxioBlockStore.createBlock(Mockito.anyLong(), Mockito.anyLong(), Mockito.any(BlockStoreLocation.class), Mockito.anyLong())).thenReturn(mTempBlockMeta);
Mockito.when(mTempBlockMeta.getPath()).thenReturn(mFolder.newFile().getAbsolutePath());
LockBlockTOptions options = new LockBlockTOptions();
options.setMaxUfsReadConcurrency(10);
options.setBlockSize(TEST_BLOCK_SIZE);
options.setOffset(TEST_BLOCK_SIZE);
options.setUfsPath(testFilePath);
mUnderFileSystemBlockMeta = new UnderFileSystemBlockMeta(SESSION_ID, BLOCK_ID, new OpenUfsBlockOptions(options));
}
Aggregations