use of org.springframework.mock.web.MockFilterChain in project spring-security by spring-projects.
the class WebAsyncManagerIntegrationFilterTests method setUp.
@Before
public void setUp() {
when(asyncWebRequest.getNativeRequest(HttpServletRequest.class)).thenReturn(request);
when(request.getRequestURI()).thenReturn("/");
filterChain = new MockFilterChain();
threadFactory = new JoinableThreadFactory();
SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor();
executor.setThreadFactory(threadFactory);
asyncManager = WebAsyncUtils.getAsyncManager(request);
asyncManager.setAsyncWebRequest(asyncWebRequest);
asyncManager.setTaskExecutor(executor);
when(request.getAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE)).thenReturn(asyncManager);
filter = new WebAsyncManagerIntegrationFilter();
}
use of org.springframework.mock.web.MockFilterChain in project spring-security by spring-projects.
the class HeaderWriterFilterTests method additionalHeadersShouldBeAddedToTheResponse.
@Test
public void additionalHeadersShouldBeAddedToTheResponse() throws Exception {
List<HeaderWriter> headerWriters = new ArrayList<HeaderWriter>();
headerWriters.add(writer1);
headerWriters.add(writer2);
HeaderWriterFilter filter = new HeaderWriterFilter(headerWriters);
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
MockFilterChain filterChain = new MockFilterChain();
filter.doFilter(request, response, filterChain);
verify(writer1).writeHeaders(request, response);
verify(writer2).writeHeaders(request, response);
// verify the filterChain
assertThat(filterChain.getRequest()).isEqualTo(request);
// continued
}
use of org.springframework.mock.web.MockFilterChain in project spring-security by spring-projects.
the class FilterSecurityMetadataSourceBeanDefinitionParserTests method createFilterInvocation.
private FilterInvocation createFilterInvocation(String path, String method) {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setRequestURI(null);
request.setMethod(method);
request.setServletPath(path);
return new FilterInvocation(request, new MockHttpServletResponse(), new MockFilterChain());
}
use of org.springframework.mock.web.MockFilterChain in project spring-security by spring-projects.
the class SessionManagementConfigServlet31Tests method setup.
@Before
public void setup() {
request = new MockHttpServletRequest();
response = new MockHttpServletResponse();
chain = new MockFilterChain();
}
use of org.springframework.mock.web.MockFilterChain in project spring-security by spring-projects.
the class CustomHttpSecurityConfigurerTests method setup.
@Before
public void setup() {
request = new MockHttpServletRequest();
response = new MockHttpServletResponse();
chain = new MockFilterChain();
request.setMethod("GET");
}
Aggregations