public abstract class SpincastIntegrationTestBase<R extends IRequestContext<?>> extends SpincastGuiceBasedTestBase
This requires a "IServer" to be bound in the Guice context : it will be stopped after a test class is ran.
It doesn't start the server automatically because most integration tests will have the server started an application (amain(...) method).
All client data (such as cookies) are cleared before each test.| Constructor and Description |
|---|
SpincastIntegrationTestBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterClass() |
void |
before()
Ran before each test.
|
protected void |
clearHttpClientData() |
protected String |
createTestUrl(String path)
Creates an URL to test the HTTP server.
|
protected String |
createTestUrl(String path,
boolean https)
Creates an URL to test the HTTP server.
|
protected SpincastTestHttpResponse |
get(String path)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
get(String path,
boolean https)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
get(String path,
Map<String,String> headers)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
get(String path,
Map<String,String> headers,
boolean https)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
get(String path,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
get(String path,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig,
boolean https)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
get(String path,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
get(String path,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig,
boolean https)
Launches a GET request, using the given path (will be appended to the base test URL).
|
protected String |
getCookieEncoding() |
protected ICookieFactory |
getCookieFactory() |
protected org.spincast.shaded.org.apache.http.client.CookieStore |
getCookieStore() |
protected org.spincast.shaded.org.apache.http.client.HttpClient |
getHttpClient()
Creates the HTTPClient with a cookies store.
|
protected org.spincast.shaded.org.apache.http.HttpResponse |
getRawResponse(String url)
Launches a GET request, using the given full URL and returns the
raw, unparsed HttpClient's HttpResponse.
|
protected org.spincast.shaded.org.apache.http.HttpResponse |
getRawResponse(String url,
Map<String,String> headers)
Launches a GET request, using the given full URL and returns the
raw, unparsed HttpClient's HttpResponse.
|
protected org.spincast.shaded.org.apache.http.HttpResponse |
getRawResponse(String url,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
Launches a GET request, using the given full URL and returns the
raw, unparsed HttpClient's HttpResponse.
|
protected org.spincast.shaded.org.apache.http.HttpResponse |
getRawResponse(String url,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
Launches a GET request, using the given full URL and returns the
raw, unparsed HttpClient's HttpResponse.
|
protected IRouter<R> |
getRouter() |
protected IServer |
getServer() |
protected SpincastTestHttpResponse |
getWithUrl(String url)
Launches a GET request, using the given full URL.
|
protected SpincastTestHttpResponse |
getWithUrl(String url,
Map<String,String> headers)
Launches a GET request, using the given full URL.
|
protected SpincastTestHttpResponse |
getWithUrl(String url,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
Launches a GET request, using the given full URL.
|
protected SpincastTestHttpResponse |
getWithUrl(String url,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
Launches a GET request, using the given full URL.
|
protected SpincastTestHttpResponse |
methodWithUrl(HttpMethod method,
String url,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
Launches a request of a custom HTTP method, using the given full URL.
|
protected SpincastTestHttpResponse |
methodWithUrl(HttpMethod method,
String url,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig,
List<org.spincast.shaded.org.apache.http.NameValuePair> params)
Launches a request of a custom HTTP method, using the given full URL.
|
protected SpincastTestHttpResponse |
postJson(String path,
String json)
Launches a POST request using the given path (will be appended to the base test URL) and
by sending the "json" Json string and the Json content-type.
|
protected SpincastTestHttpResponse |
postStringEntity(String path,
String str,
String contentType)
Launches a POST request using the given path (will be appended to the base test URL) and
by sending the "str" String as the entity with the specified "contentType" content-type.
|
protected SpincastTestHttpResponse |
postWithHeaders(String path,
Map<String,String> headers)
Launches a POST request using the given path (will be appended to the base test URL)
and the specified headers.
|
protected SpincastTestHttpResponse |
postWithParams(String path,
List<org.spincast.shaded.org.apache.http.NameValuePair> params)
Launches a POST request using the given path (will be appended to the base test URL).
|
protected SpincastTestHttpResponse |
request(HttpMethod method,
String url,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig,
List<org.spincast.shaded.org.apache.http.NameValuePair> params,
String payload,
String contentTypeIn)
Launches a request of a custom HTTP method, using the given full URL.
|
protected org.spincast.shaded.org.apache.http.HttpResponse |
requestRaw(HttpMethod method,
String url,
Map<String,String> headers,
org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig,
List<org.spincast.shaded.org.apache.http.NameValuePair> params,
String str,
String contentType)
Launches a request of a custom HTTP method, using the given full URL.
|
protected void |
stopServer() |
beforeClass, createInjector, createTestingFilePath, createTestingFilePath, deleteTempDir, getInjector, getSpincastConfig, getTestingWritableDir, getTestingWritableDirBasePath, setSpincastConfigpublic void afterClass()
afterClass in interface IBeforeAfterClassMethodsProviderafterClass in class SpincastGuiceBasedTestBasepublic void before()
protected void clearHttpClientData()
protected void stopServer()
protected ICookieFactory getCookieFactory()
protected IServer getServer()
protected org.spincast.shaded.org.apache.http.client.CookieStore getCookieStore()
protected String getCookieEncoding()
protected org.spincast.shaded.org.apache.http.client.HttpClient getHttpClient()
protected String createTestUrl(String path, boolean https)
protected SpincastTestHttpResponse get(String path) throws Exception
Exceptionprotected SpincastTestHttpResponse get(String path, boolean https) throws Exception
Exceptionprotected SpincastTestHttpResponse get(String path, Map<String,String> headers) throws Exception
Exceptionprotected SpincastTestHttpResponse get(String path, Map<String,String> headers, boolean https) throws Exception
Exceptionprotected SpincastTestHttpResponse get(String path, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig) throws Exception
Exceptionprotected SpincastTestHttpResponse get(String path, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig, boolean https) throws Exception
Exceptionprotected SpincastTestHttpResponse get(String path, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig) throws Exception
Exceptionprotected SpincastTestHttpResponse get(String path, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig, boolean https) throws Exception
Exceptionprotected SpincastTestHttpResponse getWithUrl(String url) throws Exception
Exceptionprotected SpincastTestHttpResponse getWithUrl(String url, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig) throws Exception
Exceptionprotected SpincastTestHttpResponse getWithUrl(String url, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig) throws Exception
Exceptionprotected SpincastTestHttpResponse getWithUrl(String url, Map<String,String> headers) throws Exception
Exceptionprotected org.spincast.shaded.org.apache.http.HttpResponse getRawResponse(String url)
protected org.spincast.shaded.org.apache.http.HttpResponse getRawResponse(String url, Map<String,String> headers)
protected org.spincast.shaded.org.apache.http.HttpResponse getRawResponse(String url, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
protected org.spincast.shaded.org.apache.http.HttpResponse getRawResponse(String url, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig)
protected SpincastTestHttpResponse postWithParams(String path, List<org.spincast.shaded.org.apache.http.NameValuePair> params) throws Exception
Exceptionprotected SpincastTestHttpResponse postWithHeaders(String path, Map<String,String> headers) throws Exception
Exceptionprotected SpincastTestHttpResponse postStringEntity(String path, String str, String contentType) throws Exception
Exceptionprotected SpincastTestHttpResponse postJson(String path, String json) throws Exception
Exceptionprotected SpincastTestHttpResponse methodWithUrl(HttpMethod method, String url, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig) throws Exception
Exceptionprotected SpincastTestHttpResponse methodWithUrl(HttpMethod method, String url, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig, List<org.spincast.shaded.org.apache.http.NameValuePair> params) throws Exception
Exceptionprotected SpincastTestHttpResponse request(HttpMethod method, String url, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig, List<org.spincast.shaded.org.apache.http.NameValuePair> params, String payload, String contentTypeIn) throws Exception
Exceptionprotected org.spincast.shaded.org.apache.http.HttpResponse requestRaw(HttpMethod method, String url, Map<String,String> headers, org.spincast.shaded.org.apache.http.client.config.RequestConfig requestConfig, List<org.spincast.shaded.org.apache.http.NameValuePair> params, String str, String contentType)
Copyright © 2016. All rights reserved.