Package com.yahoo.container.jdisc
Class RequestHandlerTestDriver
java.lang.Object
com.yahoo.container.jdisc.RequestHandlerTestDriver
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
ProcessingTestDriver
A helper for making tests creating jDisc requests and checking their responses.
- Author:
- bratseth
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionRequestHandlerTestDriver
(com.yahoo.jdisc.handler.RequestHandler handler) Creates this with a binding to "http://localhost/*"RequestHandlerTestDriver
(String binding, com.yahoo.jdisc.handler.RequestHandler handler) -
Method Summary
Modifier and TypeMethodDescriptionReplaces all occurrences of 0-9 digits by d'svoid
close()
com.yahoo.jdisc.test.TestDriver
Returns the jDisc level driver wrapped by thissendRequest
(String uri) Send a GET requestsendRequest
(String uri, HttpRequest.Method method) sendRequest
(String uri, HttpRequest.Method method, String body) Send a POST requestsendRequest
(String uri, HttpRequest.Method method, String body, String contentType) Send a POST request with defined content typesendRequest
(String uri, HttpRequest.Method method, ByteBuffer body) sendRequest
(String uri, HttpRequest.Method method, ByteBuffer body, String contentType)
-
Constructor Details
-
RequestHandlerTestDriver
public RequestHandlerTestDriver(com.yahoo.jdisc.handler.RequestHandler handler) Creates this with a binding to "http://localhost/*" -
RequestHandlerTestDriver
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
jDiscDriver
public com.yahoo.jdisc.test.TestDriver jDiscDriver()Returns the jDisc level driver wrapped by this -
sendRequest
Send a GET request -
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(String uri, HttpRequest.Method method) -
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(String uri, HttpRequest.Method method, String body) Send a POST request -
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(String uri, HttpRequest.Method method, String body, String contentType) Send a POST request with defined content type -
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(String uri, HttpRequest.Method method, ByteBuffer body) -
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(String uri, HttpRequest.Method method, ByteBuffer body, String contentType) -
censorDigits
Replaces all occurrences of 0-9 digits by d's
-