assertFalse( boot.isInitialized() );
}
@Test
public void testBootListeners() throws Exception {
PentahoSystemBoot boot = new PentahoSystemBoot();
boot.setFilePath( "test-src/solution" );
boot.define( ISolutionEngine.class.getSimpleName(), Object1.class.getName(),
IPentahoDefinableObjectFactory.Scope.GLOBAL );
TestLifecycleListener lifecycleListener1 = new TestLifecycleListener();
TestLifecycleListener lifecycleListener2 = new TestLifecycleListener();
boot.addLifecycleListener( lifecycleListener1 );
List<IPentahoSystemListener> lifecycleListeners1 = boot.getLifecycleListeners();
assertEquals( 1, lifecycleListeners1.size() );
assertEquals( lifecycleListener1, lifecycleListeners1.get( 0 ) );
assertFalse( TestLifecycleListener.startupCalled );
assertFalse( TestLifecycleListener.shutdownCalled );
List<IPentahoSystemListener> lifecycleListeners2 = new ArrayList<IPentahoSystemListener>();
lifecycleListeners2.add( lifecycleListener2 );
boot.setLifecycleListeners( lifecycleListeners2 );
List<IPentahoSystemListener> lifecycleListeners3 = boot.getLifecycleListeners();
assertEquals( 1, lifecycleListeners3.size() );
assertEquals( lifecycleListener2, lifecycleListeners3.get( 0 ) );
assertEquals( lifecycleListeners2, lifecycleListeners3 );
IPentahoObjectFactory factory = boot.getFactory();
assertNotNull( "object factory is null", factory );
assertTrue( "object factory not definable", factory instanceof IPentahoDefinableObjectFactory );
assertFalse( boot.isInitialized() );
boolean ok = boot.start();
assertNull( boot.getSettingsProvider() );
assertTrue( boot.isInitialized() );
assertTrue( ok );
assertTrue( TestLifecycleListener.startupCalled );
assertFalse( TestLifecycleListener.shutdownCalled );
boot.stop();
assertFalse( boot.isInitialized() );
assertTrue( TestLifecycleListener.startupCalled );
assertTrue( TestLifecycleListener.shutdownCalled );
}