Package org.springframework.mock.web.test

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


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

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

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


  @Test
  public void testInternalResourceViewResolverWithJstlAndContextParam() throws Exception {
    Locale locale = !Locale.GERMAN.equals(Locale.getDefault()) ? Locale.GERMAN : Locale.FRENCH;

    MockServletContext sc = new MockServletContext();
    sc.addInitParameter(Config.FMT_LOCALIZATION_CONTEXT, "org/springframework/web/context/WEB-INF/context-messages");
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.addMessage("code1", locale, "messageX");
    wac.refresh();
    InternalResourceViewResolver vr = new InternalResourceViewResolver();
View Full Code Here

    XmlWebApplicationContext ctx = new XmlWebApplicationContext();
    ctx.setConfigLocation("programmatic.xml");
    ContextLoaderListener cll = new ContextLoaderListener(ctx);

    MockServletContext sc = new MockServletContext();
    sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "from-init-param.xml");

    try {
      cll.contextInitialized(new ServletContextEvent(sc));
      fail("expected exception");
    } catch (Throwable t) {
View Full Code Here

    XmlWebApplicationContext ctx = new XmlWebApplicationContext();
    //ctx.setConfigLocation("programmatic.xml"); // nothing set programmatically
    ContextLoaderListener cll = new ContextLoaderListener(ctx);

    MockServletContext sc = new MockServletContext();
    sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "from-init-param.xml");

    try {
      cll.contextInitialized(new ServletContextEvent(sc));
      fail("expected exception");
    } catch (Throwable t) {
View Full Code Here

    };
    //ctx.setConfigLocation("programmatic.xml"); // nothing set programmatically
    ContextLoaderListener cll = new ContextLoaderListener(ctx);

    MockServletContext sc = new MockServletContext();
    sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM, "from-init-param.xml");

    try {
      cll.contextInitialized(new ServletContextEvent(sc));
      fail("expected exception");
    } catch (Throwable t) {
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.