Search in sources :

Example 11 with RestCountFilter

use of com.linkedin.r2.testutils.filter.RestCountFilter in project rest.li by linkedin.

the class TestFilterChainImpl method testRestRequestFilter.

@Test
public void testRestRequestFilter() {
    final RestCountFilter restCountFilter = new RestCountFilter();
    final StreamCountFilter streamCountFilter = new StreamCountFilter();
    FilterChain fc = FilterChains.createRestChain(restCountFilter);
    fc = fc.addLast(streamCountFilter);
    fireRestRequest(fc);
    assertRestCounts(1, 0, 0, restCountFilter);
    assertStreamCounts(0, 0, 0, streamCountFilter);
}
Also used : StreamCountFilter(com.linkedin.r2.testutils.filter.StreamCountFilter) FilterChain(com.linkedin.r2.filter.FilterChain) RestCountFilter(com.linkedin.r2.testutils.filter.RestCountFilter) Test(org.testng.annotations.Test)

Example 12 with RestCountFilter

use of com.linkedin.r2.testutils.filter.RestCountFilter in project rest.li by linkedin.

the class TestFilterChainImpl method testRestErrorFilter.

@Test
public void testRestErrorFilter() {
    final RestCountFilter restCountFilter = new RestCountFilter();
    final StreamCountFilter streamCountFilter = new StreamCountFilter();
    FilterChain fc = FilterChains.createRestChain(restCountFilter);
    fc = fc.addLast(streamCountFilter);
    fireRestError(fc);
    assertRestCounts(0, 0, 1, restCountFilter);
    assertStreamCounts(0, 0, 0, streamCountFilter);
}
Also used : StreamCountFilter(com.linkedin.r2.testutils.filter.StreamCountFilter) FilterChain(com.linkedin.r2.filter.FilterChain) RestCountFilter(com.linkedin.r2.testutils.filter.RestCountFilter) Test(org.testng.annotations.Test)

Aggregations

RestCountFilter (com.linkedin.r2.testutils.filter.RestCountFilter)12 Test (org.testng.annotations.Test)11 FilterChain (com.linkedin.r2.filter.FilterChain)10 StreamCountFilter (com.linkedin.r2.testutils.filter.StreamCountFilter)6 RestFilter (com.linkedin.r2.filter.message.rest.RestFilter)2 BaseRestFilter (com.linkedin.r2.filter.message.rest.BaseRestFilter)1 RequestContext (com.linkedin.r2.message.RequestContext)1 RestRequest (com.linkedin.r2.message.rest.RestRequest)1 RestRequestBuilder (com.linkedin.r2.message.rest.RestRequestBuilder)1 RestResponse (com.linkedin.r2.message.rest.RestResponse)1 RestResponseBuilder (com.linkedin.r2.message.rest.RestResponseBuilder)1 CaptureLastCallFilter (com.linkedin.r2.testutils.filter.CaptureLastCallFilter)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 BeforeMethod (org.testng.annotations.BeforeMethod)1