use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class ResponseFilterHandlerTest method doExceptionCaught_delegates_to_executeResponseFilters_and_returns_CONTINUE.
@Test
public void doExceptionCaught_delegates_to_executeResponseFilters_and_returns_CONTINUE() throws Exception {
// given
Throwable ex = mock(Throwable.class);
doNothing().when(handlerSpy).executeResponseFilters(any());
// when
PipelineContinuationBehavior result = handlerSpy.doExceptionCaught(ctxMock, ex);
// then
assertThat(result).isEqualTo(CONTINUE);
verify(handlerSpy).executeResponseFilters(ctxMock);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class ResponseFilterHandlerTest method doChannelRead_delegates_to_executeResponseFilters_and_returns_CONTINUE_if_msg_is_first_chunk_of_response.
@DataProvider(value = { "true", "false" }, splitBy = "\\|")
@Test
public void doChannelRead_delegates_to_executeResponseFilters_and_returns_CONTINUE_if_msg_is_first_chunk_of_response(boolean chunkedResponse) throws Exception {
// given
OutboundMessage msg = (chunkedResponse) ? mock(OutboundMessageSendHeadersChunkFromResponseInfo.class) : mock(LastOutboundMessageSendFullResponseInfo.class);
doNothing().when(handlerSpy).executeResponseFilters(any());
// when
PipelineContinuationBehavior result = handlerSpy.doChannelRead(ctxMock, msg);
// then
assertThat(result).isEqualTo(CONTINUE);
verify(handlerSpy).executeResponseFilters(ctxMock);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class ResponseFilterHandlerTest method doChannelRead_does_nothing_and_returns_CONTINUE_if_msg_is_not_a_first_chunk.
@Test
public void doChannelRead_does_nothing_and_returns_CONTINUE_if_msg_is_not_a_first_chunk() throws Exception {
// given
Object msg = new OutboundMessage() {
};
// when
PipelineContinuationBehavior result = handlerSpy.doChannelRead(ctxMock, msg);
// then
assertThat(result).isEqualTo(CONTINUE);
verify(handlerSpy, never()).executeResponseFilters(any());
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class OpenChannelLimitHandlerTest method doChannelActive_adds_channel_to_channelGroup_if_open_channel_count_lower_than_max_threshold.
@Test
public void doChannelActive_adds_channel_to_channelGroup_if_open_channel_count_lower_than_max_threshold() throws Exception {
// given
setActualOpenChannels(maxOpenChannelsThreshold - 1);
// when
PipelineContinuationBehavior result = handler.doChannelActive(ctxMock);
// then
assertThat(result).isEqualTo(CONTINUE);
verify(channelGroupMock).add(channelMock);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class OpenChannelLimitHandlerTest method doChannelActive_marks_and_schedules_double_check_timeout_if_too_many_open_channels.
@DataProvider(value = { "0", "1" })
@Test
public void doChannelActive_marks_and_schedules_double_check_timeout_if_too_many_open_channels(int numOpenChannelsGreaterThanMax) throws Exception {
// given
int actualOpenChannels = maxOpenChannelsThreshold + numOpenChannelsGreaterThanMax;
setActualOpenChannels(actualOpenChannels);
// when
PipelineContinuationBehavior result = handler.doChannelActive(ctxMock);
// then
assertThat(result).isEqualTo(CONTINUE);
Pair<Runnable, GenericFutureListener> futureInfoPair = extractDoubleCheckRunnableAndCloseFutureListener();
verify(tooManyOpenConnectionsAttributeMock).set(actualOpenChannels);
verifyDoubleCheckFuture(futureInfoPair.getLeft());
verifyCloseFutureListener(futureInfoPair.getRight());
verify(channelGroupMock, never()).add(channelMock);
}
Aggregations