use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class RequestContentValidationHandlerTest method doChannelRead_does_nothing_if_request_isContentDeserializerSetup_returns_false.
@Test
public void doChannelRead_does_nothing_if_request_isContentDeserializerSetup_returns_false() throws Exception {
// given
doReturn(false).when(requestInfoMock).isContentDeserializerSetup();
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verifyNoMoreInteractions(requestValidatorMock);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class RequestContentValidationHandlerTest method doChannelRead_does_not_call_request_getContent_method_if_endpoint_does_not_want_validation.
@Test
public void doChannelRead_does_not_call_request_getContent_method_if_endpoint_does_not_want_validation() throws Exception {
// given
doReturn(false).when(endpointMock).isValidateRequestContent(any());
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verify(requestInfoMock, never()).getContent();
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class RequestContentValidationHandlerTest method doChannelRead_delegates_to_async_processing_when_requested_by_endpoint.
@Test
public void doChannelRead_delegates_to_async_processing_when_requested_by_endpoint() throws Exception {
// given
doReturn(true).when(endpointMock).shouldValidateAsynchronously(requestInfoMock);
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verify(stateMock).addPreEndpointExecutionWorkChainSegment(any(Function.class));
verifyZeroInteractions(requestValidatorMock);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class ChannelPipelineFinalizerHandlerTest method doChannelInactive_does_not_explode_if_crazy_exception_occurs.
@Test
public void doChannelInactive_does_not_explode_if_crazy_exception_occurs() throws Exception {
// given
doThrow(new RuntimeException("kaboom")).when(proxyRouterProcessingStateAttributeMock).get();
// when
PipelineContinuationBehavior result = handler.doChannelInactive(ctxMock);
// then
Assertions.assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class DTraceStartHandlerTest method doChannelRead_does_not_call_startTrace_if_msg_is_not_HttpRequest_but_it_does_return_CONTINUE.
@Test
public void doChannelRead_does_not_call_startTrace_if_msg_is_not_HttpRequest_but_it_does_return_CONTINUE() throws Exception {
// given
DTraceStartHandler handlerSpy = spy(handler);
// when
PipelineContinuationBehavior result = handlerSpy.doChannelRead(ctxMock, new Object());
// then
verify(handlerSpy, times(0)).startTrace(any());
assertThat(result, is(PipelineContinuationBehavior.CONTINUE));
}
Aggregations