PentahoSystemReadyListener implements ServletContextListener { @Override public void contextDestroyed( ServletContextEvent servletContextEvent ) { Repository jcrRepository = PentahoSystem.get( Repository.class, "jcrRepository", null ); if ( jcrRepository == null ) { Logger.error( PentahoSystemReadyListener.class.getName(), "Cannot obtain JCR repository. Exiting" ); return; } if ( !( jcrRepository instanceof JackrabbitRepository ) ) { Logger.error( PentahoSystemReadyListener.class.getName(), String.format( "Expected RepositoryImpl, but got: [%s]. Exiting", jcrRepository.getClass().getName() ) ); return; } ( (JackrabbitRepository) jcrRepository ).shutdown(); }  @Override void contextInitialized( ServletContextEvent servletContextEvent ); @Override void contextDestroyed( ServletContextEvent servletContextEvent );  }
@Test public void testContextDestroyed() throws Exception { systemReadyListener.contextDestroyed( contextEvent ); }