spiff-arena/tests/SpiffWorkflow/bpmn/DataStoreReferenceTest.py

37 lines
1.8 KiB
Python
Raw Normal View History

Squashed 'SpiffWorkflow/' changes from 11e4b4f9..2ca6ebf8 2ca6ebf8 Data stores (#298) c2fc9d22 Merge pull request #297 from sartography/bugfix/copy-all-data-when-input-or-output-list-empty 07e3b582 add checks for len == 0 when copying based on io spec b439f69f Merge pull request #296 from sartography/bugfix/subprocess-access-to-data-objects 6d2a2031 update spiff subworkflow tasks too 992c3867 make data objects referenceable within subprocesses 6c8ff5cd allow subprocesses & call activities to have different data copy policies 2b14f3a4 initialize subprocesses in _update_hook instead of _on_ready_before 791f335d Merge pull request #295 from sartography/improvement/remove-camunda-from-base-and-misc-cleanup 28b579be remove a few unused, duplicative, and debugging methods 8f14d109 remove some other unused diagrams and tests 408bc673 rely on top level camunda parser for almost all namespace references 895b2cc9 remove camunda namespace from base bpmn parser 76ecbf7c Merge pull request #294 from sartography/bugfix/reactivate-boundary-event 82b6c8ad hack to ensure timers (and other events) are reset if returned to via loop reset 590903f4 Merge pull request #292 from sartography/feature/multiinstance-refactor 53749004 fix bug & typo f31726db raise error on attempting to migrate workflows with MI 44e6d08d create spiff multiinstance task 2168c022 create camunda MI that approximates what it used to do 9894cea5 some improvements and bugfixes f857ad5d remove some now unused functionality & tests, create a few more tests 6fead9d0 updated serializer & fixes for most tests ec662ecd add parallel multiinstance bd19b2a8 working sequential multiinstance 2f9c192b further cleanup around _update_hook 947792bf fix bug in exclusive gateway migration d3d87b28 add io spec to all tasks f1586e27 add support for standard loop tasks git-subtree-dir: SpiffWorkflow git-subtree-split: 2ca6ebf800d4ff1d54f3e1c48798a2cb879560f7
2023-02-23 15:42:56 +00:00
from tests.SpiffWorkflow.bpmn.BpmnLoaderForTests import TestDataStore
from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase
from SpiffWorkflow.bpmn.exceptions import WorkflowDataException
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow
class DataStoreReferenceTest(BpmnWorkflowTestCase):
def _do_engine_steps(self, file, processid, save_restore):
spec, subprocesses = self.load_workflow_spec('data_store.bpmn', 'JustDataStoreRef')
self.workflow = BpmnWorkflow(spec, subprocesses)
if save_restore:
self.save_restore()
self.workflow.do_engine_steps()
def _check_last_script_task_data(self):
last_script_task_data = self.workflow.get_tasks_from_spec_name("Activity_1skgyn9")[0].data
self.assertEqual(len(last_script_task_data), 1)
self.assertEqual(last_script_task_data["x"], "Sue")
def testCanInterpretDataStoreReferenceWithInputsAndOutputs(self):
self._do_engine_steps('data_store.bpmn', 'JustDataStoreRef', False)
self._check_last_script_task_data()
def testCanSaveRestoreDataStoreReferenceWithInputsAndOutputs(self):
self._do_engine_steps('data_store.bpmn', 'JustDataStoreRef', True)
self._check_last_script_task_data()
def testSeparateWorkflowInstancesCanShareDataUsingDataStores(self):
self._do_engine_steps('data_store_write.bpmn', 'JustDataStoreRef', False)
self._do_engine_steps('data_store_read.bpmn', 'JustDataStoreRef', False)
self._check_last_script_task_data()
def testSeparateRestoredWorkflowInstancesCanShareDataUsingDataStores(self):
self._do_engine_steps('data_store_write.bpmn', 'JustDataStoreRef', True)
self._do_engine_steps('data_store_read.bpmn', 'JustDataStoreRef', True)
self._check_last_script_task_data()