SolutionPropertiesFileConfiguration extends PropertiesFileConfiguration { protected static String getSolutionPath() { String solutionPath = null; if ( PentahoSystem.getApplicationContext() != null ) { solutionPath = PentahoSystem.getApplicationContext().getSolutionPath( "system" ); } else { solutionPath = System.getProperty( "PentahoSystemPath" ); } return solutionPath; } SolutionPropertiesFileConfiguration( String id, String propFile );   }
@Test public void testGetSolutionPath_fromSystemProperties() throws Exception { System.setProperty( "PentahoSystemPath", f.getParent() ); PentahoSystem.setApplicationContext( null ); String solutionPath = SolutionPropertiesFileConfiguration.getSolutionPath(); assertEquals( f.getParent(), solutionPath ); }
@Test public void testGetSolutionPath_fromAppContext() throws Exception { IApplicationContext appContext = mock( IApplicationContext.class ); when( appContext.getSolutionPath( "system" ) ).thenReturn( f.getParent() ); PentahoSystem.setApplicationContext( appContext ); String solutionPath = SolutionPropertiesFileConfiguration.getSolutionPath(); assertEquals( f.getParent(), solutionPath ); }