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);
}
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);
}
}
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());
}
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());
}
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());
}
Aggregations