DefaultContentSystemListener implements IPentahoSystemListener { @Override public boolean startup( IPentahoSession arg0 ) { ISystemConfig systemSettings = PentahoSystem.get( ISystemConfig.class ); Boolean enableAsyncLoading = true; if ( systemSettings != null ) { String disableLoadAsyncStr = systemSettings.getProperty( "system.enable-async-default-content-loading" ); enableAsyncLoading = Boolean.valueOf( disableLoadAsyncStr ); } Runnable runnable = new Runnable() { @Override public void run() { try { SecurityHelper.getInstance().runAsSystem( new Callable<Void>() { @Override public Void call() throws Exception { Logger.info( this.getClass().getName(), "Default content importer has started" ); String solutionPath = PentahoSystem.getApplicationContext().getSolutionPath( DEFAULT_CONTENT_FOLDER ); File directory = new File( solutionPath ); IPlatformImporter importer = PentahoSystem.get( IPlatformImporter.class ); ArchiveLoader archiveLoader = new ArchiveLoader( importer ); archiveLoader.loadAll( directory, ArchiveLoader.ZIPS_FILTER ); return null; } } ); } catch ( Exception e ) { Logger.error( this.getClass().getName(), e.getMessage() ); } } }; if ( enableAsyncLoading ) { Thread t = new Thread( runnable ); t.setDaemon( true ); t.setName( "Default Content Loader Thread" ); t.start(); } else { runnable.run(); } return true; }  @Override void shutdown(); @Override boolean startup( IPentahoSession arg0 );  }
@Test public void testStartup() throws Exception { when( systemConfig.getProperty( "system.enable-async-default-content-loading" ) ).thenReturn( "false" ); when( appContext.getSolutionPath( "system/default-content" ) ).thenReturn( TestResourceLocation.TEST_RESOURCES + "/SystemConfig/system" ); boolean startup = defaultContentSystemListener.startup( session ); assertTrue( startup ); }