use of org.springframework.mock.web.test.MockHttpServletResponse in project spring-framework by spring-projects.
the class FreeMarkerMacroTests method setUp.
@Before
public void setUp() throws Exception {
wac = new StaticWebApplicationContext();
wac.setServletContext(new MockServletContext());
// final Template expectedTemplate = new Template();
fc = new FreeMarkerConfigurer();
fc.setTemplateLoaderPaths("classpath:/", "file://" + System.getProperty("java.io.tmpdir"));
fc.afterPropertiesSet();
wac.getDefaultListableBeanFactory().registerSingleton("freeMarkerConfigurer", fc);
wac.refresh();
request = new MockHttpServletRequest();
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
request.setAttribute(DispatcherServlet.THEME_RESOLVER_ATTRIBUTE, new FixedThemeResolver());
response = new MockHttpServletResponse();
}
use of org.springframework.mock.web.test.MockHttpServletResponse in project spring-framework by spring-projects.
the class MappingJackson2XmlViewTests method setUp.
@Before
public void setUp() {
request = new MockHttpServletRequest();
response = new MockHttpServletResponse();
jsContext = ContextFactory.getGlobal().enterContext();
jsScope = jsContext.initStandardObjects();
view = new MappingJackson2XmlView();
}
use of org.springframework.mock.web.test.MockHttpServletResponse in project spring-framework by spring-projects.
the class TilesConfigurerTests method simpleBootstrap.
@Test
public void simpleBootstrap() {
MockServletContext servletContext = new MockServletContext();
TilesConfigurer tc = new TilesConfigurer();
tc.setDefinitions("/org/springframework/web/servlet/view/tiles3/tiles-definitions.xml");
tc.setCheckRefresh(true);
tc.setServletContext(servletContext);
tc.afterPropertiesSet();
ApplicationContext tilesContext = ServletUtil.getApplicationContext(servletContext);
BasicTilesContainer container = (BasicTilesContainer) TilesAccess.getContainer(tilesContext);
Request requestContext = new ServletRequest(container.getApplicationContext(), new MockHttpServletRequest(), new MockHttpServletResponse());
assertNotNull(container.getDefinitionsFactory().getDefinition("test", requestContext));
tc.destroy();
}
use of org.springframework.mock.web.test.MockHttpServletResponse in project spring-framework by spring-projects.
the class MappingJackson2JsonViewTests method setUp.
@Before
public void setUp() {
request = new MockHttpServletRequest();
response = new MockHttpServletResponse();
jsContext = ContextFactory.getGlobal().enterContext();
jsScope = jsContext.initStandardObjects();
view = new MappingJackson2JsonView();
}
use of org.springframework.mock.web.test.MockHttpServletResponse in project spring-framework by spring-projects.
the class JythonScriptTemplateTests method renderViewWithModel.
private MockHttpServletResponse renderViewWithModel(String viewUrl, Map<String, Object> model) throws Exception {
ScriptTemplateView view = createViewWithUrl(viewUrl);
MockHttpServletResponse response = new MockHttpServletResponse();
MockHttpServletRequest request = new MockHttpServletRequest();
view.renderMergedOutputModel(model, request, response);
return response;
}
Aggregations