{
application.registerActivationEventListener( new EventsRecorder( events ) );
}
};
Application application = assembler.application();
application.passivate();
Iterator<ActivationEvent> it = events.iterator();
// Activation
assertEvent( it.next(), ACTIVATING, "Application" );
assertEvent( it.next(), ACTIVATING, "Layer" );
assertEvent( it.next(), ACTIVATING, "Module" );
// Lazy Service NOT activated
assertEvent( it.next(), ACTIVATED, "Module" );
assertEvent( it.next(), ACTIVATED, "Layer" );
assertEvent( it.next(), ACTIVATED, "Application" );
// Passivation
assertEvent( it.next(), PASSIVATING, "Application" );
assertEvent( it.next(), PASSIVATING, "Layer" );
assertEvent( it.next(), PASSIVATING, "Module" );
// Lazy Service NOT passivated
assertEvent( it.next(), PASSIVATED, "Module" );
assertEvent( it.next(), PASSIVATED, "Layer" );
assertEvent( it.next(), PASSIVATED, "Application" );
assertFalse( it.hasNext() );
events.clear();
application.activate();
Module module = assembler.module();
module.findService( TestService.class ).get().test();
application.passivate();
for( ActivationEvent event : events ) {
System.out.println( event );
}