本文整理匯總了Python中SpiffWorkflow.bpmn.workflow.BpmnWorkflow.accept_message方法的典型用法代碼示例。如果您正苦於以下問題:Python BpmnWorkflow.accept_message方法的具體用法?Python BpmnWorkflow.accept_message怎麽用?Python BpmnWorkflow.accept_message使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SpiffWorkflow.bpmn.workflow.BpmnWorkflow
的用法示例。
在下文中一共展示了BpmnWorkflow.accept_message方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: MessageInterruptsSpTest
# 需要導入模塊: from SpiffWorkflow.bpmn.workflow import BpmnWorkflow [as 別名]
# 或者: from SpiffWorkflow.bpmn.workflow.BpmnWorkflow import accept_message [as 別名]
class MessageInterruptsSpTest(BpmnWorkflowTestCase):
def setUp(self):
self.spec = self.load_spec()
def load_spec(self):
return self.load_workflow_spec('Test-Workflows/*.bpmn20.xml', 'Message Interrupts SP')
def testRunThroughHappySaveAndRestore(self):
self.workflow = BpmnWorkflow(self.spec)
self.save_restore()
self.workflow.do_engine_steps()
self.save_restore()
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.do_next_exclusive_step('Do Something In a Subprocess')
self.workflow.do_engine_steps()
self.save_restore()
self.do_next_exclusive_step('Ack Subprocess Done')
self.workflow.do_engine_steps()
self.save_restore()
self.workflow.do_engine_steps()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))
def testRunThroughInterruptSaveAndRestore(self):
self.workflow = BpmnWorkflow(self.spec)
self.save_restore()
self.workflow.do_engine_steps()
self.save_restore()
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.workflow.accept_message('Test Message')
self.workflow.do_engine_steps()
self.save_restore()
self.do_next_exclusive_step('Acknowledge SP Interrupt Message')
self.workflow.do_engine_steps()
self.save_restore()
self.workflow.do_engine_steps()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))
示例2: MessagesTest
# 需要導入模塊: from SpiffWorkflow.bpmn.workflow import BpmnWorkflow [as 別名]
# 或者: from SpiffWorkflow.bpmn.workflow.BpmnWorkflow import accept_message [as 別名]
class MessagesTest(BpmnWorkflowTestCase):
def setUp(self):
self.spec = self.load_spec()
def load_spec(self):
return self.load_workflow_spec('Test-Workflows/*.bpmn20.xml', 'Test Workflows')
def testRunThroughHappy(self):
self.workflow = BpmnWorkflow(self.spec)
self.do_next_exclusive_step('Select Test', choice='Messages')
self.workflow.do_engine_steps()
self.assertEqual([], self.workflow.get_tasks(Task.READY))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.workflow.accept_message('Wrong Message')
self.assertEqual([], self.workflow.get_tasks(Task.READY))
self.workflow.accept_message('Test Message')
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.assertEqual(
'Test Message', self.workflow.get_tasks(Task.READY)[0].task_spec.description)
self.workflow.do_engine_steps()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))
def testRunThroughSaveAndRestore(self):
self.workflow = BpmnWorkflow(self.spec)
self.do_next_exclusive_step('Select Test', choice='Messages')
self.workflow.do_engine_steps()
self.save_restore()
self.assertEqual([], self.workflow.get_tasks(Task.READY))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.workflow.accept_message('Wrong Message')
self.assertEqual([], self.workflow.get_tasks(Task.READY))
self.workflow.accept_message('Test Message')
self.save_restore()
self.workflow.do_engine_steps()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))
示例3: MessageInterruptsTest
# 需要導入模塊: from SpiffWorkflow.bpmn.workflow import BpmnWorkflow [as 別名]
# 或者: from SpiffWorkflow.bpmn.workflow.BpmnWorkflow import accept_message [as 別名]
class MessageInterruptsTest(BpmnWorkflowTestCase):
def setUp(self):
self.spec = self.load_spec()
# self.spec.dump()
def load_spec(self):
return self.load_workflow_spec('Test-Workflows/*.bpmn20.xml', 'Test Workflows')
def testRunThroughHappySaveAndRestore(self):
self.workflow = BpmnWorkflow(self.spec)
self.save_restore()
self.do_next_exclusive_step('Select Test', choice='Message Interrupts')
self.workflow.do_engine_steps()
self.save_restore()
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.do_next_exclusive_step('Do Something That Takes A Long Time')
self.save_restore()
self.workflow.do_engine_steps()
self.assertEqual(0, len(self.workflow.get_tasks(Task.WAITING)))
self.save_restore()
self.workflow.do_engine_steps()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))
def testRunThroughMessageInterruptSaveAndRestore(self):
self.workflow = BpmnWorkflow(self.spec)
self.save_restore()
self.do_next_exclusive_step('Select Test', choice='Message Interrupts')
self.workflow.do_engine_steps()
self.save_restore()
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.workflow.accept_message('Test Message')
self.save_restore()
self.workflow.do_engine_steps()
self.save_restore()
self.assertEqual(0, len(self.workflow.get_tasks(Task.WAITING)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.do_next_exclusive_step('Acknowledge Interrupt Message')
self.save_restore()
self.workflow.do_engine_steps()
self.save_restore()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))
def testRunThroughHappy(self):
self.workflow = BpmnWorkflow(self.spec)
self.do_next_exclusive_step('Select Test', choice='Message Interrupts')
self.workflow.do_engine_steps()
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.do_next_exclusive_step('Do Something That Takes A Long Time')
self.workflow.do_engine_steps()
self.assertEqual(0, len(self.workflow.get_tasks(Task.WAITING)))
self.workflow.do_engine_steps()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))
def testRunThroughMessageInterrupt(self):
self.workflow = BpmnWorkflow(self.spec)
self.do_next_exclusive_step('Select Test', choice='Message Interrupts')
self.workflow.do_engine_steps()
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.WAITING)))
self.workflow.accept_message('Test Message')
self.workflow.do_engine_steps()
self.assertEqual(0, len(self.workflow.get_tasks(Task.WAITING)))
self.assertEqual(1, len(self.workflow.get_tasks(Task.READY)))
self.do_next_exclusive_step('Acknowledge Interrupt Message')
self.workflow.do_engine_steps()
self.assertEqual(
0, len(self.workflow.get_tasks(Task.READY | Task.WAITING)))