Search in sources :

Example 86 with HttpResponse

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

the class HttpListConfigsHandlerTest method require_that_handler_can_be_created.

@Test
public void require_that_handler_can_be_created() throws IOException {
    HttpResponse response = handler.handle(HttpRequest.createTestRequest("/config/v1/", GET));
    assertThat(SessionHandlerTest.getRenderedString(response), is("{\"children\":[],\"configs\":[]}"));
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse) Test(org.junit.Test)

Example 87 with HttpResponse

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

the class HttpListConfigsHandlerTest method require_that_named_handler_can_be_created.

@Test
public void require_that_named_handler_can_be_created() throws IOException {
    HttpRequest req = HttpRequest.createTestRequest("http://foo.com:8080/config/v1/foo.bar/conf/id/", GET);
    req.getJDiscRequest().parameters().put("http.path", Arrays.asList("foo.bar"));
    HttpResponse response = namedHandler.handle(req);
    assertThat(SessionHandlerTest.getRenderedString(response), is("{\"children\":[],\"configs\":[]}"));
}
Also used : HttpRequest(com.yahoo.container.jdisc.HttpRequest) HttpResponse(com.yahoo.container.jdisc.HttpResponse) Test(org.junit.Test)

Example 88 with HttpResponse

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

the class ApplicationContentHandlerTest method assertNotFound.

private void assertNotFound(HttpRequest request) {
    HttpResponse response = handler.handle(request);
    assertNotNull(response);
    assertThat(response.getStatus(), is(Response.Status.NOT_FOUND));
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse)

Example 89 with HttpResponse

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

the class HostHandlerTest method assertErrorForHost.

private void assertErrorForHost(String hostname, int expectedStatus, HttpErrorResponse.errorCodes errorCode, String expectedResponse) throws IOException {
    String url = urlPrefix + hostname;
    HttpResponse response = handler.handle(HttpRequest.createTestRequest(url, com.yahoo.jdisc.http.HttpRequest.Method.GET));
    HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, expectedStatus, errorCode, expectedResponse);
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse)

Example 90 with HttpResponse

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

the class HostHandlerTest method assertApplicationForHost.

private void assertApplicationForHost(String hostname, TenantName expectedTenantName, ApplicationId expectedApplicationId, Zone zone) throws IOException {
    String url = urlPrefix + hostname;
    HttpResponse response = handler.handle(HttpRequest.createTestRequest(url, com.yahoo.jdisc.http.HttpRequest.Method.GET));
    HandlerTest.assertHttpStatusCodeAndMessage(response, Response.Status.OK, "{\"tenant\":\"" + expectedTenantName.value() + "\"," + "\"application\":\"" + expectedApplicationId.application().value() + "\"," + "\"environment\":\"" + zone.environment().value() + "\"," + "\"region\":\"" + zone.region().value() + "\"," + "\"instance\":\"" + expectedApplicationId.instance().value() + "\"}");
}
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