public final class TestUtils extends Object
Modifier and Type | Method and Description |
---|---|
static DriverRequest |
createDriverRequest(Driver driver)
Creates a mock
DriverRequest . |
static DriverRequest |
createDriverRequest(String uri,
Driver driver)
Creates a mock
DriverRequest . |
static HttpResponseBuilder |
createHttpResponse()
Create a fluent-style builder for
HttpResponse . |
static IncomingRequest.Builder |
createIncomingRequest()
Creates a mock
IncomingRequest . |
static IncomingRequest.Builder |
createIncomingRequest(String uri)
Creates a mock
IncomingRequest . |
static Driver |
createMockDriver(Properties properties,
org.apache.http.conn.HttpClientConnectionManager connectionManager)
Create a Driver instance with a custom connection Manager.
|
static Driver |
createMockDriver(Properties properties,
org.apache.http.conn.HttpClientConnectionManager connectionManager,
String name)
Create a Driver instance with a custom connection Manager.
|
static Driver |
createMockDriver(Properties properties,
org.apache.http.HttpResponse response)
Creates a
Driver instance with a mock HttpResponse . |
static Driver |
createMockDriver(Properties properties,
IResponseHandler responseHandler)
Creates a
Driver instance with a custom response handler. |
static IncomingRequest.Builder |
createRequest(String uri)
Create a fluent-style builder for
IncomingRequest . |
static org.apache.http.client.methods.CloseableHttpResponse |
driverProxy(Driver d,
IncomingRequest request,
Renderer... renderers)
Execute
Driver.proxy(String, org.esigate.http.IncomingRequest, Renderer...) on an HttpRequest. |
public static IncomingRequest.Builder createIncomingRequest(String uri)
IncomingRequest
.uri
- the uriIncomingRequest
public static IncomingRequest.Builder createIncomingRequest()
IncomingRequest
.IncomingRequest
public static DriverRequest createDriverRequest(String uri, Driver driver) throws HttpErrorPage
DriverRequest
.uri
- the uridriver
- the Driver
DriverRequest
HttpErrorPage
- if an error occurspublic static DriverRequest createDriverRequest(Driver driver) throws HttpErrorPage
DriverRequest
.driver
- the Driver
DriverRequest
HttpErrorPage
- if an error occurspublic static Driver createMockDriver(Properties properties, IResponseHandler responseHandler)
Driver
instance with a custom response handler.properties
- the Properties
responseHandler
- the IResponseHandler
Driver
objectpublic static Driver createMockDriver(Properties properties, org.apache.http.HttpResponse response)
Driver
instance with a mock HttpResponse
.properties
- the Properties
response
- the HttpResponse
Driver
objectpublic static Driver createMockDriver(Properties properties, org.apache.http.conn.HttpClientConnectionManager connectionManager)
properties
- the Properties
connectionManager
- the HttpClientConnectionManager
Driver
objectpublic static Driver createMockDriver(Properties properties, org.apache.http.conn.HttpClientConnectionManager connectionManager, String name)
properties
- the Properties
connectionManager
- the HttpClientConnectionManager
name
- name of the Driver instanceDriver
objectpublic static HttpResponseBuilder createHttpResponse()
HttpResponse
.HttpResponseBuilder
public static IncomingRequest.Builder createRequest(String uri)
IncomingRequest
.uri
- the request uripublic static org.apache.http.client.methods.CloseableHttpResponse driverProxy(Driver d, IncomingRequest request, Renderer... renderers) throws IOException, HttpErrorPage
Driver.proxy(String, org.esigate.http.IncomingRequest, Renderer...)
on an HttpRequest.d
- Driver
request
- Requestrenderers
- Renderer
which will be applied on response entity.HttpResponse
IOException
- if an IOException
occursHttpErrorPage
- if any other ExceptionCopyright © 2008–2018. All rights reserved.