Search in sources :

Example 1 with TestDriver

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

the class ServletAccessLoggingTest method accessLogIsInvokedForJDiscServlet.

@Test
public void accessLogIsInvokedForJDiscServlet() throws Exception {
    final AccessLog accessLog = mock(AccessLog.class);
    final TestDriver testDriver = newTestDriver(accessLog);
    testDriver.client().newGet("/status.html").execute();
    verifyCallsLog(accessLog, timeout(MAX_LOG_WAIT_TIME_MILLIS).times(1));
}
Also used : AccessLog(com.yahoo.container.logging.AccessLog) TestDriver(com.yahoo.jdisc.http.server.jetty.TestDriver) Test(org.testng.annotations.Test)

Example 2 with TestDriver

use of com.yahoo.jdisc.http.server.jetty.TestDriver 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 3 with TestDriver

use of com.yahoo.jdisc.http.server.jetty.TestDriver 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 4 with TestDriver

use of com.yahoo.jdisc.http.server.jetty.TestDriver 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 5 with TestDriver

use of com.yahoo.jdisc.http.server.jetty.TestDriver 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

TestDriver (com.yahoo.jdisc.http.server.jetty.TestDriver)7 Test (org.testng.annotations.Test)7 ResponseValidator (com.yahoo.jdisc.http.server.jetty.SimpleHttpClient.ResponseValidator)5 AccessLog (com.yahoo.container.logging.AccessLog)2