Package org.springframework.mock.web.test

Examples of org.springframework.mock.web.test.MockServletContext.addInitParameter()


  }

  public void testHtmlEscapeTagWithContextParamTrue() throws JspException {
    PageContext pc = createPageContext();
    MockServletContext sc = (MockServletContext) pc.getServletContext();
    sc.addInitParameter(WebUtils.HTML_ESCAPE_CONTEXT_PARAM, "true");
    HtmlEscapeTag tag = new HtmlEscapeTag();
    tag.setDefaultHtmlEscape(false);
    tag.setPageContext(pc);
    tag.doStartTag();
View Full Code Here


    MockServletContext sc = (MockServletContext) pc.getServletContext();
    HtmlEscapeTag tag = new HtmlEscapeTag();
    tag.setPageContext(pc);
    tag.doStartTag();

    sc.addInitParameter(WebUtils.HTML_ESCAPE_CONTEXT_PARAM, "false");
    assertTrue("Correct default", !tag.getRequestContext().isDefaultHtmlEscape());
    tag.setDefaultHtmlEscape(true);
    assertTrue("Correct doStartTag return value", tag.doStartTag() == Tag.EVAL_BODY_INCLUDE);
    assertTrue("Correctly enabled", tag.getRequestContext().isDefaultHtmlEscape());
    tag.setDefaultHtmlEscape(false);
View Full Code Here

    initLogging(url.getFile(), true);
  }

  private void initLogging(String location, boolean refreshInterval) {
    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, location);
    if (refreshInterval) {
      sc.addInitParameter(Log4jWebConfigurer.REFRESH_INTERVAL_PARAM, "10");
    }
    Log4jWebConfigurer.initLogging(sc);
View Full Code Here

  private void initLogging(String location, boolean refreshInterval) {
    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, location);
    if (refreshInterval) {
      sc.addInitParameter(Log4jWebConfigurer.REFRESH_INTERVAL_PARAM, "10");
    }
    Log4jWebConfigurer.initLogging(sc);

    try {
      assertLogOutput();
View Full Code Here

  @Test
  public void testLog4jConfigListener() {
    Log4jConfigListener listener = new Log4jConfigListener();

    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, RELATIVE_PATH);
    listener.contextInitialized(new ServletContextEvent(sc));

    try {
      assertLogOutput();
    } finally {
View Full Code Here

  }

  @Test
  public void testServletContextParameterFactoryBean() {
    MockServletContext sc = new MockServletContext();
    sc.addInitParameter("myParam", "myValue");

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.add("initParamName", "myParam");
View Full Code Here

  @Test
  @Deprecated
  public void testServletContextPropertyPlaceholderConfigurer() {
    MockServletContext sc = new MockServletContext();
    sc.addInitParameter("key4", "mykey4");

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);

    MutablePropertyValues pvs = new MutablePropertyValues();
View Full Code Here

  @Test
  @Deprecated
  public void testServletContextPropertyPlaceholderConfigurerWithLocalOverriding() {
    MockServletContext sc = new MockServletContext();
    sc.addInitParameter("key4", "mykey4");

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);

    MutablePropertyValues pvs = new MutablePropertyValues();
View Full Code Here

  @Test
  @Deprecated
  public void testServletContextPropertyPlaceholderConfigurerWithContextOverride() {
    MockServletContext sc = new MockServletContext();
    sc.addInitParameter("key4", "mykey4");

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);

    MutablePropertyValues pvs = new MutablePropertyValues();
View Full Code Here

  @Test
  @Deprecated
  public void testServletContextPropertyPlaceholderConfigurerWithContextOverrideAndAttributes() {
    MockServletContext sc = new MockServletContext();
    sc.addInitParameter("key4", "mykey4");
    sc.setAttribute("key4", "attrkey4");

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.