Search in sources :

Example 6 with ResponseValidator

use of com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator in project vespa by vespa-engine.

the class HttpServerTest method requireThatFormParametersAreParsed.

@Test
public void requireThatFormParametersAreParsed() throws Exception {
    final TestDriver driver = TestDrivers.newInstance(new ParameterPrinterRequestHandler());
    final ResponseValidator response = driver.client().newPost("/status.html").addHeader(CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED).setContent("a=b&c=d").execute();
    response.expectStatusCode(is(OK)).expectContent(startsWith("{a=[b], c=[d]}"));
    assertThat(driver.close(), is(true));
}
Also used : ResponseValidator(com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator) Test(org.testng.annotations.Test)

Example 7 with ResponseValidator

use of com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator in project vespa by vespa-engine.

the class JDiscFilterForServletTest method request_filter_can_return_response.

@Test
public void request_filter_can_return_response() throws IOException, InterruptedException {
    TestDriver testDriver = requestFilterTestDriver();
    ResponseValidator response = httpGet(testDriver, TestServlet.PATH).execute();
    response.expectContent(containsString(TestRequestFilter.responseContent));
}
Also used : ResponseValidator(com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator) TestDriver(com.yahoo.jdisc.http.server.jetty.TestDriver) Test(org.testng.annotations.Test)

Example 8 with ResponseValidator

use of com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator in project vespa by vespa-engine.

the class JDiscFilterForServletTest method response_filter_is_run_on_empty_async_response.

@Test
public void response_filter_is_run_on_empty_async_response() throws IOException {
    TestDriver testDriver = responseFilterTestDriver();
    ResponseValidator response = httpGet(testDriver, NoContentTestServlet.PATH).addHeader(NoContentTestServlet.HEADER_ASYNC, Boolean.TRUE.toString()).execute();
    response.expectHeader(TestResponseFilter.INVOKED_HEADER, is(Boolean.TRUE.toString()));
}
Also used : ResponseValidator(com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator) TestDriver(com.yahoo.jdisc.http.server.jetty.TestDriver) Test(org.testng.annotations.Test)

Example 9 with ResponseValidator

use of com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator in project vespa by vespa-engine.

the class JDiscFilterForServletTest method response_filter_can_modify_response.

@Test
public void response_filter_can_modify_response() throws IOException {
    TestDriver testDriver = responseFilterTestDriver();
    ResponseValidator response = httpGet(testDriver, TestServlet.PATH).execute();
    response.expectHeader(TestResponseFilter.INVOKED_HEADER, is(Boolean.TRUE.toString()));
}
Also used : ResponseValidator(com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator) TestDriver(com.yahoo.jdisc.http.server.jetty.TestDriver) Test(org.testng.annotations.Test)

Example 10 with ResponseValidator

use of com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator in project vespa by vespa-engine.

the class JDiscFilterForServletTest method response_filter_is_run_on_empty_sync_response.

@Test
public void response_filter_is_run_on_empty_sync_response() throws IOException {
    TestDriver testDriver = responseFilterTestDriver();
    ResponseValidator response = httpGet(testDriver, NoContentTestServlet.PATH).execute();
    response.expectHeader(TestResponseFilter.INVOKED_HEADER, is(Boolean.TRUE.toString()));
}
Also used : ResponseValidator(com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator) TestDriver(com.yahoo.jdisc.http.server.jetty.TestDriver) Test(org.testng.annotations.Test)

Aggregations

ResponseValidator (com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator)20 Test (org.testng.annotations.Test)20 TestDriver (com.yahoo.jdisc.http.server.jetty.TestDriver)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3