public class ClientDriver extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ClientDriverJettyHandler |
handler |
protected org.eclipse.jetty.server.Server |
jettyServer |
| Modifier | Constructor and Description |
|---|---|
protected |
ClientDriver()
Convenience constructor for extending classes.
|
|
ClientDriver(ClientDriverJettyHandler handler)
Constructor.
|
|
ClientDriver(ClientDriverJettyHandler handler,
int port)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ClientDriverExpectation |
addExpectation(ClientDriverRequest request,
ClientDriverResponse response)
Add in an expected
ClientDriverRequest/ClientDriverResponse pair. |
protected org.eclipse.jetty.server.Server |
createAndStartJetty(int port) |
protected org.eclipse.jetty.server.ServerConnector |
createConnector(org.eclipse.jetty.server.Server jetty,
int port) |
String |
getBaseUrl()
Get the base URL which the ClientDriver is running on.
|
int |
getPort() |
protected org.eclipse.jetty.util.ssl.SslContextFactory |
getSslContextFactory() |
void |
noFailFastOnUnexpectedRequest()
Make the mock not fail fast on an unexpected request.
|
protected void |
replaceConnector(org.eclipse.jetty.server.ServerConnector newConnector,
org.eclipse.jetty.server.Server jetty) |
void |
reset()
Resets the expectations and requests in the handler.
|
void |
shutdown()
Shutdown the server and calls
verify(). |
void |
shutdownQuietly()
Shutdown the server without verifying expectations.
|
void |
verify()
Verifies that all expectations have been met and nothing unexpected has been requested.
|
void |
verify(ClientDriverRequest clientDriverRequest,
int times) |
protected org.eclipse.jetty.server.Server jettyServer
protected ClientDriverJettyHandler handler
public ClientDriver(ClientDriverJettyHandler handler)
handler - The ClientDriverJettyHandler to use.public ClientDriver(ClientDriverJettyHandler handler, int port)
handler - The ClientDriverJettyHandler to use.port - The port to listen on. Expect startup errors if this port is
not free.protected ClientDriver()
protected org.eclipse.jetty.server.Server createAndStartJetty(int port)
protected org.eclipse.jetty.util.ssl.SslContextFactory getSslContextFactory()
protected org.eclipse.jetty.server.ServerConnector createConnector(org.eclipse.jetty.server.Server jetty,
int port)
protected void replaceConnector(org.eclipse.jetty.server.ServerConnector newConnector,
org.eclipse.jetty.server.Server jetty)
public int getPort()
public String getBaseUrl()
The base URL, which will be like "http://localhost:xxxx".
There is no trailing slash on this
public void verify()
ClientDriverFailedExpectationException is thrown with plenty of detail, and your test will fail!public void noFailFastOnUnexpectedRequest()
public void reset()
public void shutdownQuietly()
public void shutdown()
verify().public ClientDriverExpectation addExpectation(ClientDriverRequest request, ClientDriverResponse response)
ClientDriverRequest/ClientDriverResponse pair.request - The expected requestresponse - The response to serve to that requestpublic void verify(ClientDriverRequest clientDriverRequest, int times)
Copyright © 2016. All Rights Reserved.