#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def test_system_events_triggered( self ) : #NEWLINE# #INDENT# batons = list ( ) #NEWLINE# stub_pipeline_provider = StubPipelineProvider ( batons . append ) #NEWLINE# self . runtime_environment . resource_manager . register ( 'pipeline.test_pipeline' , stub_pipeline_provider ) #NEWLINE# provider = system_events_provider . SystemEventsProvider ( ) #NEWLINE# configuration_manager = self . runtime_environment . configuration_manager #NEWLINE# for event_type in ( 'startup' , 'shutdown' ) : #NEWLINE# #INDENT# configuration_manager . set ( ( 'system-events.%s.name' % stub_pipeline_provider ) , 'pipeline.test_pipeline' ) #NEWLINE# #UNINDENT# provider . configure ( self . runtime_environment ) #NEWLINE# self . runtime_environment . dependency_manager . resolve_initial_states ( ) #NEWLINE# ( yield util . wait ( 0 ) ) #NEWLINE# self . assertEquals ( batons , [ dict ( event_type = 'startup' ) ] ) #NEWLINE# batons [ : ] = list ( ) #NEWLINE# reactor . fireSystemEvent ( 'shutdown' ) #NEWLINE# self . assertEquals ( batons , [ dict ( event_type = 'shutdown' ) ] )