use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method testbasicVisit.
@Test
public void testbasicVisit() throws Exception {
Request request = new Request("http://localhost:" + getFirstListenPort() + visit_test_uri);
HttpGet get = new HttpGet(request.getUri());
String rest = doRest(get);
assertThat(rest, containsString(visit_response_part1));
assertThat(rest, containsString(visit_response_part2));
assertThat(rest, containsString(visit_response_part3));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method visit_fieldset_parameter_is_propagated.
@Test
public void visit_fieldset_parameter_is_propagated() throws IOException {
Request request = new Request(String.format("http://localhost:%s/document/v1/namespace/document-type/docid/?fieldSet=foo,baz", getFirstListenPort()));
HttpGet get = new HttpGet(request.getUri());
String rest = doRest(get);
assertThat(rest, containsString("field set: 'foo,baz'"));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method fails_to_deallocate_node_with_hardware_failure.
@Test
public void fails_to_deallocate_node_with_hardware_failure() throws Exception {
assertResponse(new Request("http://localhost:8080/nodes/v2/node", ("[" + asNodeJson("host12.yahoo.com", "default") + "]").getBytes(StandardCharsets.UTF_8), Request.Method.POST), "{\"message\":\"Added 1 nodes to the provisioned state\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/node/host12.yahoo.com", Utf8.toBytes("{\"hardwareFailureDescription\": \"memory_mcelog\"}"), Request.Method.PATCH), "{\"message\":\"Updated host12.yahoo.com\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/state/failed/host12.yahoo.com", new byte[0], Request.Method.PUT), "{\"message\":\"Moved host12.yahoo.com to failed\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/state/dirty/host12.yahoo.com", new byte[0], Request.Method.PUT), 400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not deallocate host12.yahoo.com: It has a hardware failure\"}");
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method post_node_with_invalid_ip_address.
@Test
public void post_node_with_invalid_ip_address() throws Exception {
Request req = new Request("http://localhost:8080/nodes/v2/node", ("[" + asNodeJson("host-with-ip.yahoo.com", "default", "foo") + "]").getBytes(StandardCharsets.UTF_8), Request.Method.POST);
assertResponse(req, 400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"A node must have at least one valid IP address: 'foo' is not an IP string literal.\"}");
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method post_node_with_ip_address.
@Test
public void post_node_with_ip_address() throws Exception {
assertResponse(new Request("http://localhost:8080/nodes/v2/node", ("[" + asNodeJson("ipv4-host.yahoo.com", "default", "127.0.0.1") + "]").getBytes(StandardCharsets.UTF_8), Request.Method.POST), "{\"message\":\"Added 1 nodes to the provisioned state\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/node", ("[" + asNodeJson("ipv6-host.yahoo.com", "default", "::1") + "]").getBytes(StandardCharsets.UTF_8), Request.Method.POST), "{\"message\":\"Added 1 nodes to the provisioned state\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/node", ("[" + asNodeJson("dual-stack-host.yahoo.com", "default", "127.0.0.1", "::1") + "]").getBytes(StandardCharsets.UTF_8), Request.Method.POST), "{\"message\":\"Added 1 nodes to the provisioned state\"}");
}
Aggregations