public abstract class SpincastIntegrationTestBase<R extends IRequestContext<?>,W extends IWebsocketContext<?>> 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()
Called after the tests of the class are ran.
|
void |
beforeTest() |
protected IConnectRequestBuilder |
CONNECT(String path)
Starts an Http Client builder for a CONNECT method.
|
protected IConnectRequestBuilder |
CONNECT(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a CONNECT method.
|
protected IConnectRequestBuilder |
CONNECT(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a CONNECT method.
|
protected String |
createTestUrl(String path)
Creates an URL to the started HTTP server.
|
protected String |
createTestUrl(String path,
boolean https)
Creates an URL to the started HTTP server.
|
protected String |
createTestUrl(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Creates an URL to the started HTTP server.
|
protected IDeleteRequestBuilder |
DELETE(String path)
Starts an Http Client builder for a DELETE method.
|
protected IDeleteRequestBuilder |
DELETE(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a DELETE method.
|
protected IDeleteRequestBuilder |
DELETE(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a DELETE method.
|
protected IGetRequestBuilder |
GET(String path)
Starts an Http Client builder for a GET method.
|
protected IGetRequestBuilder |
GET(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a GET method.
|
protected IGetRequestBuilder |
GET(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a GET method.
|
protected ICookieFactory |
getCookieFactory() |
protected IHttpClient |
getHttpClient() |
protected IRouter<R,W> |
getRouter() |
protected IServer |
getServer() |
protected com.google.inject.Module |
getTestOverridingModule(Type requestContextType,
Type websocketContextType) |
protected IHeadRequestBuilder |
HEAD(String path)
Starts an Http Client builder for a HEAD method.
|
protected IHeadRequestBuilder |
HEAD(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a HEAD method.
|
protected IHeadRequestBuilder |
HEAD(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a HEAD method.
|
protected boolean |
isDisableSllCetificateErrors()
By default, for the tests, by disable the
SSL certificate errors.
|
protected IOptionsRequestBuilder |
OPTIONS(String path)
Starts an Http Client builder for a OPTIONS method.
|
protected IOptionsRequestBuilder |
OPTIONS(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a OPTIONS method.
|
protected IOptionsRequestBuilder |
OPTIONS(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a OPTIONS method.
|
protected IPatchRequestBuilder |
PATCH(String path)
Starts an Http Client builder for a PATCH method.
|
protected IPatchRequestBuilder |
PATCH(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a PATCH method.
|
protected IPatchRequestBuilder |
PATCH(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a PATCH method.
|
protected IPostRequestBuilder |
POST(String path)
Starts an Http Client builder for a POST method.
|
protected IPostRequestBuilder |
POST(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a POST method.
|
protected IPostRequestBuilder |
POST(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a POST method.
|
protected IPutRequestBuilder |
PUT(String path)
Starts an Http Client builder for a PUT method.
|
protected IPutRequestBuilder |
PUT(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a PUT method.
|
protected IPutRequestBuilder |
PUT(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a PUT method.
|
protected void |
stopServer() |
protected ITraceRequestBuilder |
TRACE(String path)
Starts an Http Client builder for a TRACE method.
|
protected ITraceRequestBuilder |
TRACE(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a TRACE method.
|
protected ITraceRequestBuilder |
TRACE(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a TRACE method.
|
protected IWebsocketRequestBuilder |
websocket(String path) |
protected IWebsocketRequestBuilder |
websocket(String pathOrUrl,
boolean isFullUrl) |
protected IWebsocketRequestBuilder |
websocket(String pathOrUrl,
boolean isFullUrl,
boolean isHttps) |
beforeClass, createInjector, createTestingFilePath, createTestingFilePath, deleteTempDir, getInjector, getSpincastConfig, getTestingWritableDir, getTestingWritableDirBasePath, setSpincastConfigprotected com.google.inject.Module getTestOverridingModule(Type requestContextType, Type websocketContextType)
public void afterClass()
IBeforeAfterClassMethodsProviderThis will only be called if the beforeClass() method completed successfully, so you can be sure that the instanciation of the class is complete here.
afterClass in interface IBeforeAfterClassMethodsProviderafterClass in class SpincastGuiceBasedTestBasepublic void beforeTest()
protected void stopServer()
protected IHttpClient getHttpClient()
protected ICookieFactory getCookieFactory()
protected IServer getServer()
protected String createTestUrl(String path)
path - the relative path to be appended to the
base test URL.protected String createTestUrl(String path, boolean https)
path - the relative path to be appended to the
base test URL.https - if true, "https:" will be used
instead of "http:".protected String createTestUrl(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path OR a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected IWebsocketRequestBuilder websocket(String path)
protected IWebsocketRequestBuilder websocket(String pathOrUrl, boolean isFullUrl)
protected IWebsocketRequestBuilder websocket(String pathOrUrl, boolean isFullUrl, boolean isHttps)
protected IGetRequestBuilder GET(String path)
path - the relative path to be appended to the
base test URL.protected IGetRequestBuilder GET(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IGetRequestBuilder GET(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected boolean isDisableSllCetificateErrors()
protected IPostRequestBuilder POST(String path)
path - the relative path to be appended to the
base test URL.protected IPostRequestBuilder POST(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IPostRequestBuilder POST(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected IPutRequestBuilder PUT(String path)
path - the relative path to be appended to the
base test URL.protected IPutRequestBuilder PUT(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IPutRequestBuilder PUT(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected IDeleteRequestBuilder DELETE(String path)
path - the relative path to be appended to the
base test URL.protected IDeleteRequestBuilder DELETE(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IDeleteRequestBuilder DELETE(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected IOptionsRequestBuilder OPTIONS(String path)
path - the relative path to be appended to the
base test URL.protected IOptionsRequestBuilder OPTIONS(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IOptionsRequestBuilder OPTIONS(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected ITraceRequestBuilder TRACE(String path)
path - the relative path to be appended to the
base test URL.protected ITraceRequestBuilder TRACE(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected ITraceRequestBuilder TRACE(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected IConnectRequestBuilder CONNECT(String path)
path - the relative path to be appended to the
base test URL.protected IConnectRequestBuilder CONNECT(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IConnectRequestBuilder CONNECT(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected IPatchRequestBuilder PATCH(String path)
path - the relative path to be appended to the
base test URL.protected IPatchRequestBuilder PATCH(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IPatchRequestBuilder PATCH(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".protected IHeadRequestBuilder HEAD(String path)
path - the relative path to be appended to the
base test URL.protected IHeadRequestBuilder HEAD(String pathOrUrl, boolean isFullUrl)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.protected IHeadRequestBuilder HEAD(String pathOrUrl, boolean isFullUrl, boolean isHttps)
pathOrUrl - a relative path or a full URL.isFullUrl - if the 'pathOrUrl' parameter a full URL? If
so, it will be used as is. Otherwise it will be appended to the
base test URL.isHttps - if true, "https:" will be used
instead of "http:".Copyright © 2016. All rights reserved.