Beispiel #1
0
    def _change_listener_state(self, new_state):
        process = self.process
        procname = process.config.name
        old_state = process.listener_state

        msg = '%s: %s -> %s' % (procname,
                                getEventListenerStateDescription(old_state),
                                getEventListenerStateDescription(new_state))
        process.config.options.logger.debug(msg)

        process.listener_state = new_state
        if new_state == EventListenerStates.UNKNOWN:
            msg = ('%s: has entered the UNKNOWN state and will no longer '
                   'receive events, this usually indicates the process '
                   'violated the eventlistener protocol' % procname)
            process.config.options.logger.warn(msg)
Beispiel #2
0
    def _change_listener_state(self, new_state):
        process = self.process
        procname = process.config.name
        old_state = process.listener_state

        msg = '%s: %s -> %s' % (
            procname,
            getEventListenerStateDescription(old_state),
            getEventListenerStateDescription(new_state)
            )
        process.config.options.logger.debug(msg)

        process.listener_state = new_state
        if new_state == EventListenerStates.UNKNOWN:
            msg = ('%s: has entered the UNKNOWN state and will no longer '
                   'receive events, this usually indicates the process '
                   'violated the eventlistener protocol' % procname)
            process.config.options.logger.warn(msg)
 def test_getEventListenerStateDescription_returns_None_when_not_found(self):
     self.assertEqual(states.getEventListenerStateDescription(3.14159),
         None)
 def test_getEventListenerStateDescription_returns_string_when_found(self):
     state = states.EventListenerStates.ACKNOWLEDGED
     self.assertEqual(states.getEventListenerStateDescription(state),
         'ACKNOWLEDGED')
Beispiel #5
0
 def test_getEventListenerStateDescription_returns_None_when_not_found(
         self):
     self.assertEqual(states.getEventListenerStateDescription(3.14159),
                      None)
Beispiel #6
0
 def test_getEventListenerStateDescription_returns_string_when_found(self):
     state = states.EventListenerStates.ACKNOWLEDGED
     self.assertEqual(states.getEventListenerStateDescription(state),
                      'ACKNOWLEDGED')