use of org.springframework.mock.web.MockPageContext in project spring-security by spring-projects.
the class AccessControlListTagTests method setup.
@Before
@SuppressWarnings("rawtypes")
public void setup() {
SecurityContextHolder.getContext().setAuthentication(bob);
tag = new AccessControlListTag();
WebApplicationContext ctx = mock(WebApplicationContext.class);
pe = mock(PermissionEvaluator.class);
Map beanMap = new HashMap();
beanMap.put("pe", pe);
when(ctx.getBeansOfType(PermissionEvaluator.class)).thenReturn(beanMap);
MockServletContext servletCtx = new MockServletContext();
servletCtx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx);
pageContext = new MockPageContext(servletCtx, new MockHttpServletRequest(), new MockHttpServletResponse());
tag.setPageContext(pageContext);
}
use of org.springframework.mock.web.MockPageContext in project spring-security by spring-projects.
the class AuthorizeTagTests method setUp.
// ~ Methods
// ========================================================================================================
@Before
public void setUp() throws Exception {
SecurityContextHolder.getContext().setAuthentication(currentUser);
StaticWebApplicationContext ctx = new StaticWebApplicationContext();
BeanDefinitionBuilder webExpressionHandler = BeanDefinitionBuilder.rootBeanDefinition(DefaultWebSecurityExpressionHandler.class);
webExpressionHandler.addPropertyValue("permissionEvaluator", permissionEvaluator);
ctx.registerBeanDefinition("expressionHandler", webExpressionHandler.getBeanDefinition());
ctx.registerSingleton("wipe", MockWebInvocationPrivilegeEvaluator.class);
MockServletContext servletCtx = new MockServletContext();
servletCtx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx);
authorizeTag = new JspAuthorizeTag();
authorizeTag.setPageContext(new MockPageContext(servletCtx, request, new MockHttpServletResponse()));
}
use of org.springframework.mock.web.MockPageContext in project spring-security by spring-projects.
the class AbstractCsrfTagTests method setUp.
@Before
public void setUp() {
MockServletContext servletContext = new MockServletContext();
this.request = new MockHttpServletRequest(servletContext);
this.response = new MockHttpServletResponse();
MockPageContext pageContext = new MockPageContext(servletContext, this.request, this.response);
this.tag = new MockTag();
this.tag.setPageContext(pageContext);
}
use of org.springframework.mock.web.MockPageContext in project logging-log4j2 by apache.
the class SetLoggerTagTest method setUp.
@Before
public void setUp() {
this.context = new MockPageContext();
this.tag = new SetLoggerTag();
this.tag.setPageContext(this.context);
}
use of org.springframework.mock.web.MockPageContext in project logging-log4j2 by apache.
the class CatchingTagTest method setUp.
@Before
public void setUp() {
this.tag = new CatchingTag();
this.tag.setPageContext(new MockPageContext());
this.tag.setLogger(this.logger);
}
Aggregations