spiff-arena/tests/SpiffWorkflow/bpmn/ParallelManyThreadsAtSamePointTestNested.py
Jon Herron 0892db6fa7 Squashed 'SpiffWorkflow/' content from commit 63db3e4
git-subtree-dir: SpiffWorkflow
git-subtree-split: 63db3e45947ec66b8d0efc2c74064004f8ff482c
2022-10-12 10:19:53 -04:00

60 lines
2.2 KiB
Python

# -*- coding: utf-8 -*-
import unittest
import logging
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
from tests.SpiffWorkflow.bpmn.BaseParallelTestCase import BaseParallelTestCase
__author__ = 'matth'
class ParallelManyThreadsAtSamePointTestNested(BaseParallelTestCase):
def setUp(self):
spec, subprocesses = self.load_workflow_spec(
'Test-Workflows/Parallel-Many-Threads-At-Same-Point-Nested.bpmn20.xml',
'Parallel Many Threads At Same Point Nested')
self.workflow = BpmnWorkflow(spec, subprocesses)
def test_depth_first(self):
instructions = []
for split1 in ['SP 1', 'SP 2']:
for sp in ['A', 'B']:
for split2 in ['1', '2']:
for t in ['A', 'B']:
instructions.append(split1 + sp + "|" + split2 + t)
instructions.append(split1 + sp + "|" + 'Inner Done')
instructions.append("!" + split1 + sp + "|" + 'Inner Done')
if sp == 'A':
instructions.append("!Outer Done")
instructions.append('Outer Done')
instructions.append("!Outer Done")
logging.info('Doing test with instructions: %s', instructions)
self._do_test(instructions, only_one_instance=False, save_restore=True)
def test_breadth_first(self):
instructions = []
for t in ['A', 'B']:
for split2 in ['1', '2']:
for sp in ['A', 'B']:
for split1 in ['SP 1', 'SP 2']:
instructions.append(split1 + sp + "|" + split2 + t)
for split1 in ['SP 1', 'SP 2']:
for sp in ['A', 'B']:
for split2 in ['1', '2']:
instructions += [split1 + sp + "|" + 'Inner Done']
for split1 in ['SP 1', 'SP 2']:
instructions += ['Outer Done']
logging.info('Doing test with instructions: %s', instructions)
self._do_test(instructions, only_one_instance=False, save_restore=True)
def suite():
return unittest.TestLoader().loadTestsFromTestCase(ParallelManyThreadsAtSamePointTestNested)
if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(suite())