use of alluxio.network.protocol.RPCMessageDecoder in project alluxio by Alluxio.
the class AlluxioBlockStoreTest method before.
@Before
public void before() throws Exception {
mBlockWorkerClient = PowerMockito.mock(BlockWorkerClient.class);
mMasterClient = PowerMockito.mock(BlockMasterClient.class);
mChannel = PowerMockito.mock(Channel.class);
mPipeline = PowerMockito.mock(ChannelPipeline.class);
mContext = PowerMockito.mock(FileSystemContext.class);
// Mock block store context to return our mock clients
Mockito.when(mContext.createBlockWorkerClient(Mockito.any(WorkerNetAddress.class))).thenReturn(mBlockWorkerClient);
mLocalAddr = new InetSocketAddress(NetworkAddressUtils.getLocalHostName(), 0);
Mockito.when(mBlockWorkerClient.getDataServerAddress()).thenReturn(mLocalAddr);
Mockito.when(mContext.acquireBlockMasterClientResource()).thenReturn(new DummyCloseableResource<>(mMasterClient));
mBlockStore = new AlluxioBlockStore(mContext, WORKER_HOSTNAME_LOCAL);
Mockito.when(mContext.acquireNettyChannel(Mockito.any(InetSocketAddress.class))).thenReturn(mChannel);
Mockito.when(mChannel.pipeline()).thenReturn(mPipeline);
Mockito.when(mPipeline.last()).thenReturn(new RPCMessageDecoder());
Mockito.when(mPipeline.addLast(Mockito.any(ChannelHandler.class))).thenReturn(mPipeline);
}
use of alluxio.network.protocol.RPCMessageDecoder in project alluxio by Alluxio.
the class PipelineHandler method initChannel.
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("frameDecoder", RPCMessage.createFrameDecoder());
pipeline.addLast("RPCMessageDecoder", new RPCMessageDecoder());
pipeline.addLast("RPCMessageEncoder", new RPCMessageEncoder());
pipeline.addLast("dataServerHandler", mDataServerHandler);
pipeline.addLast("dataServerBlockReadHandler", new DataServerBlockReadHandler(NettyExecutors.BLOCK_READER_EXECUTOR, mWorker.getBlockWorker(), mFileTransferType));
pipeline.addLast("dataServerUfsBlockReadHandler", new DataServerUfsBlockReadHandler(NettyExecutors.UFS_BLOCK_READER_EXECUTOR, mWorker.getBlockWorker()));
pipeline.addLast("dataServerBlockWriteHandler", new DataServerBlockWriteHandler(NettyExecutors.BLOCK_WRITER_EXECUTOR, mWorker.getBlockWorker()));
// DataServerFileReadHandler is deprecated. It is here for backward compatibility.
pipeline.addLast("dataServerFileReadHandler", new DataServerUFSFileReadHandler(NettyExecutors.UFS_BLOCK_READER_EXECUTOR, mWorker.getFileSystemWorker()));
pipeline.addLast("dataServerFileWriteHandler", new DataServerUFSFileWriteHandler(NettyExecutors.FILE_WRITER_EXECUTOR, mWorker.getFileSystemWorker()));
}
Aggregations