Search in sources :

Example 11 with ResponseFilter

use of com.yahoo.jdisc.http.filter.ResponseFilter in project vespa by vespa-engine.

the class FilterTestCase method requireThatRequestFilterIsNotRunOnUnboundPath.

@Test
public void requireThatRequestFilterIsNotRunOnUnboundPath() throws Exception {
    final RequestFilter filter = mock(RequestFilterMockBase.class);
    final BindingRepository<RequestFilter> requestFilters = new BindingRepository<>();
    requestFilters.bind("http://*/filtered/*", filter);
    final BindingRepository<ResponseFilter> responseFilters = null;
    final MyRequestHandler requestHandler = new MyRequestHandler();
    final TestDriver testDriver = newDriver(requestHandler, requestFilters, responseFilters);
    testDriver.client().get("/status.html");
    assertThat(requestHandler.awaitInvocation(), is(true));
    verify(filter, never()).filter(any(HttpRequest.class), any(ResponseHandler.class));
    assertThat(testDriver.close(), is(true));
}
Also used : HttpRequest(com.yahoo.jdisc.http.HttpRequest) ResponseHandler(com.yahoo.jdisc.handler.ResponseHandler) BindingRepository(com.yahoo.jdisc.application.BindingRepository) ResponseFilter(com.yahoo.jdisc.http.filter.ResponseFilter) RequestFilter(com.yahoo.jdisc.http.filter.RequestFilter) Test(org.testng.annotations.Test)

Aggregations

ResponseFilter (com.yahoo.jdisc.http.filter.ResponseFilter)11 RequestFilter (com.yahoo.jdisc.http.filter.RequestFilter)9 Test (org.testng.annotations.Test)8 HttpRequest (com.yahoo.jdisc.http.HttpRequest)7 BindingRepository (com.yahoo.jdisc.application.BindingRepository)6 ResponseHandler (com.yahoo.jdisc.handler.ResponseHandler)5 Request (com.yahoo.jdisc.Request)4 Response (com.yahoo.jdisc.Response)4 HttpResponse (com.yahoo.jdisc.http.HttpResponse)4 FilterBindings (com.yahoo.jdisc.http.server.FilterBindings)2 AbstractModule (com.google.inject.AbstractModule)1 ComponentId (com.yahoo.component.ComponentId)1 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)1 ChainsConfig (com.yahoo.container.core.ChainsConfig)1 FilterChainRepository (com.yahoo.container.http.filter.FilterChainRepository)1 ResourceReference (com.yahoo.jdisc.ResourceReference)1 AbstractRequestHandler (com.yahoo.jdisc.handler.AbstractRequestHandler)1 BindingNotFoundException (com.yahoo.jdisc.handler.BindingNotFoundException)1 ContentChannel (com.yahoo.jdisc.handler.ContentChannel)1 RequestDeniedException (com.yahoo.jdisc.handler.RequestDeniedException)1