public void verify(ClientDriverRequest clientDriverRequest, int times) { handler.verify(clientDriverRequest, times); } }
/** * Add in an expected {@link ClientDriverRequest}/{@link ClientDriverResponse} pair. * * @param request * The expected request * @param response * The response to serve to that request * * @return The newly added expectation. */ public ClientDriverExpectation addExpectation(ClientDriverRequest request, ClientDriverResponse response) { return handler.addExpectation(request, response); }
/** * Make the mock not fail fast on an unexpected request. */ public void noFailFastOnUnexpectedRequest() { handler.noFailFastOnUnexpectedRequest(); }
/** * Verifies that all expectations have been met and nothing unexpected has been requested. * * If the verification fails, a {@link ClientDriverFailedExpectationException} is thrown with plenty of detail, and your test will fail! */ public void verify() { LOGGER.info("Beginning verification"); handler.checkForUnexpectedRequests(); handler.checkForUnmatchedExpectations(); }
/** * Factory method to create and start a {@link ClientDriver} on a specific port. This is <em>absolutely</em> not the recommended * way to use the client driver. The no-arg method will choose a free port, use of this method will fail if the port is not free. * * @param port The port to listen on. If this port is not available a runtime exception will be thrown. * * @return A new {@link ClientDriver}, which has found a free port, bound to it and started up. */ public ClientDriver createClientDriver(int port) { ClientDriver clientDriver = new ClientDriver(new DefaultClientDriverJettyHandler(new DefaultRequestMatcher()), port); LOGGER.debug("ClientDriver created at '" + clientDriver.getBaseUrl() + "'."); return clientDriver; }
/** * Resets the expectations and requests in the handler. */ public void reset() { handler.reset(); }
waitFor(period); period = 0;
captureBodyIfRequired(realRequest, matchedExpectation);
/** * Verifies that all expectations have been met and nothing unexpected has been requested. * * If the verification fails, a {@link ClientDriverFailedExpectationException} is thrown with plenty of detail, and your test will fail! */ public void verify() { LOGGER.info("Beginning verification"); handler.checkForUnexpectedRequests(); handler.checkForUnmatchedExpectations(); }
/** * Factory method to create and start a {@link ClientDriver}. A port will be chosen automatically. * * @return A new {@link ClientDriver}, which has found a free port, bound to it and started up. */ public ClientDriver createClientDriver() { ClientDriver clientDriver = new ClientDriver(new DefaultClientDriverJettyHandler(new DefaultRequestMatcher())); LOGGER.debug("ClientDriver created at '" + clientDriver.getBaseUrl() + "'."); return clientDriver; }
public void verify(ClientDriverRequest clientDriverRequest, int times) { handler.verify(clientDriverRequest, times); } }
/** * Add in an expected {@link ClientDriverRequest}/{@link ClientDriverResponse} pair. * * @param request * The expected request * @param response * The response to serve to that request * * @return The newly added expectation. */ public ClientDriverExpectation addExpectation(ClientDriverRequest request, ClientDriverResponse response) { return handler.addExpectation(request, response); }
/** * Make the mock not fail fast on an unexpected request. */ public void noFailFastOnUnexpectedRequest() { handler.noFailFastOnUnexpectedRequest(); }
/** * Resets the expectations and requests in the handler. */ public void reset() { handler.reset(); }
waitFor(period); period = 0;
captureBodyIfRequired(realRequest, matchedExpectation);
/** * Factory method to create and start a {@link ClientDriver}. A port will be chosen automatically. * * @return A new {@link ClientDriver}, which has found a free port, bound to it and started up. */ public ClientDriver createClientDriver() { ClientDriver clientDriver = new ClientDriver(new DefaultClientDriverJettyHandler(new DefaultRequestMatcher())); LOGGER.debug("ClientDriver created at '" + clientDriver.getBaseUrl() + "'."); return clientDriver; }
/** * Factory method to create and start a {@link ClientDriver} on a specific port. This is <em>absolutely</em> not the recommended * way to use the client driver. The no-arg method will choose a free port, use of this method will fail if the port is not free. * * @param port The port to listen on. If this port is not available a runtime exception will be thrown. * * @return A new {@link ClientDriver}, which has found a free port, bound to it and started up. */ public ClientDriver createClientDriver(int port) { ClientDriver clientDriver = new ClientDriver(new DefaultClientDriverJettyHandler(new DefaultRequestMatcher()), port); LOGGER.debug("ClientDriver created at '" + clientDriver.getBaseUrl() + "'."); return clientDriver; }
/** * Create SecureClientDriver with the given configuration. * * @return the newly-created driver */ public SecureClientDriver build() { Validate.notEmpty(certAlias, "Certificate alias is not set."); Validate.notEmpty(password, "Password not set."); Validate.notNull(keyStore, "Key store is not set."); SecureClientDriver clientDriver = new SecureClientDriver( new DefaultClientDriverJettyHandler(new DefaultRequestMatcher()), port, keyStore, password, certAlias); LOGGER.debug("ClientDriver created at '" + clientDriver.getBaseUrl() + "'."); return clientDriver; }
/** * Create SecureClientDriver with the given configuration. * * @return the newly-created driver */ public SecureClientDriver build() { Validate.notEmpty(certAlias, "Certificate alias is not set."); Validate.notEmpty(password, "Password not set."); Validate.notNull(keyStore, "Key store is not set."); SecureClientDriver clientDriver = new SecureClientDriver( new DefaultClientDriverJettyHandler(new DefaultRequestMatcher()), port, keyStore, password, certAlias); LOGGER.debug("ClientDriver created at '" + clientDriver.getBaseUrl() + "'."); return clientDriver; }