@Test public void testOnEnvironmentInit() throws Exception { final List<KettleLifecycleListener> listeners = new ArrayList<KettleLifecycleListener>(); listeners.add( createLifecycleListener() ); KettleLifecycleSupport kettleLifecycleSupport = new KettleLifecycleSupport(); assertNotNull( typeListenerRegistration.getValue() ); KettleLifecycleListener preInit = createLifecycleListener(); listeners.add( preInit ); doAnswer( new Answer() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { listeners.add( createLifecycleListener() ); return null; } } ).when( preInit ).onEnvironmentInit(); verifyNoMoreInteractions( listeners.toArray() ); kettleLifecycleSupport.onEnvironmentInit(); for ( KettleLifecycleListener listener : listeners ) { verify( listener ).onEnvironmentInit(); } verifyNoMoreInteractions( listeners.toArray() ); KettleLifecycleListener postInit = createLifecycleListener(); verify( postInit ).onEnvironmentInit(); verifyNoMoreInteractions( listeners.toArray() ); }
public void onEnvironmentInit() throws KettleException { if ( initialized.compareAndSet( false, true ) ) { for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) { onEnvironmentInit( listener ); } } }
KettleLifecycleSupport { public void onEnvironmentInit() throws KettleException { if ( initialized.compareAndSet( false, true ) ) { for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) { onEnvironmentInit( listener ); } } } }
KettleLifecycleSupport { public void onEnvironmentInit() throws KettleException { if ( initialized.compareAndSet( false, true ) ) { for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) { onEnvironmentInit( listener ); } } } KettleLifecycleSupport(); }
KettleLifecycleSupport { public void onEnvironmentInit() throws KettleException { if ( initialized.compareAndSet( false, true ) ) { for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) { onEnvironmentInit( listener ); } } } KettleLifecycleSupport(); void onEnvironmentInit(); void onEnvironmentShutdown(); }
KettleLifecycleSupport { public void onEnvironmentInit() throws KettleException { if ( initialized.compareAndSet( false, true ) ) { for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) { onEnvironmentInit( listener ); } } } KettleLifecycleSupport(); void onEnvironmentInit(); void onEnvironmentShutdown();  }