Search in sources :

Example 56 with PipelineContinuationBehavior

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);
}
Also used : PipelineContinuationBehavior(com.nike.riposte.server.handler.base.PipelineContinuationBehavior) Test(org.junit.Test)

Example 57 with PipelineContinuationBehavior

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);
}
Also used : PipelineContinuationBehavior(com.nike.riposte.server.handler.base.PipelineContinuationBehavior) Test(org.junit.Test)

Example 58 with PipelineContinuationBehavior

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);
}
Also used : PipelineContinuationBehavior(com.nike.riposte.server.handler.base.PipelineContinuationBehavior) Function(java.util.function.Function) Test(org.junit.Test)

Example 59 with PipelineContinuationBehavior

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);
}
Also used : PipelineContinuationBehavior(com.nike.riposte.server.handler.base.PipelineContinuationBehavior) Test(org.junit.Test)

Example 60 with PipelineContinuationBehavior

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));
}
Also used : PipelineContinuationBehavior(com.nike.riposte.server.handler.base.PipelineContinuationBehavior) Test(org.junit.Test)

Aggregations

PipelineContinuationBehavior (com.nike.riposte.server.handler.base.PipelineContinuationBehavior)75 Test (org.junit.Test)73 DataProvider (com.tngtech.java.junit.dataprovider.DataProvider)20 RequestInfo (com.nike.riposte.server.http.RequestInfo)5 Span (com.nike.wingtips.Span)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)4 LastOutboundMessageSendFullResponseInfo (com.nike.riposte.server.channelpipeline.message.LastOutboundMessageSendFullResponseInfo)4 HttpProcessingState (com.nike.riposte.server.http.HttpProcessingState)4 ResponseInfo (com.nike.riposte.server.http.ResponseInfo)4 RequestAndResponseFilter (com.nike.riposte.server.http.filter.RequestAndResponseFilter)4 ChannelFuture (io.netty.channel.ChannelFuture)4 HttpObject (io.netty.handler.codec.http.HttpObject)4 LastHttpContent (io.netty.handler.codec.http.LastHttpContent)4 Pair (com.nike.internal.util.Pair)3 HttpContent (io.netty.handler.codec.http.HttpContent)3 ChannelAttributes (com.nike.riposte.server.channelpipeline.ChannelAttributes)2 OutboundMessage (com.nike.riposte.server.channelpipeline.message.OutboundMessage)2 OutboundMessageSendHeadersChunkFromResponseInfo (com.nike.riposte.server.channelpipeline.message.OutboundMessageSendHeadersChunkFromResponseInfo)2 IncompleteHttpCallTimeoutException (com.nike.riposte.server.error.exception.IncompleteHttpCallTimeoutException)2 TooManyOpenChannelsException (com.nike.riposte.server.error.exception.TooManyOpenChannelsException)2