class routingExceptionHandlingTestCase(unittest.TestCase):

    def setUp(self):
        # Create an OpenFlow folder 
        self.of = CMFOpenflowTool('of')
        
        # Create a Process Definition with two activity (Begin, End) and one transition.
        self.of.addProcess(id='exception_handling', BeginEnd=1)
        self.pd = getattr(self.of, 'exception_handling')
        self.pd.addTransition(id='exception_handling', From='Begin', To='End')
        getattr(self.pd, 'Begin').edit(kind='standard')
        getattr(self.pd, 'End').edit(kind='standard')

        # Create a Process Instance of the Process definition mentioned above
        pid = self.of.addInstance('exception_handling', 'test', 'testComment', 'TestTitle', 1)
        self.pi = getattr(self.of, pid)
    

    def checkFallout(self):
        self.of.falloutWorkitem(self.pi.id, '0'), 'fall out not correct'
        assert getattr(self.pi, '0').status == 'fallout', 'first workitem status not correct'
        self.of.fallinWorkitem(self.pi.id, '0', 'exception_handling', 'Begin'), 'fall in not correct'
        self.of.endFallinWorkitem(self.pi.id, '0'), 'fall out not correct'
        assert getattr(self.pi, '0').status != 'fallout', 'first workitem status not correct'