Search in sources :

Example 1 with OpenUfsBlockOptions

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);
}
Also used : OpenUfsBlockOptions(alluxio.worker.block.options.OpenUfsBlockOptions) LockBlockTOptions(alluxio.thrift.LockBlockTOptions) Before(org.junit.Before)

Example 2 with OpenUfsBlockOptions

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));
}
Also used : OpenUfsBlockOptions(alluxio.worker.block.options.OpenUfsBlockOptions) LockBlockTOptions(alluxio.thrift.LockBlockTOptions) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with 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));
}
Also used : OpenUfsBlockOptions(alluxio.worker.block.options.OpenUfsBlockOptions) LockBlockTOptions(alluxio.thrift.LockBlockTOptions) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with 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));
}
Also used : UnderFileSystemBlockMeta(alluxio.worker.block.meta.UnderFileSystemBlockMeta) OpenUfsBlockOptions(alluxio.worker.block.options.OpenUfsBlockOptions) TempBlockMeta(alluxio.worker.block.meta.TempBlockMeta) LockBlockTOptions(alluxio.thrift.LockBlockTOptions) Before(org.junit.Before)

Aggregations

LockBlockTOptions (alluxio.thrift.LockBlockTOptions)4 OpenUfsBlockOptions (alluxio.worker.block.options.OpenUfsBlockOptions)4 Before (org.junit.Before)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 TempBlockMeta (alluxio.worker.block.meta.TempBlockMeta)1 UnderFileSystemBlockMeta (alluxio.worker.block.meta.UnderFileSystemBlockMeta)1