public abstract class SpincastIntegrationTestBase<R extends IRequestContext<?>,W extends IWebsocketContext<?>> extends SpincastTestBase
This requires a "IServer" to be bound in the Guice context : it will automatically be stopped after the test class is ran.
Note that this class doesn't start the server by itself because this lets the opportunity to test an application by using its true bootstraping process, which usually starts a server itself!
All client data (such as cookies) are cleared before each test.
| Constructor and Description |
|---|
SpincastIntegrationTestBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterClass() |
protected org.spincast.plugins.httpclient.builders.IConnectRequestBuilder |
CONNECT(String path)
Starts an Http Client builder for a CONNECT method.
|
protected org.spincast.plugins.httpclient.builders.IConnectRequestBuilder |
CONNECT(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a CONNECT method.
|
protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IDeleteRequestBuilder |
DELETE(String path)
Starts an Http Client builder for a DELETE method.
|
protected org.spincast.plugins.httpclient.builders.IDeleteRequestBuilder |
DELETE(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a DELETE method.
|
protected org.spincast.plugins.httpclient.builders.IDeleteRequestBuilder |
DELETE(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a DELETE method.
|
protected String |
formatDate(Date date)
Format a date so it can be used in a HTTP header.
|
protected org.spincast.plugins.httpclient.builders.IGetRequestBuilder |
GET(String path)
Starts an Http Client builder for a GET method.
|
protected org.spincast.plugins.httpclient.builders.IGetRequestBuilder |
GET(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a GET method.
|
protected org.spincast.plugins.httpclient.builders.IGetRequestBuilder |
GET(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a GET method.
|
protected ICookieFactory |
getCookieFactory() |
protected com.google.inject.Module |
getDefaultOverridingModule(Type requestContextType,
Type websocketContextType)
We make sure the Spincast HTTP Client with WebSocket
support is bound since this class provides methods that
use it.
|
protected IHttpClient |
getHttpClient() |
protected IRouter<R,W> |
getRouter() |
protected IServer |
getServer() |
protected org.spincast.plugins.httpclient.builders.IHeadRequestBuilder |
HEAD(String path)
Starts an Http Client builder for a HEAD method.
|
protected org.spincast.plugins.httpclient.builders.IHeadRequestBuilder |
HEAD(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a HEAD method.
|
protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IOptionsRequestBuilder |
OPTIONS(String path)
Starts an Http Client builder for a OPTIONS method.
|
protected org.spincast.plugins.httpclient.builders.IOptionsRequestBuilder |
OPTIONS(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a OPTIONS method.
|
protected org.spincast.plugins.httpclient.builders.IOptionsRequestBuilder |
OPTIONS(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a OPTIONS method.
|
protected Date |
parseDate(String dateHeaderValue)
Parse a date from a HTTP header to a Date object.
|
protected org.spincast.plugins.httpclient.builders.IPatchRequestBuilder |
PATCH(String path)
Starts an Http Client builder for a PATCH method.
|
protected org.spincast.plugins.httpclient.builders.IPatchRequestBuilder |
PATCH(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a PATCH method.
|
protected org.spincast.plugins.httpclient.builders.IPatchRequestBuilder |
PATCH(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a PATCH method.
|
protected org.spincast.plugins.httpclient.builders.IPostRequestBuilder |
POST(String path)
Starts an Http Client builder for a POST method.
|
protected org.spincast.plugins.httpclient.builders.IPostRequestBuilder |
POST(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a POST method.
|
protected org.spincast.plugins.httpclient.builders.IPostRequestBuilder |
POST(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a POST method.
|
protected org.spincast.plugins.httpclient.builders.IPutRequestBuilder |
PUT(String path)
Starts an Http Client builder for a PUT method.
|
protected org.spincast.plugins.httpclient.builders.IPutRequestBuilder |
PUT(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a PUT method.
|
protected org.spincast.plugins.httpclient.builders.IPutRequestBuilder |
PUT(String pathOrUrl,
boolean isFullUrl,
boolean isHttps)
Starts an Http Client builder for a PUT method.
|
protected void |
stopServer() |
protected org.spincast.plugins.httpclient.builders.ITraceRequestBuilder |
TRACE(String path)
Starts an Http Client builder for a TRACE method.
|
protected org.spincast.plugins.httpclient.builders.ITraceRequestBuilder |
TRACE(String pathOrUrl,
boolean isFullUrl)
Starts an Http Client builder for a TRACE method.
|
protected org.spincast.plugins.httpclient.builders.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) |
afterClassLoops, afterTest, beforeClass, beforeTest, createInjector, createTestingFilePath, createTestingFilePath, deleteTempDir, getInjector, getSpincastConfig, getTestingWritableDir, setSpincastConfig, testFailureprotected com.google.inject.Module getDefaultOverridingModule(Type requestContextType, Type websocketContextType)
public void afterClass()
afterClass in interface IBeforeAfterClassMethodsProviderafterClass in class SpincastTestBaseprotected 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 org.spincast.plugins.httpclient.builders.IGetRequestBuilder GET(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IPostRequestBuilder POST(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IPutRequestBuilder PUT(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IDeleteRequestBuilder DELETE(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IOptionsRequestBuilder OPTIONS(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.ITraceRequestBuilder TRACE(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IConnectRequestBuilder CONNECT(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IPatchRequestBuilder PATCH(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.IHeadRequestBuilder HEAD(String path)
path - the relative path to be appended to the
base test URL.protected org.spincast.plugins.httpclient.builders.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 org.spincast.plugins.httpclient.builders.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.