private void setUpDependencies() { config.setServletContext(context); request.setSession(session); session.setupServletContext(context); pageContext = createMockPageContext(); pageContext.setServletConfig(config); pageContext.setServletRequest(request); pageContext.setServletResponse(response); filterConfig.setupServletContext(context); setUpJspFactory(); }
/** * Sets the specified <code>ValidatorResources</code>. The easiest * way to create <code>ValidatorResources</code> is the method * {@link #createValidatorResources}. * @param validatorResources the <code>ValidatorResources</code> */ public void setValidatorResources(ValidatorResources validatorResources) { String key = ValidatorPlugIn.VALIDATOR_KEY + mockFactory.getMockModuleConfig().getPrefix(); mockFactory.getMockServletContext().setAttribute(key, validatorResources); }
/** * Deletes all filters in the filter chain. */ public void releaseFilters() { mockFactory.getMockFilterChain().release(); mockFactory.getMockFilterChain().setServlet(servlet); }
private void createMockObjects() { mockMapping = createMockActionMapping(); mapping = mockMapping; mockModuleConfig = createMockModuleConfig(); mockActionServlet = createMockActionServlet(); mockActionServlet.setServletConfig(getMockServletConfig()); mockActionServlet.setServletContext(getMockServletContext()); refresh(); }
/** * Get the currently present action messages from the session. * @return the action messages */ public ActionMessages getActionMessagesFromSession() { return (ActionMessages)mockFactory.getMockSession().getAttribute(messageAttributeKey); }
/** * Adds several request parameters. * @param key the * @param values the request values */ public void addRequestParameter(String key, String[] values) { mockFactory.getMockRequest().setupAddParameter(key, values); }
/** * Sets the session attribute for the specified key * @param key the session key * @param value the value */ public void setSessionAttribute(String key, Object value) { mockFactory.getMockSession().setAttribute(key, value); } }
/** * Returns the session attribute for the specified key * @param key the session key * @return the attribute */ public Object getSessionAttribute(String key) { return mockFactory.getMockSession().getAttribute(key); }
/** * Sets the specified locale as a session attribute * using <code>Globals.LOCALE_KEY</code> as the key. You can * use this method, if your action calls * <code>Action.getLocale(HttpServletRequest)</code>. * @param locale the locale */ public void setLocale(Locale locale) { mockFactory.getMockSession().setAttribute(Globals.LOCALE_KEY, locale); }
/** * Clears the output content */ public void clearOutput() { mockFactory.getMockResponse().resetBuffer(); }
/** * Always return a valid <code>ActionForward</code>. * The input parameter of this mapping will be used * as the name and path for the <code>ActionForward</code>. */ public ActionForward getInputForward() { return new MockActionForward(getInput(), getInput(), false); } }
private void setUpDependencies() { config.setServletContext(context); request.setSession(session); session.setupServletContext(context); pageContext = createMockPageContext(); pageContext.setServletConfig(config); pageContext.setServletRequest(request); pageContext.setServletResponse(response); filterConfig.setupServletContext(context); setUpJspFactory(); }
/** * Sets the specified <code>DataSource</code>. * You can use this method, if your action calls * <code>Action.getDataSource(HttpServletRequest, String)</code>. * @param key the key of the <code>DataSource</code> * @param dataSource <code>DataSource</code> */ public void setDataSource(String key, DataSource dataSource) { key = key + mockFactory.getMockModuleConfig().getPrefix(); mockFactory.getMockServletContext().setAttribute(key, dataSource); }
/** * Deletes all filters in the filter chain. */ public void releaseFilters() { mockFactory.getMockFilterChain().release(); mockFactory.getMockFilterChain().setServlet(servlet); }
/** * Get the currently present action errors from the session. * @return the action messages */ public ActionMessages getActionErrorsFromSession() { return (ActionMessages)mockFactory.getMockSession().getAttribute(errorAttributeKey); }
/** * Sets the session attribute for the specified key * @param key the session key * @param value the value */ public void setSessionAttribute(String key, Object value) { mockFactory.getMockSession().setAttribute(key, value); } }
/** * Clears the output content */ public void clearOutput() { mockFactory.getMockResponse().resetBuffer(); }
private void setUpDependencies() { config.setServletContext(context); request.setSession(session); session.setupServletContext(context); pageContext = createMockPageContext(); pageContext.setServletConfig(config); pageContext.setServletRequest(request); pageContext.setServletResponse(response); filterConfig.setupServletContext(context); setUpJspFactory(); }
/** * Sets the specified <code>DataSource</code>. * You can use this method, if your action calls * <code>Action.getDataSource(HttpServletRequest, String)</code>. * @param key the key of the <code>DataSource</code> * @param dataSource <code>DataSource</code> */ public void setDataSource(String key, DataSource dataSource) { key = key + mockFactory.getMockModuleConfig().getPrefix(); mockFactory.getMockServletContext().setAttribute(key, dataSource); }
/** * Get the currently present action messages from the session. * @return the action messages */ public ActionMessages getActionMessagesFromSession() { return (ActionMessages)mockFactory.getMockSession().getAttribute(messageAttributeKey); }