AsyncSystemListener implements IPentahoSystemListener { @Override public void shutdown() { if ( null != asyncExecutor ) { asyncExecutor.shutdown(); } if ( null != cache ) { cache.cleanup(); } }  @Override boolean startup( final IPentahoSession iPentahoSession ); @Override void shutdown();  }
@Test public void shutdown() throws Exception { MicroPlatform microPlatform = MicroPlatformFactory.create(); final IPentahoAsyncExecutor asyncExecutor = mock( IPentahoAsyncExecutor.class ); final IReportContentCache cache = mock( IReportContentCache.class ); final AsyncSystemListener asyncSystemListener = new AsyncSystemListener(); microPlatform.define( "IPentahoAsyncExecutor", asyncExecutor ); microPlatform.define( "IReportContentCache", cache ); microPlatform.addLifecycleListener( asyncSystemListener ); microPlatform.start(); microPlatform.stop(); verify( asyncExecutor, times( 1 ) ).shutdown(); verify( cache, times( 1 ) ).cleanup(); microPlatform = null; }