use of alluxio.worker.block.NoopBlockWorker in project alluxio by Alluxio.
the class BlockReadHandlerTest method before.
@Before
public void before() throws Exception {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);
mFile = mTestFolder.newFile();
mBlockReader = new LocalFileBlockReader(mFile.getPath());
mBlockWorker = new NoopBlockWorker() {
@Override
public BlockReader createBlockReader(BlockReadRequest request) throws IOException {
((FileChannel) mBlockReader.getChannel()).position(request.getStart());
return mBlockReader;
}
};
mResponseObserver = Mockito.mock(ServerCallStreamObserver.class);
Mockito.when(mResponseObserver.isReady()).thenReturn(true);
doAnswer(args -> {
mResponseCompleted = true;
return null;
}).when(mResponseObserver).onCompleted();
doAnswer(args -> {
mResponseCompleted = true;
mError = args.getArgument(0, Throwable.class);
return null;
}).when(mResponseObserver).onError(any(Throwable.class));
doAnswer((args) -> {
// make a copy of response data before it is released
mResponses.add(ReadResponse.parseFrom(args.getArgument(0, ReadResponse.class).toByteString()));
return null;
}).when(mResponseObserver).onNext(any(ReadResponse.class));
mReadHandler = new BlockReadHandler(GrpcExecutors.BLOCK_READER_EXECUTOR, mBlockWorker, mResponseObserver, new AuthenticatedUserInfo(), false);
}
use of alluxio.worker.block.NoopBlockWorker in project alluxio by Alluxio.
the class BlockWriteHandlerTest method before.
@Before
public void before() throws Exception {
mFile = mTestFolder.newFile();
mBlockWorker = new NoopBlockWorker() {
@Override
public BlockWriter createBlockWriter(long sessionId, long blockId) {
return mBlockWriter;
}
};
mBlockWriter = new LocalFileBlockWriter(mFile.getPath());
mResponseObserver = Mockito.mock(StreamObserver.class);
mWriteHandler = new BlockWriteHandler(mBlockWorker, mResponseObserver, mUserInfo, false);
setupResponseTrigger();
}
Aggregations