Search in sources :

Example 61 with HttpResponse

use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.

the class AccessLogRequestHandlerTest method testOneLogLine.

@Test
public void testOneLogLine() throws IOException {
    keeper.addUri("foo");
    HttpResponse response = handler.handle(null);
    response.render(out);
    assertThat(out.toString(), is("{\"entries\":[{\"url\":\"foo\"}]}"));
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse) Test(org.junit.Test)

Example 62 with HttpResponse

use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.

the class AccessLogRequestHandlerTest method testEmpty.

@Test
public void testEmpty() throws IOException {
    HttpResponse response = handler.handle(null);
    response.render(out);
    assertThat(out.toString(), is("{\"entries\":[]}"));
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse) Test(org.junit.Test)

Example 63 with HttpResponse

use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.

the class ApplicationHandlerTest method assertApplicationGeneration.

private void assertApplicationGeneration(String url, long expectedGeneration) throws IOException {
    HttpResponse response = mockHandler.handle(HttpRequest.createTestRequest(url, com.yahoo.jdisc.http.HttpRequest.Method.GET));
    HandlerTest.assertHttpStatusCodeAndMessage(response, 200, "{\"generation\":" + expectedGeneration + "}");
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse)

Example 64 with HttpResponse

use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.

the class ApplicationHandlerTest method grabLog.

private String grabLog(ApplicationId application, Zone zone) throws IOException {
    String restartUrl = toUrlPath(application, zone, true) + "/log";
    HttpResponse response = mockHandler.handle(HttpRequest.createTestRequest(restartUrl, com.yahoo.jdisc.http.HttpRequest.Method.POST));
    HandlerTest.assertHttpStatusCodeAndMessage(response, 200, "");
    return SessionHandlerTest.getRenderedString(response);
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse)

Example 65 with HttpResponse

use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.

the class ApplicationHandlerTest method converge.

private void converge(ApplicationId application, Zone zone) throws IOException {
    String convergeUrl = toUrlPath(application, zone, true) + "/serviceconverge";
    HttpResponse response = mockHandler.handle(HttpRequest.createTestRequest(convergeUrl, com.yahoo.jdisc.http.HttpRequest.Method.GET));
    HandlerTest.assertHttpStatusCodeAndMessage(response, 200, "");
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse)

Aggregations

HttpResponse (com.yahoo.container.jdisc.HttpResponse)103 Test (org.junit.Test)75 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)33 HandlerTest (com.yahoo.vespa.config.server.http.HandlerTest)24 HttpRequest (com.yahoo.container.jdisc.HttpRequest)16 CompressedApplicationInputStreamTest (com.yahoo.vespa.config.server.http.CompressedApplicationInputStreamTest)6 SessionTest (com.yahoo.vespa.config.server.session.SessionTest)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 SimpletypesConfig (com.yahoo.config.SimpletypesConfig)5 InnerCNode (com.yahoo.config.codegen.InnerCNode)5 Slime (com.yahoo.slime.Slime)5 ConfigPayload (com.yahoo.vespa.config.ConfigPayload)5 OutputStream (java.io.OutputStream)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 ApplicationId (com.yahoo.config.provision.ApplicationId)4 IOException (java.io.IOException)4 InputStream (java.io.InputStream)4 HashMap (java.util.HashMap)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3