use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method require_correct_error_response_on_no_model.
@Test
public void require_correct_error_response_on_no_model() throws IOException {
mockRequestHandler.setAllConfigs(new HashSet<ConfigKey<?>>());
HttpResponse response = namedHandler.handle(HttpRequest.createTestRequest("http://yahoo.com:8080/config/v1/foo.bar/myid/", GET));
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "Config not available, verify that an application package has been deployed and activated.");
}
use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method require_error_on_bad_request.
@Test
public void require_error_on_bad_request() throws IOException {
HttpRequest req = HttpRequest.createTestRequest("http://foo.com:8080/config/v1/foobar/conf/id/", GET);
HttpResponse resp = namedHandler.handle(req);
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, BAD_REQUEST, HttpErrorResponse.errorCodes.BAD_REQUEST, "Illegal config, must be of form namespace.name.");
req = HttpRequest.createTestRequest("http://foo.com:8080/config/v1/foo.barNOPE/conf/id/", GET);
resp = namedHandler.handle(req);
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config: foo.barNOPE");
req = HttpRequest.createTestRequest("http://foo.com:8080/config/v1/foo.bar/conf/id/NOPE/", GET);
resp = namedHandler.handle(req);
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(resp, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "No such config id: conf/id/NOPE/");
}
use of com.yahoo.container.jdisc.HttpResponse in project vespa by vespa-engine.
the class HttpListConfigsHandlerTest method require_correct_error_response_on_no_model.
@Test
public void require_correct_error_response_on_no_model() throws IOException {
mockRequestHandler.setAllConfigs(new HashSet<ConfigKey<?>>());
HttpResponse response = namedHandler.handle(HttpRequest.createTestRequest("http://yahoo.com:8080/config/v2/tenant/mytenant/application/myapplication/foo.bar/myid/", GET));
HandlerTest.assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.errorCodes.NOT_FOUND, "Config not available, verify that an application package has been deployed and activated.");
}
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("http://yahoo.com:8080/config/v2/tenant/mytenant/application/myapplication/", GET));
assertThat(SessionHandlerTest.getRenderedString(response), is("{\"children\":[],\"configs\":[]}"));
}
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/v2/tenant/mytenant/application/myapplication/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\":[]}"));
}
Aggregations