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 class
AbstractNonParameterizedJerseyStreamingHttpServiceTest.RouterApi
-
Field Summary
Fields Modifier and Type Field Description protected AbstractNonParameterizedJerseyStreamingHttpServiceTest.RouterApi
api
org.junit.rules.ExpectedException
expected
org.mockito.junit.MockitoRule
rule
static ExecutionContextRule
SERVER_CTX
ServiceTalkTestTimeout
timeout
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNonParameterizedJerseyStreamingHttpServiceTest(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.Application
application()
protected ServerContext
buildRouter(HttpServerBuilder httpServerBuilder, BlockingHttpService router)
protected ServerContext
buildRouter(HttpServerBuilder httpServerBuilder, BlockingStreamingHttpService router)
protected ServerContext
buildRouter(HttpServerBuilder httpServerBuilder, HttpService router)
protected ServerContext
buildRouter(HttpServerBuilder httpServerBuilder, StreamingHttpService router)
void
closeClient()
void
closeServer()
protected void
configureBuilders(HttpServerBuilder serverBuilder, HttpJerseyRouterBuilder jerseyRouterBuilder)
static java.util.Collection<java.lang.Object[]>
data()
protected StreamingHttpRequest
get(java.lang.String path)
protected java.util.function.Function<java.lang.String,java.lang.Integer>
getJsonResponseContentLengthExtractor()
protected StreamingHttpRequest
head(java.lang.String path)
protected java.lang.String
host()
void
initServerAndClient()
protected boolean
isStreamingJsonEnabled()
protected StreamingHttpRequest
noPayloadRequest(HttpRequestMethod method, java.lang.String path)
protected StreamingHttpRequest
options(java.lang.String path)
protected StreamingHttpRequest
payloadRequest(HttpRequestMethod method, java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)
protected StreamingHttpRequest
post(java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)
protected StreamingHttpRequest
put(java.lang.String path, java.lang.CharSequence payload, java.lang.CharSequence contentType)
protected static void
runTwiceToEnsureEndpointCache(java.lang.Runnable test)
Runs the providedtest
lambda multiple times.protected StreamingHttpResponse
sendAndAssertNoResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus)
protected StreamingHttpResponse
sendAndAssertResponse(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 StreamingHttpResponse
sendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, java.lang.String expectedContent)
protected StreamingHttpResponse
sendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, java.lang.String expectedContent, int timeout, java.util.concurrent.TimeUnit unit)
protected StreamingHttpResponse
sendAndAssertResponse(StreamingHttpRequest req, HttpResponseStatus expectedStatus, java.lang.CharSequence expectedContentType, org.hamcrest.Matcher<java.lang.String> contentMatcher, int expectedContentLength)
protected StreamingHttpResponse
sendAndAssertResponse(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.String
sendAndAssertStatusOnly(StreamingHttpRequest req, HttpResponseStatus expectedStatus)
protected java.lang.String
testUri(java.lang.String path)
protected StreamingHttpRequest
withHeader(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 providedtest
lambda 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
-Runnable
test callback will be executed multiple times, typically this is run from a @Test
within a single setup/teardown cycle
-
-