use of com.yahoo.jdisc.handler.BufferedContentChannel in project vespa by vespa-engine.
the class VipStatusHandlerTestCase method testFileNotFound.
@Test
public final void testFileNotFound() {
final VipStatusConfig config = new VipStatusConfig(new VipStatusConfig.Builder().accessdisk(true).statusfile("/VipStatusHandlerTestCaseFileThatReallyReallyShouldNotExist").noSearchBackendsImpliesOutOfService(false));
final VipStatusHandler handler = new VipStatusHandler(Executors.newCachedThreadPool(), config, metric);
final NotFoundResponseHandler responseHandler = new NotFoundResponseHandler();
final HttpRequest request = createRequest();
final BufferedContentChannel requestContent = createChannel();
handler.handleRequest(request, requestContent, responseHandler);
final ByteBuffer b = responseHandler.channel.read();
final byte[] asBytes = new byte[b.remaining()];
b.get(asBytes);
assertEquals(VipStatusHandler.StatusResponse.COULD_NOT_FIND_STATUS_FILE, Utf8.toString(asBytes));
}
use of com.yahoo.jdisc.handler.BufferedContentChannel in project vespa by vespa-engine.
the class VipStatusHandlerTestCase method createChannel.
public static BufferedContentChannel createChannel() {
BufferedContentChannel channel = new BufferedContentChannel();
channel.close(null);
return channel;
}
use of com.yahoo.jdisc.handler.BufferedContentChannel in project vespa by vespa-engine.
the class VipStatusHandlerTestCase method testHandleRequest.
@Test
public final void testHandleRequest() {
final VipStatusConfig config = new VipStatusConfig(new VipStatusConfig.Builder().accessdisk(false).noSearchBackendsImpliesOutOfService(false));
final VipStatusHandler handler = new VipStatusHandler(Executors.newCachedThreadPool(), config, metric);
final MockResponseHandler responseHandler = new MockResponseHandler();
final HttpRequest request = createRequest();
final BufferedContentChannel requestContent = createChannel();
handler.handleRequest(request, requestContent, responseHandler);
final ByteBuffer b = responseHandler.channel.read();
final byte[] asBytes = new byte[b.remaining()];
b.get(asBytes);
assertEquals(VipStatusHandler.OK_MESSAGE, Utf8.toString(asBytes));
}
Aggregations