//package com.palmnest.webapp.listener;
//
//import junit.framework.TestCase;
//import org.springframework.mock.web.MockServletContext;
//import org.springframework.web.context.ContextLoader;
//import org.springframework.web.context.ContextLoaderListener;
//import org.springframework.web.context.WebApplicationContext;
//
//import com.palmnest.application.Constants;
//import com.palmnest.webapp.listener.StartupListener;
//
//import javax.servlet.ServletContextEvent;
//import javax.servlet.ServletContextListener;
//
//
///**
// * This class tests the StartupListener class to verify that variables are
// * placed into the servlet context.
// *
// * @author <a href="mailto:chasel.java@gmail.com">Chasel Li</a>
// */
//public class StartupListenerTest extends TestCase {
//    private MockServletContext sc = null;
//    private ServletContextListener listener = null;
//    private ContextLoaderListener springListener = null;
//
//    protected void setUp() throws Exception {
//        super.setUp();
//        sc = new MockServletContext("");
//
//        // initialize Spring
//        sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
//                "classpath:/applicationContext-dao.xml, " +
//                "classpath:/applicationContext-service.xml, " +
//                "classpath:/applicationContext-resources.xml");
//
//        springListener = new ContextLoaderListener();
//        springListener.contextInitialized(new ServletContextEvent(sc));
//        listener = new StartupListener();
//    }
//
//    protected void tearDown() throws Exception {
//        super.tearDown();
//        // cleanup: close sessionFactory and related resources (search index locks)
//        springListener.closeWebApplicationContext(sc);
//        springListener = null;
//        listener = null;
//        sc = null;
//    }
//
//    public void testContextInitialized() {
//        listener.contextInitialized(new ServletContextEvent(sc));
//
//        assertTrue(sc.getAttribute(WebApplicationContext
//                .ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE) != null);
//        assertTrue(sc.getAttribute(Constants.AVAILABLE_ROLES) != null);
//    }
//}
