use of com.yahoo.container.jdisc.RequestHandlerTestDriver in project vespa by vespa-engine.
the class SearchHandlerTestCase method assertHandlerResponse.
private void assertHandlerResponse(int status, String responseData, String handlerName) throws Exception {
RequestHandler forwardingHandler = configurer.getRequestHandlerRegistry().getComponent("com.yahoo.search.handler.test.SearchHandlerTestCase$" + handlerName + "Handler");
try (RequestHandlerTestDriver forwardingDriver = new RequestHandlerTestDriver(forwardingHandler)) {
RequestHandlerTestDriver.MockResponseHandler response = forwardingDriver.sendRequest("http://localhost/" + handlerName + "?query=test");
response.awaitResponse();
assertEquals("Expected HTTP status", status, response.getStatus());
if (responseData == null)
assertEquals("Connection closed with no data", null, response.read());
else
assertEquals(responseData, response.readAll());
}
}
use of com.yahoo.container.jdisc.RequestHandlerTestDriver in project vespa by vespa-engine.
the class SearchHandlerTestCase method driverWithConfig.
private RequestHandlerTestDriver driverWithConfig(String configDirectory) throws Exception {
IOUtils.copyDirectory(new File(testDir, configDirectory), new File(tempDir), 1);
generateComponentsConfigForActive();
configurer.reloadConfig();
SearchHandler newSearchHandler = fetchSearchHandler(configurer);
assertTrue("Should have a new instance of the search handler", searchHandler != newSearchHandler);
return new RequestHandlerTestDriver(newSearchHandler);
}
Aggregations