Class AbstractNonParameterizedJerseyStreamingHttpServiceTest
- java.lang.Object
-
- io.servicetalk.http.router.jersey.AbstractNonParameterizedJerseyStreamingHttpServiceTest
-
- Direct Known Subclasses:
AbstractJerseyStreamingHttpServiceTest,AbstractResourceTest,ExecutionStrategyTest
public abstract class AbstractNonParameterizedJerseyStreamingHttpServiceTest extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractNonParameterizedJerseyStreamingHttpServiceTest.RouterApi
-
Field Summary
Fields Modifier and Type Field Description protected AbstractNonParameterizedJerseyStreamingHttpServiceTest.RouterApiapiorg.junit.rules.ExpectedExceptionexpectedorg.mockito.junit.MockitoRulerulestatic ExecutionContextRuleSERVER_CTXServiceTalkTestTimeouttimeout
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractNonParameterizedJerseyStreamingHttpServiceTest(AbstractNonParameterizedJerseyStreamingHttpServiceTest.RouterApi api)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract javax.ws.rs.core.Applicationapplication()protected ServerContextbuildRouter(HttpServerBuilder httpServerBuilder, BlockingHttpService router)protected ServerContextbuildRouter(HttpServerBuilder httpServerBuilder, BlockingStreamingHttpService router)protected ServerContextbuildRouter(HttpServerBuilder httpServerBuilder, HttpService router)protected ServerContextbuildRouter(HttpServerBuilder httpServerBuilder, StreamingHttpService router)voidcloseClient()voidcloseServer()protected voidconfigureBuilders(HttpServerBuilder serverBuilder, HttpJerseyRouterBuilder jerseyRouterBuilder)static java.util.Collection<java.lang.Object[]>data()protected StreamingHttpRequestget(java.lang.String path)protected java.util.function.Function<java.lang.String,java.lang.Integer>getJsonResponseContentLengthExtractor()protected StreamingHttpRequesthead(java.lang.String path)protected java.lang.Stringhost()voidinitServerAndClient()protected booleanisStreamingJsonEnabled()protected StreamingHttpRequestnoPayloadRequest(HttpRequestMethod method, java.lang.String path)protected StreamingHttpRequestoptions(java.lang.String path)protected StreamingHttpRequestpayloadRequest(HttpRequestMethod method, java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)protected StreamingHttpRequestpost(java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)protected StreamingHttpRequestput(java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)protected static voidrunTwiceToEnsureEndpointCache(java.lang.Runnable test)Runs the providedtestlambda multiple times.protected StreamingHttpResponsesendAndAssertNoResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus)protected StreamingHttpResponsesendAndAssertResponse(StreamingHttpRequest req, HttpProtocolVersion expectedHttpVersion, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, org.hamcrest.Matcher<java.lang.String> contentMatcher, java.util.function.Function<java.lang.String,java.lang.Integer> expectedContentLengthExtractor)protected StreamingHttpResponsesendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, java.lang.String expectedContent)protected StreamingHttpResponsesendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, java.lang.String expectedContent, int timeout, java.util.concurrent.TimeUnit unit)protected StreamingHttpResponsesendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, org.hamcrest.Matcher<java.lang.String> contentMatcher, int expectedContentLength)protected StreamingHttpResponsesendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, org.hamcrest.Matcher<java.lang.String> contentMatcher, java.util.function.Function<java.lang.String,java.lang.Integer> expectedContentLengthExtractor)protected java.lang.StringsendAndAssertStatusOnly(StreamingHttpRequest req, HttpResponseStatus expectedStatus)protected java.lang.StringtestUri(java.lang.String path)protected StreamingHttpRequestwithHeader(StreamingHttpRequest req, java.lang.String name, java.lang.String value)
-
-
-
Field Detail
-
rule
public final org.mockito.junit.MockitoRule rule
-
timeout
public final ServiceTalkTestTimeout timeout
-
expected
public final org.junit.rules.ExpectedException expected
-
SERVER_CTX
public static final ExecutionContextRule SERVER_CTX
-
api
protected final AbstractNonParameterizedJerseyStreamingHttpServiceTest.RouterApi api
-
-
Constructor Detail
-
AbstractNonParameterizedJerseyStreamingHttpServiceTest
protected AbstractNonParameterizedJerseyStreamingHttpServiceTest(AbstractNonParameterizedJerseyStreamingHttpServiceTest.RouterApi api)
-
-
Method Detail
-
data
public static java.util.Collection<java.lang.Object[]> data()
-
initServerAndClient
public final void initServerAndClient() throws java.lang.Exception- Throws:
java.lang.Exception
-
buildRouter
protected ServerContext buildRouter(HttpServerBuilder httpServerBuilder, HttpService router) throws java.lang.Exception
- Throws:
java.lang.Exception
-
buildRouter
protected ServerContext buildRouter(HttpServerBuilder httpServerBuilder, StreamingHttpService router) throws java.lang.Exception
- Throws:
java.lang.Exception
-
buildRouter
protected ServerContext buildRouter(HttpServerBuilder httpServerBuilder, BlockingHttpService router) throws java.lang.Exception
- Throws:
java.lang.Exception
-
buildRouter
protected ServerContext buildRouter(HttpServerBuilder httpServerBuilder, BlockingStreamingHttpService router) throws java.lang.Exception
- Throws:
java.lang.Exception
-
configureBuilders
protected void configureBuilders(HttpServerBuilder serverBuilder, HttpJerseyRouterBuilder jerseyRouterBuilder)
-
closeClient
public final void closeClient() throws java.lang.Exception- Throws:
java.lang.Exception
-
closeServer
public final void closeServer() throws java.lang.Exception- Throws:
java.lang.Exception
-
application
protected abstract javax.ws.rs.core.Application application()
-
host
protected java.lang.String host()
-
isStreamingJsonEnabled
protected boolean isStreamingJsonEnabled()
-
testUri
protected java.lang.String testUri(java.lang.String path)
-
options
protected StreamingHttpRequest options(java.lang.String path)
-
head
protected StreamingHttpRequest head(java.lang.String path)
-
get
protected StreamingHttpRequest get(java.lang.String path)
-
post
protected StreamingHttpRequest post(java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)
-
put
protected StreamingHttpRequest put(java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)
-
noPayloadRequest
protected StreamingHttpRequest noPayloadRequest(HttpRequestMethod method, java.lang.String path)
-
payloadRequest
protected StreamingHttpRequest payloadRequest(HttpRequestMethod method, java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)
-
withHeader
protected StreamingHttpRequest withHeader(StreamingHttpRequest req, java.lang.String name, java.lang.String value)
-
getJsonResponseContentLengthExtractor
protected java.util.function.Function<java.lang.String,java.lang.Integer> getJsonResponseContentLengthExtractor()
-
sendAndAssertNoResponse
protected StreamingHttpResponse sendAndAssertNoResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus)
-
sendAndAssertStatusOnly
protected java.lang.String sendAndAssertStatusOnly(StreamingHttpRequest req, HttpResponseStatus expectedStatus)
-
sendAndAssertResponse
protected StreamingHttpResponse sendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, @Nullable java.lang.CharSequence expectedContentType, java.lang.String expectedContent)
-
sendAndAssertResponse
protected StreamingHttpResponse sendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, @Nullable java.lang.CharSequence expectedContentType, org.hamcrest.Matcher<java.lang.String> contentMatcher, int expectedContentLength)
-
sendAndAssertResponse
protected StreamingHttpResponse sendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, @Nullable java.lang.CharSequence expectedContentType, org.hamcrest.Matcher<java.lang.String> contentMatcher, java.util.function.Function<java.lang.String,java.lang.Integer> expectedContentLengthExtractor)
-
sendAndAssertResponse
protected StreamingHttpResponse sendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, java.lang.String expectedContent, int timeout, java.util.concurrent.TimeUnit unit)
-
sendAndAssertResponse
protected StreamingHttpResponse sendAndAssertResponse(StreamingHttpRequest req, HttpProtocolVersion expectedHttpVersion, HttpResponseStatus expectedStatus, @Nullable java.lang.CharSequence expectedContentType, org.hamcrest.Matcher<java.lang.String> contentMatcher, java.util.function.Function<java.lang.String,java.lang.Integer> expectedContentLengthExtractor)
-
runTwiceToEnsureEndpointCache
protected static void runTwiceToEnsureEndpointCache(java.lang.Runnable test)
Runs the providedtestlambda multiple times.some tests depend on Endpoint enhancement which is now backed by a cache, so we test the test code multiple times to ensure that the caching of endpoints doesn't cause any weird side-effects.
- Parameters:
test-Runnabletest callback will be executed multiple times, typically this is run from a @Testwithin a single setup/teardown cycle
-
-