use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project alluxio by Alluxio.
the class DataServerBlockReadHandlerTest method before.
@Before
public void before() throws Exception {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);
mBlockWorker = Mockito.mock(BlockWorker.class);
Mockito.doNothing().when(mBlockWorker).accessBlock(Mockito.anyLong(), Mockito.anyLong());
mChannel = new EmbeddedChannel(new DataServerBlockReadHandler(NettyExecutors.BLOCK_READER_EXECUTOR, mBlockWorker, FileTransferType.MAPPED));
mChannelNoException = new EmbeddedNoExceptionChannel(new DataServerBlockReadHandler(NettyExecutors.BLOCK_READER_EXECUTOR, mBlockWorker, FileTransferType.MAPPED));
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project jackrabbit-oak by apache.
the class GetSegmentRequestHandlerTest method successfulReadsShouldGenerateResponses.
@Test
public void successfulReadsShouldGenerateResponses() throws Exception {
byte[] data = new byte[] { 3, 4, 5 };
StandbySegmentReader reader = mock(StandbySegmentReader.class);
when(reader.readSegment("segmentId")).thenReturn(data);
EmbeddedChannel channel = new EmbeddedChannel(new GetSegmentRequestHandler(reader));
channel.writeInbound(new GetSegmentRequest("clientId", "segmentId"));
GetSegmentResponse response = (GetSegmentResponse) channel.readOutbound();
assertEquals("clientId", response.getClientId());
assertEquals("segmentId", response.getSegmentId());
assertArrayEquals(data, response.getSegmentData());
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project jackrabbit-oak by apache.
the class GetBlobRequestEncoderTest method encodeRequest.
@Test
public void encodeRequest() throws Exception {
EmbeddedChannel channel = new EmbeddedChannel(new GetBlobRequestEncoder());
channel.writeOutbound(new GetBlobRequest("clientId", "blobId"));
String message = (String) channel.readOutbound();
assertEquals(newGetBlobRequest("clientId", "blobId"), message);
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project jackrabbit-oak by apache.
the class RequestDecoderTest method shouldDecodeValidGetHeadRequests.
@Test
public void shouldDecodeValidGetHeadRequests() throws Exception {
EmbeddedChannel channel = new EmbeddedChannel(new RequestDecoder());
channel.writeInbound(Messages.newGetHeadRequest("clientId", false));
GetHeadRequest request = (GetHeadRequest) channel.readInbound();
assertEquals("clientId", request.getClientId());
}
use of org.apache.flink.shaded.netty4.io.netty.channel.embedded.EmbeddedChannel in project jackrabbit-oak by apache.
the class RequestDecoderTest method shouldDecodeValidGetBlobRequests.
@Test
public void shouldDecodeValidGetBlobRequests() throws Exception {
EmbeddedChannel channel = new EmbeddedChannel(new RequestDecoder());
channel.writeInbound(Messages.newGetBlobRequest("clientId", "blobId", false));
GetBlobRequest request = (GetBlobRequest) channel.readInbound();
assertEquals("clientId", request.getClientId());
assertEquals("blobId", request.getBlobId());
}
Aggregations