SpringEnvironmentSetupListener implements ServletContextListener { @Override public void contextInitialized( ServletContextEvent servletContextEvent ) { ServletContext context = servletContextEvent.getServletContext(); String solutionPath = PentahoHttpSessionHelper.getSolutionPath( context ); if ( solutionPath != null ) { String systemPath = solutionPath + File.separator + "system"; System.setProperty( "PentahoSystemPath", systemPath ); } }  @Override void contextInitialized( ServletContextEvent servletContextEvent ); @Override void contextDestroyed( ServletContextEvent servletContextEvent );  }
@Test public void testContextInitialized() throws Exception { File tmp = File.createTempFile( "SpringEnvironmentSetupListenerTest", ".tmp" ); tmp.deleteOnExit(); when( context.getInitParameter( "solution-path" ) ).thenReturn( tmp.getParent() ); setupListener.contextInitialized( contextEvent ); assertEquals( tmp.getParent() + File.separator + "system", System.getProperty( "PentahoSystemPath" ) ); }