Search in sources :

Example 6 with StreamCountFilter

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

the class TestFilterChainImpl method testStreamResponseFilter.

@Test
public void testStreamResponseFilter() {
    final RestCountFilter restCountFilter = new RestCountFilter();
    final StreamCountFilter streamCountFilter = new StreamCountFilter();
    FilterChain fc = FilterChains.createRestChain(restCountFilter);
    fc = fc.addLast(streamCountFilter);
    fireStreamResponse(fc);
    assertRestCounts(0, 0, 0, restCountFilter);
    assertStreamCounts(0, 1, 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 7 with StreamCountFilter

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

the class TestFilterChainImpl method testChainStreamErrorFilters.

@Test
public void testChainStreamErrorFilters() {
    final StreamCountFilter filter1 = new StreamCountFilter();
    final StreamCountFilter filter2 = new StreamCountFilter();
    final StreamCountFilter filter3 = new StreamCountFilter();
    final FilterChain fc = FilterChains.createStreamChain(filter1, filter2, filter3);
    fireStreamError(fc);
    assertStreamCounts(0, 0, 1, filter1);
    assertStreamCounts(0, 0, 1, filter2);
    assertStreamCounts(0, 0, 1, filter3);
}
Also used : StreamCountFilter(com.linkedin.r2.testutils.filter.StreamCountFilter) FilterChain(com.linkedin.r2.filter.FilterChain) Test(org.testng.annotations.Test)

Example 8 with StreamCountFilter

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

the class TestFilterChainImpl method testRestResponseFilter.

@Test
public void testRestResponseFilter() {
    final RestCountFilter restCountFilter = new RestCountFilter();
    final StreamCountFilter streamCountFilter = new StreamCountFilter();
    FilterChain fc = FilterChains.createRestChain(restCountFilter);
    fc = fc.addLast(streamCountFilter);
    fireRestResponse(fc);
    assertRestCounts(0, 1, 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 9 with StreamCountFilter

use of com.linkedin.r2.testutils.filter.StreamCountFilter 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 10 with StreamCountFilter

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

the class TestFilterChainImpl method testChainStreamRequestFilters.

@Test
public void testChainStreamRequestFilters() {
    final StreamCountFilter filter1 = new StreamCountFilter();
    final StreamCountFilter filter2 = new StreamCountFilter();
    final StreamCountFilter filter3 = new StreamCountFilter();
    final FilterChain fc = FilterChains.createStreamChain(filter1, filter2, filter3);
    fireStreamRequest(fc);
    assertStreamCounts(1, 0, 0, filter1);
    assertStreamCounts(1, 0, 0, filter2);
    assertStreamCounts(1, 0, 0, filter3);
}
Also used : StreamCountFilter(com.linkedin.r2.testutils.filter.StreamCountFilter) FilterChain(com.linkedin.r2.filter.FilterChain) Test(org.testng.annotations.Test)

Aggregations

StreamCountFilter (com.linkedin.r2.testutils.filter.StreamCountFilter)11 FilterChain (com.linkedin.r2.filter.FilterChain)10 Test (org.testng.annotations.Test)10 RestCountFilter (com.linkedin.r2.testutils.filter.RestCountFilter)6 StreamFilter (com.linkedin.r2.filter.message.stream.StreamFilter)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 BeforeMethod (org.testng.annotations.BeforeMethod)1