public abstract class APITest extends Object
| Constructor and Description |
|---|
APITest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertOK(org.apache.http.HttpResponse res)
assert that the response has a 2XX status code
|
protected void |
assertOK(javax.ws.rs.core.Response res)
assert that the response has a 2XX status code
|
protected void |
assertStatus(org.apache.http.HttpResponse res,
javax.ws.rs.core.Response.Status status)
assert that the response has the given status code
|
protected void |
assertStatus(javax.ws.rs.core.Response res,
javax.ws.rs.core.Response.Status status)
assert that the response has the given status code
|
protected String |
getServerURL() |
protected String |
getWebSocketURL() |
protected de.taimos.httputils.HTTPRequest |
jsonBody(de.taimos.httputils.HTTPRequest req,
Object o)
enriches the given
HTTPRequest with the the given object as JSON using the default ObjectMapper |
protected org.eclipse.jetty.websocket.client.WebSocketClient |
openWebsocket(String path,
ClientSocketAdapter socket)
creates a web socket connection to the given path using the supplied client socket adapter
|
protected void |
print(String label,
Object o)
prints the given object serialized to JSON to the console.
|
protected <T> T |
read(org.apache.http.HttpResponse res,
Class<T> clazz)
reads the response to the given object using the default JSON ObjectMapper
|
protected Map<String,Object> |
readMap(org.apache.http.HttpResponse res)
reads the response into a map of type string-object using the default JSON ObjectMapper
|
protected de.taimos.httputils.HTTPRequest |
request(String path)
Create new HTTP request to the test server
|
protected final String getServerURL()
protected String getWebSocketURL()
protected final de.taimos.httputils.HTTPRequest request(String path)
path - the path to callHTTPRequestprotected final void assertOK(org.apache.http.HttpResponse res)
res - the response to checkprotected final void assertStatus(org.apache.http.HttpResponse res,
javax.ws.rs.core.Response.Status status)
res - the response to checkstatus - the status to check againstprotected final void assertOK(javax.ws.rs.core.Response res)
res - the response to checkprotected final void assertStatus(javax.ws.rs.core.Response res,
javax.ws.rs.core.Response.Status status)
res - the response to checkstatus - the status to check againstprotected <T> T read(org.apache.http.HttpResponse res,
Class<T> clazz)
T - the target classres - the response to convertclazz - the class of the targetRuntimeException - if deserialization failsprotected Map<String,Object> readMap(org.apache.http.HttpResponse res)
res - the response to convertRuntimeException - if deserialization failsprotected de.taimos.httputils.HTTPRequest jsonBody(de.taimos.httputils.HTTPRequest req,
Object o)
HTTPRequest with the the given object as JSON using the default ObjectMapperreq - the request to enricho - the object to map and use as bodyRuntimeException - if serialization failsprotected org.eclipse.jetty.websocket.client.WebSocketClient openWebsocket(String path, ClientSocketAdapter socket)
path - the path of the websocket targetsocket - the client socket to useWebSocketClientRuntimeException - if connection failsprotected void print(String label, Object o)
label - the label to use as prefixo - the object to serializeRuntimeException - if serialization failsCopyright © 2013–2015 Taimos GmbH. All rights reserved.