use of alluxio.client.RemoteBlockReader in project alluxio by Alluxio.
the class DataServerIntegrationTest method readThroughClient.
@Test
public void readThroughClient() throws Exception {
final int length = 10;
FileSystemTestUtils.createByteFile(mFileSystem, "/file", WriteType.MUST_CACHE, length);
BlockInfo block = getFirstBlockInfo(new AlluxioURI("/file"));
RemoteBlockReader client = RemoteBlockReader.Factory.create(FileSystemContext.INSTANCE);
ByteBuffer result = readRemotely(client, block, length);
Assert.assertEquals(BufferUtils.getIncreasingByteBuffer(length), result);
}
use of alluxio.client.RemoteBlockReader in project alluxio by Alluxio.
the class DataServerIntegrationTest method readThroughClientNonExistent.
// TODO(calvin): Make this work with the new BlockReader.
// @Test
public void readThroughClientNonExistent() throws Exception {
final int length = 10;
FileSystemTestUtils.createByteFile(mFileSystem, "/file", WriteType.MUST_CACHE, length);
BlockInfo block = getFirstBlockInfo(new AlluxioURI("/file"));
// Get the maximum block id, for use in determining a non-existent block id.
URIStatus status = mFileSystem.getStatus(new AlluxioURI("/file"));
long maxBlockId = block.getBlockId();
for (long blockId : status.getBlockIds()) {
if (blockId > maxBlockId) {
maxBlockId = blockId;
}
}
RemoteBlockReader client = RemoteBlockReader.Factory.create(FileSystemContext.INSTANCE);
block.setBlockId(maxBlockId + 1);
ByteBuffer result = readRemotely(client, block, length);
Assert.assertNull(result);
}
Aggregations