use of com.linkedin.r2.filter.FilterChain in project rest.li by linkedin.
the class TestFilterChainImpl method testStreamErrorFilter.
@Test
public void testStreamErrorFilter() {
final RestCountFilter restCountFilter = new RestCountFilter();
final StreamCountFilter streamCountFilter = new StreamCountFilter();
FilterChain fc = FilterChains.createRestChain(restCountFilter);
fc = fc.addLast(streamCountFilter);
fireStreamError(fc);
assertRestCounts(0, 0, 0, restCountFilter);
assertStreamCounts(0, 0, 1, streamCountFilter);
}
use of com.linkedin.r2.filter.FilterChain in project rest.li by linkedin.
the class TestFilterChainImpl method testChainRestErrorFilters.
@Test
public void testChainRestErrorFilters() {
final RestCountFilter filter1 = new RestCountFilter();
final RestCountFilter filter2 = new RestCountFilter();
final RestCountFilter filter3 = new RestCountFilter();
final FilterChain fc = FilterChains.createRestChain(filter1, filter2, filter3);
fireRestError(fc);
assertRestCounts(0, 0, 1, filter1);
assertRestCounts(0, 0, 1, filter2);
assertRestCounts(0, 0, 1, filter3);
}
use of com.linkedin.r2.filter.FilterChain in project rest.li by linkedin.
the class TestFilterChainImpl method testChainRestResponseFilters.
@Test
public void testChainRestResponseFilters() {
final RestCountFilter filter1 = new RestCountFilter();
final RestCountFilter filter2 = new RestCountFilter();
final RestCountFilter filter3 = new RestCountFilter();
final FilterChain fc = FilterChains.createRestChain(filter1, filter2, filter3);
fireRestResponse(fc);
assertRestCounts(0, 1, 0, filter1);
assertRestCounts(0, 1, 0, filter2);
assertRestCounts(0, 1, 0, filter3);
}
use of com.linkedin.r2.filter.FilterChain in project rest.li by linkedin.
the class TestFilterChainImpl method testChainStreamResponseFilters.
@Test
public void testChainStreamResponseFilters() {
final StreamCountFilter filter1 = new StreamCountFilter();
final StreamCountFilter filter2 = new StreamCountFilter();
final StreamCountFilter filter3 = new StreamCountFilter();
final FilterChain fc = FilterChains.createStreamChain(filter1, filter2, filter3);
fireStreamResponse(fc);
assertStreamCounts(0, 1, 0, filter1);
assertStreamCounts(0, 1, 0, filter2);
assertStreamCounts(0, 1, 0, filter3);
}
use of com.linkedin.r2.filter.FilterChain in project rest.li by linkedin.
the class TestFilterChainImpl method testFilterOrderRestChain.
@Test
public void testFilterOrderRestChain() {
AtomicInteger count = new AtomicInteger(0);
CheckOrderFilter filter1 = new CheckOrderFilter(count);
CheckOrderFilter filter2 = new CheckOrderFilter(count);
final FilterChain fc = FilterChains.createRestChain(filter1, filter2);
fireRestRequest(fc);
Assert.assertEquals(filter1.getOrder(), 1);
Assert.assertEquals(filter2.getOrder(), 2);
fireRestResponse(fc);
Assert.assertEquals(filter1.getOrder(), 4);
Assert.assertEquals(filter2.getOrder(), 3);
fireRestError(fc);
Assert.assertEquals(filter1.getOrder(), 6);
Assert.assertEquals(filter2.getOrder(), 5);
}
Aggregations