Search in sources :

Example 11 with BlockInfo

use of alluxio.wire.BlockInfo in project alluxio by Alluxio.

the class DataServerIntegrationTest method readPartialTest2.

@Test
public void readPartialTest2() throws Exception {
    FileSystemTestUtils.createByteFile(mFileSystem, "/file", WriteType.MUST_CACHE, 10);
    BlockInfo block = getFirstBlockInfo(new AlluxioURI("/file"));
    final int offset = 2;
    final int length = 6;
    DataServerMessage recvMsg = request(block, offset, length);
    assertValid(recvMsg, BufferUtils.getIncreasingByteBuffer(offset, length), block.getBlockId(), offset, length);
}
Also used : BlockInfo(alluxio.wire.BlockInfo) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 12 with BlockInfo

use of alluxio.wire.BlockInfo in project alluxio by Alluxio.

the class DataServerIntegrationTest method multiRead.

@Test
public void multiRead() throws Exception {
    final int length = 20;
    FileSystemTestUtils.createByteFile(mFileSystem, "/file", WriteType.MUST_CACHE, length);
    BlockInfo block = getFirstBlockInfo(new AlluxioURI("/file"));
    for (int i = 0; i < 10; i++) {
        DataServerMessage recvMsg = request(block);
        assertValid(recvMsg, length, block.getBlockId(), 0, length);
    }
}
Also used : BlockInfo(alluxio.wire.BlockInfo) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 13 with BlockInfo

use of alluxio.wire.BlockInfo in project alluxio by Alluxio.

the class DataServerIntegrationTest method tooLargeOffset.

@Test
public void tooLargeOffset() throws Exception {
    final int length = 10;
    FileSystemTestUtils.createByteFile(mFileSystem, "/file", WriteType.MUST_CACHE, length);
    BlockInfo block = getFirstBlockInfo(new AlluxioURI("/file"));
    DataServerMessage recvMsg = request(block, length * 2, 1);
    assertError(recvMsg, block.getBlockId());
}
Also used : BlockInfo(alluxio.wire.BlockInfo) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 14 with BlockInfo

use of alluxio.wire.BlockInfo in project alluxio by Alluxio.

the class DataServerIntegrationTest method lengthTooSmall.

@Test
public void lengthTooSmall() throws Exception {
    final int length = 20;
    FileSystemTestUtils.createByteFile(mFileSystem, "/file", WriteType.MUST_CACHE, length);
    BlockInfo block = getFirstBlockInfo(new AlluxioURI("/file"));
    DataServerMessage recvMsg = request(block, 0, length * -2);
    assertError(recvMsg, block.getBlockId());
}
Also used : BlockInfo(alluxio.wire.BlockInfo) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Example 15 with BlockInfo

use of alluxio.wire.BlockInfo in project alluxio by Alluxio.

the class DataServerIntegrationTest method readMultiFiles.

@Test
public void readMultiFiles() throws Exception {
    final int length = WORKER_CAPACITY_BYTES / 2 + 1;
    FileSystemTestUtils.createByteFile(mFileSystem, "/file1", WriteType.MUST_CACHE, length);
    HeartbeatScheduler.execute(HeartbeatContext.WORKER_BLOCK_SYNC);
    BlockInfo block1 = getFirstBlockInfo(new AlluxioURI("/file1"));
    DataServerMessage recvMsg1 = request(block1);
    assertValid(recvMsg1, length, block1.getBlockId(), 0, length);
    FileSystemTestUtils.createByteFile(mFileSystem, "/file2", WriteType.MUST_CACHE, length);
    HeartbeatScheduler.execute(HeartbeatContext.WORKER_BLOCK_SYNC);
    BlockInfo block2 = getFirstBlockInfo(new AlluxioURI("/file2"));
    DataServerMessage recvMsg2 = request(block2);
    assertValid(recvMsg2, length, block2.getBlockId(), 0, length);
    Assert.assertEquals(0, mFileSystem.getStatus(new AlluxioURI("/file1")).getInMemoryPercentage());
}
Also used : BlockInfo(alluxio.wire.BlockInfo) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test)

Aggregations

BlockInfo (alluxio.wire.BlockInfo)28 Test (org.junit.Test)21 AlluxioURI (alluxio.AlluxioURI)18 BlockLocation (alluxio.wire.BlockLocation)5 FileBlockInfo (alluxio.wire.FileBlockInfo)5 WorkerNetAddress (alluxio.wire.WorkerNetAddress)5 RemoteBlockInStream (alluxio.client.block.RemoteBlockInStream)4 ArrayList (java.util.ArrayList)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 InodeFile (alluxio.master.file.meta.InodeFile)3 IOException (java.io.IOException)3 RemoteBlockReader (alluxio.client.RemoteBlockReader)2 URIStatus (alluxio.client.file.URIStatus)2 LockBlockResource (alluxio.client.resource.LockBlockResource)2 AlluxioException (alluxio.exception.AlluxioException)2 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)2 FileSystemMasterView (alluxio.master.file.meta.FileSystemMasterView)2 FileInfo (alluxio.wire.FileInfo)2 LockBlockResult (alluxio.wire.LockBlockResult)2 BlockWorker (alluxio.worker.block.BlockWorker)2