def testRunWorkflow(self): wf = self.reader.parse_file(os.path.join(os.path.dirname(__file__), 'xml/openwfe/workflow1.xml')) for name in wf[0].tasks: wf[0].tasks[name].signal_connect('reached', self.on_reached_cb) wf[0].tasks[name].signal_connect('completed', on_complete_cb, self.taken_path) job = Job(wf[0]) try: job.complete_all() except: job.dump() raise path = [( 1, 'Start'), ( 2, 'concurrence_1'), ( 3, 'task_a1'), ( 4, 'task_a2'), ( 5, 'if_condition_1'), ( 6, 'task_a3'), ( 7, 'if_condition_1_end'), ( 8, 'if_condition_2'), ( 9, 'task_a5'), (10, 'if_condition_2_end'), ( 3, 'task_b1'), ( 4, 'task_b2'), ( 5, 'concurrence_1_end'), ( 6, 'task_c1'), ( 7, 'task_c2'), ( 8, 'End')] assert_same_path(self, path, self.taken_path)
def runWorkflow(self, wf): taken_path = {'reached': [], 'completed': []} for name, task in wf.tasks.iteritems(): task.signal_connect('reached', on_reached_cb, taken_path['reached']) task.signal_connect('completed', on_complete_cb, taken_path['completed']) # Execute all tasks within the Job. job = Job(wf) self.assert_(not job.is_completed(), 'Job is complete before start') try: job.complete_all() except: job.dump() raise self.assert_(job.is_completed(), 'complete_all() returned, but job is not complete\n' + job.task_tree.get_dump()) #job.task_tree.dump() assert_same_path(self, self.expected_path, taken_path['completed'])