Package org.springframework.web.context

Examples of org.springframework.web.context.ContextLoaderListener.contextInitialized()


    ContextLoaderListener cll = new ContextLoaderListener(ctx);

    MockServletContext sc = new MockServletContext();

    try {
      cll.contextInitialized(new ServletContextEvent(sc));
      fail("expected exception");
    } catch (Throwable t) {
      // assert that an attempt was made to load the correct XML
      assertTrue(t.getMessage(), t.getMessage().endsWith(
          "Could not open ServletContext resource [/programmatic.xml]"));
View Full Code Here


    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) {
      // assert that an attempt was made to load the correct XML
      assertTrue(t.getMessage(), t.getMessage().endsWith(
          "Could not open ServletContext resource [/from-init-param.xml]"));
View Full Code Here

    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) {
      // assert that an attempt was made to load the correct XML
      assertTrue(t.getMessage().endsWith(
          "Could not open ServletContext resource [/from-init-param.xml]"));
View Full Code Here

    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) {
      // assert that an attempt was made to load the correct XML
      System.out.println(t.getMessage());
      assertTrue(t.getMessage().endsWith(
View Full Code Here

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

    try {
      cll.contextInitialized(new ServletContextEvent(sc));
      fail("expected exception");
    } catch (Throwable t) {
      // assert that an attempt was made to load the correct XML
      System.out.println(t.getMessage());
      assertTrue(t.getMessage().endsWith(
View Full Code Here

    ContextLoaderListener cll = new ContextLoaderListener(ctx);

    ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(ctx);
    scanner.scan("bogus.pkg");

    cll.contextInitialized(new ServletContextEvent(new MockServletContext()));
  }

  /**
   * Ensure that ContextLoaderListener and AnnotationConfigApplicationContext interact nicely.
   */
 
View Full Code Here

    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();

    ctx.scan("does.not.matter");

    ContextLoaderListener cll = new ContextLoaderListener(ctx);
    cll.contextInitialized(new ServletContextEvent(new MockServletContext()));
  }
}
View Full Code Here

                "classpath*:/" + pkg + "/dao/applicationContext-*.xml," +
                "classpath*:META-INF/applicationContext-*.xml");
       
        ServletContextListener contextListener = new ContextLoaderListener();
        ServletContextEvent event = new ServletContextEvent(sc);
        contextListener.contextInitialized(event);
    }

    protected void tearDown() throws Exception {
        super.tearDown();
        listener = null;
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.