mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-01-10 02:05:40 +00:00
0892db6fa7
git-subtree-dir: SpiffWorkflow git-subtree-split: 63db3e45947ec66b8d0efc2c74064004f8ff482c
60 lines
2.2 KiB
Python
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())
|