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