Package org.apache.hadoop.hbase
Class MockHttpApiRule
java.lang.Object
org.junit.rules.ExternalResource
org.apache.hadoop.hbase.MockHttpApiRule
- All Implemented Interfaces:
org.junit.rules.TestRule
A
Rule
that manages a simple http server. The caller registers request handlers
to URI path regexp.-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate MockHttpApiRule.MockHandler
private static final org.slf4j.Logger
private org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddRegistration
(String pathRegex, BiConsumer<String, javax.servlet.http.HttpServletResponse> responder) Register a callback handler for the specified path target.protected void
after()
protected void
before()
private static org.apache.hbase.thirdparty.org.eclipse.jetty.server.RequestLog
void
getURI()
Retrieve the service URI for this service.registerOk
(String pathRegex, String responseBody) Shortcut method for callingaddRegistration(String, BiConsumer)
with a 200 response.Methods inherited from class org.junit.rules.ExternalResource
apply
-
Field Details
-
LOG
-
handler
-
server
-
-
Constructor Details
-
MockHttpApiRule
public MockHttpApiRule()
-
-
Method Details
-
addRegistration
public MockHttpApiRule addRegistration(String pathRegex, BiConsumer<String, javax.servlet.http.HttpServletResponse> responder) Register a callback handler for the specified path target. -
registerOk
Shortcut method for callingaddRegistration(String, BiConsumer)
with a 200 response. -
clearRegistrations
-
getURI
Retrieve the service URI for this service. -
before
- Overrides:
before
in classorg.junit.rules.ExternalResource
- Throws:
Exception
-
after
- Overrides:
after
in classorg.junit.rules.ExternalResource
-
buildRequestLog
-