use of javax.servlet.FilterConfig in project OpenAM by OpenRock.
the class AMSetupFilterTest method initializeFilter.
private void initializeFilter() throws ServletException {
FilterConfig config = mock(FilterConfig.class);
ServletContext context = mock(ServletContext.class);
given(config.getServletContext()).willReturn(context);
setupFilter.init(config);
}
use of javax.servlet.FilterConfig in project OpenAM by OpenRock.
the class AMSetupFilterTest method initShouldSetEncryptionPasswordIfNotConfigured.
@Test
public void initShouldSetEncryptionPasswordIfNotConfigured() throws Exception {
//Given
FilterConfig config = mock(FilterConfig.class);
ServletContext context = mock(ServletContext.class);
given(config.getServletContext()).willReturn(context);
systemIsNotConfigured();
//When
setupFilter.init(config);
//Then
verify(context).setAttribute(eq("am.enc.pwd"), anyString());
}
use of javax.servlet.FilterConfig in project gerrit by GerritCodeReview.
the class AllRequestFilterFilterProxyTest method noFilters.
@Test
public void noFilters() throws Exception {
EasyMockSupport ems = new EasyMockSupport();
FilterConfig config = ems.createMock(FilterConfig.class);
HttpServletRequest req = new FakeHttpServletRequest();
HttpServletResponse res = new FakeHttpServletResponse();
FilterChain chain = ems.createMock(FilterChain.class);
chain.doFilter(req, res);
ems.replayAll();
AllRequestFilter.FilterProxy filterProxy = getFilterProxy();
filterProxy.init(config);
filterProxy.doFilter(req, res, chain);
filterProxy.destroy();
ems.verifyAll();
}
use of javax.servlet.FilterConfig in project gerrit by GerritCodeReview.
the class AllRequestFilterFilterProxyTest method twoFiltersNoBubbling.
@Test
public void twoFiltersNoBubbling() throws Exception {
EasyMockSupport ems = new EasyMockSupport();
FilterConfig config = ems.createMock(FilterConfig.class);
HttpServletRequest req = new FakeHttpServletRequest();
HttpServletResponse res = new FakeHttpServletResponse();
IMocksControl mockControl = ems.createStrictControl();
FilterChain chain = mockControl.createMock(FilterChain.class);
AllRequestFilter filterA = mockControl.createMock(AllRequestFilter.class);
AllRequestFilter filterB = mockControl.createMock(AllRequestFilter.class);
filterA.init(config);
filterB.init(config);
filterA.doFilter(eq(req), eq(res), anyObject(FilterChain.class));
filterA.destroy();
filterB.destroy();
ems.replayAll();
AllRequestFilter.FilterProxy filterProxy = getFilterProxy();
addFilter(filterA);
addFilter(filterB);
filterProxy.init(config);
filterProxy.doFilter(req, res, chain);
filterProxy.destroy();
ems.verifyAll();
}
use of javax.servlet.FilterConfig in project gerrit by GerritCodeReview.
the class AllRequestFilterFilterProxyTest method singleFilterNoBubbling.
@Test
public void singleFilterNoBubbling() throws Exception {
EasyMockSupport ems = new EasyMockSupport();
FilterConfig config = ems.createMock("config", FilterConfig.class);
HttpServletRequest req = new FakeHttpServletRequest();
HttpServletResponse res = new FakeHttpServletResponse();
FilterChain chain = ems.createMock("chain", FilterChain.class);
AllRequestFilter filter = ems.createStrictMock("filter", AllRequestFilter.class);
filter.init(config);
filter.doFilter(eq(req), eq(res), anyObject(FilterChain.class));
filter.destroy();
ems.replayAll();
AllRequestFilter.FilterProxy filterProxy = getFilterProxy();
addFilter(filter);
filterProxy.init(config);
filterProxy.doFilter(req, res, chain);
filterProxy.destroy();
ems.verifyAll();
}
Aggregations