use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method testbasicRemove.
@Test
public void testbasicRemove() throws Exception {
Request request = new Request("http://localhost:" + getFirstListenPort() + remove_test_uri);
HttpDelete delete = new HttpDelete(request.getUri());
assertThat(doRest(delete), is(remove_test_response));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method testCreateIfNonExistingUpdateInDocTrueButQueryParamsFalse.
@Test
public void testCreateIfNonExistingUpdateInDocTrueButQueryParamsFalse() throws Exception {
Request request = new Request("http://localhost:" + getFirstListenPort() + update_test_create_if_non_existient_uri + "?create=false");
HttpPut httpPut = new HttpPut(request.getUri());
StringEntity entity = new StringEntity(update_test_create_if_non_existient_doc, ContentType.create("application/json"));
httpPut.setEntity(entity);
assertThat(doRest(httpPut), is(update_test_create_if_non_existing_response));
assertThat(getLog(), not(containsString("CREATE IF NON EXISTENT IS TRUE")));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method testbasicUpdateCreateTrue.
@Test
public void testbasicUpdateCreateTrue() throws Exception {
Request request = new Request("http://localhost:" + getFirstListenPort() + update_test_uri + "?create=true");
HttpPut httpPut = new HttpPut(request.getUri());
StringEntity entity = new StringEntity(update_test_doc, ContentType.create("application/json"));
httpPut.setEntity(entity);
assertThat(doRest(httpPut), is(update_test_response));
assertThat(getLog(), containsString("CREATE IF NON EXISTENT IS TRUE"));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method test_node_patching.
@Test
public void test_node_patching() throws Exception {
assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com", Utf8.toBytes("{" + "\"currentRestartGeneration\": 1," + "\"currentRebootGeneration\": 3," + "\"flavor\": \"medium-disk\"," + "\"currentVespaVersion\": \"5.104.142\"," + "\"hardwareFailureDescription\": \"memory_mcelog\"," + "\"failCount\": 0," + "\"parentHostname\": \"parent.yahoo.com\"" + "}"), Request.Method.PATCH), "{\"message\":\"Updated host4.yahoo.com\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/node/doesnotexist.yahoo.com", Utf8.toBytes("{\"currentRestartGeneration\": 1}"), Request.Method.PATCH), 404, "{\"error-code\":\"NOT_FOUND\",\"message\":\"No node found with hostname doesnotexist.yahoo.com\"}");
assertResponse(new Request("http://localhost:8080/nodes/v2/node/host5.yahoo.com", Utf8.toBytes("{\"currentRestartGeneration\": 1}"), Request.Method.PATCH), 400, "{\"error-code\":\"BAD_REQUEST\",\"message\":\"Could not set field 'currentRestartGeneration': Node is not allocated\"}");
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method setting_node_to_ready_will_reset_certain_fields.
@Test
public void setting_node_to_ready_will_reset_certain_fields() throws Exception {
final String hostname = "host55.yahoo.com";
assertResponse(new Request("http://localhost:8080/nodes/v2/state/ready/" + hostname, new byte[0], Request.Method.PUT), "{\"message\":\"Moved " + hostname + " to ready\"}");
assertFile(new Request("http://localhost:8080/nodes/v2/node/" + hostname), "node55-after-changes.json");
}
Aggregations