use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method testbasicEncodingV1.
@Test
public void testbasicEncodingV1() throws Exception {
Request request = new Request("http://localhost:" + getFirstListenPort() + get_enc_test_uri_v1);
HttpGet get = new HttpGet(request.getUri());
final String rest = doRest(get);
assertThat(rest, containsString(get_enc_response_part1));
assertThat(rest, containsString(get_enc_response_part2));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method testbasicPost.
@Test
public void testbasicPost() throws Exception {
Request request = new Request("http://localhost:" + getFirstListenPort() + post_test_uri);
HttpPost httpPost = new HttpPost(request.getUri());
StringEntity entity = new StringEntity(post_test_doc, ContentType.create("application/json"));
httpPost.setEntity(entity);
String x = doRest(httpPost);
assertThat(x, is(post_test_response));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method testEmptyPost.
@Test
public void testEmptyPost() throws Exception {
Request request = new Request("http://localhost:" + getFirstListenPort() + post_test_uri);
HttpPost httpPost = new HttpPost(request.getUri());
StringEntity entity = new StringEntity("", ContentType.create("application/json"));
httpPost.setEntity(entity);
String x = doRest(httpPost);
assertThat(x, containsString("Could not read document, no document?"));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method negative_document_count_parameter_returns_error_response.
@Test
public void negative_document_count_parameter_returns_error_response() throws IOException {
Request request = new Request(String.format("http://localhost:%s/document/v1/namespace/document-type/docid/?wantedDocumentCount=-1", getFirstListenPort()));
HttpGet get = new HttpGet(request.getUri());
String rest = doRest(get);
assertThat(rest, containsString("Invalid 'wantedDocumentCount' value. Expected positive integer"));
}
use of com.yahoo.application.container.handler.Request in project vespa by vespa-engine.
the class RestApiTest method invalid_visit_concurrency_parameter_returns_error_response.
@Test
public void invalid_visit_concurrency_parameter_returns_error_response() throws IOException {
Request request = new Request(String.format("http://localhost:%s/document/v1/namespace/document-type/docid/?concurrency=badgers", getFirstListenPort()));
HttpGet get = new HttpGet(request.getUri());
String rest = doRest(get);
assertThat(rest, containsString("Invalid 'concurrency' value. Expected positive integer"));
}
Aggregations