SessionListener implements HttpSessionListener, HttpSessionActivationListener,
		ServletContextListener, Serializable { @Override public void contextInitialized(ServletContextEvent event) { final long start = System.currentTimeMillis(); System.getProperty("java.io.tmpdir"); final String contextPath = Parameters.getContextPath(event.getServletContext()); if (!instanceEnabled) { if (!CONTEXT_PATHS.contains(contextPath)) { instanceEnabled = true; } else { return; } } CONTEXT_PATHS.add(contextPath); Parameters.initialize(event.getServletContext()); LOG.debug("JavaMelody listener init started"); final JdbcWrapper jdbcWrapper = JdbcWrapper.SINGLETON; jdbcWrapper.initServletContext(event.getServletContext()); if (!Parameters.isNoDatabase()) { jdbcWrapper.rebindDataSources(); } final long duration = System.currentTimeMillis() - start; LOG.debug("JavaMelody listener init done in " + duration + " ms"); } SessionListener();  SessionListener(boolean instanceEnabled); static int getSessionCount(); static long getSessionAgeSum(); static void invalidateAllSessionsExceptCurrentSession(HttpSession currentSession); static void invalidateSession(String sessionId); static List<SessionInformations> getAllSessionsInformations(); static void sortSessions(List<SessionInformations> sessionsInformations); static SessionInformations getSessionInformationsBySessionId(String sessionId); static void bindSession(HttpSession session); static HttpSession getCurrentSession(); static void unbindSession(); @Override void contextInitialized(ServletContextEvent event); @Override void contextDestroyed(ServletContextEvent event); @Override void sessionCreated(HttpSessionEvent event); @Override void sessionDestroyed(HttpSessionEvent event); @Override void sessionDidActivate(HttpSessionEvent event); @Override void sessionWillPassivate(HttpSessionEvent event); @Override String toString(); static final String CSRF_TOKEN_SESSION_NAME; static final String SESSION_COUNTRY_KEY; static final String SESSION_REMOTE_ADDR; static final String SESSION_REMOTE_USER; static final String SESSION_USER_AGENT; }
@Test public void testContextInitialized() { ServletContext servletContext = createNiceMock(ServletContext.class); expect(servletContext.getServerInfo()).andReturn("Mock").anyTimes(); expect(servletContext.getMajorVersion()).andReturn(2).anyTimes(); expect(servletContext.getMinorVersion()).andReturn(5).anyTimes(); ServletContextEvent servletContextEvent = new ServletContextEvent(servletContext); replay(servletContext); sessionListener.contextInitialized(servletContextEvent); sessionListener.contextDestroyed(servletContextEvent); verify(servletContext); Utils.setProperty(Parameter.NO_DATABASE, "true"); servletContext = createNiceMock(ServletContext.class); expect(servletContext.getServerInfo()).andReturn("Mock").anyTimes(); expect(servletContext.getMajorVersion()).andReturn(2).anyTimes(); expect(servletContext.getMinorVersion()).andReturn(5).anyTimes(); servletContextEvent = new ServletContextEvent(servletContext); replay(servletContext); sessionListener.contextInitialized(servletContextEvent); sessionListener.contextDestroyed(servletContextEvent); verify(servletContext); }