Package com.yahoo.container.jdisc
Class RequestHandlerTestDriver
- java.lang.Object
-
- com.yahoo.container.jdisc.RequestHandlerTestDriver
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
ProcessingTestDriver
@Beta public class RequestHandlerTestDriver extends java.lang.Object implements java.lang.AutoCloseable
A helper for making tests creating jDisc requests and checking their responses.- Author:
- bratseth
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RequestHandlerTestDriver.MockResponseHandler
-
Constructor Summary
Constructors Constructor Description RequestHandlerTestDriver(com.yahoo.jdisc.handler.RequestHandler handler)
Creates this with a binding to "http://localhost/*"RequestHandlerTestDriver(java.lang.String binding, com.yahoo.jdisc.handler.RequestHandler handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
censorDigits(java.lang.String s)
Replaces all occurrences of 0-9 digits by d'svoid
close()
com.yahoo.jdisc.test.TestDriver
jDiscDriver()
Returns the jDisc level driver wrapped by thisRequestHandlerTestDriver.MockResponseHandler
sendRequest(java.lang.String uri)
Send a GET requestRequestHandlerTestDriver.MockResponseHandler
sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method)
RequestHandlerTestDriver.MockResponseHandler
sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.lang.String body)
Send a POST requestRequestHandlerTestDriver.MockResponseHandler
sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.lang.String body, java.lang.String contentType)
Send a POST request with defined content typeRequestHandlerTestDriver.MockResponseHandler
sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.nio.ByteBuffer body)
RequestHandlerTestDriver.MockResponseHandler
sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.nio.ByteBuffer body, java.lang.String contentType)
-
-
-
Constructor Detail
-
RequestHandlerTestDriver
public RequestHandlerTestDriver(com.yahoo.jdisc.handler.RequestHandler handler)
Creates this with a binding to "http://localhost/*"
-
RequestHandlerTestDriver
public RequestHandlerTestDriver(java.lang.String binding, com.yahoo.jdisc.handler.RequestHandler handler)
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
jDiscDriver
public com.yahoo.jdisc.test.TestDriver jDiscDriver()
Returns the jDisc level driver wrapped by this
-
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(java.lang.String uri)
Send a GET request
-
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method)
-
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.lang.String body)
Send a POST request
-
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.lang.String body, java.lang.String contentType)
Send a POST request with defined content type
-
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.nio.ByteBuffer body)
-
sendRequest
public RequestHandlerTestDriver.MockResponseHandler sendRequest(java.lang.String uri, com.yahoo.jdisc.http.HttpRequest.Method method, java.nio.ByteBuffer body, java.lang.String contentType)
-
censorDigits
public java.lang.String censorDigits(java.lang.String s)
Replaces all occurrences of 0-9 digits by d's
-
-