From c237e218b24f70ed7fbb3d40b7df1ed788ca7a12 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 2 Feb 2023 20:59:28 -0500 Subject: [PATCH] Squashed 'SpiffWorkflow/' changes from 98c6294f..0e61be85 0e61be85 Merge pull request #289 from sartography/improvement/execution-and-serialization-cleanup 527684da fix some typos in the class & method docs 0dff44a4 Merge branch 'main' into improvement/execution-and-serialization-cleanup 64737498 Allow for other PythonScriptEngine environments besides task data (#288) dd63e916 remove some unused tests & diagrams 24aae519 clean up various small stuff 3b2dc35d use context when opening files for parsing 69eec3eb update class/method docs 24528dfb move all spec conversion classes to top level 5af33b11 remove some unused methods related to old serializer 931b90fb reorganize serializer 4e81ed29 consolidate pointless serializer classes d62acf02 change task_spec._update_hook to return a boolean indicating whether the task is ready git-subtree-dir: SpiffWorkflow git-subtree-split: 0e61be85c47474a33037e6f398e64c96e02f13ad --- tests/SpiffWorkflow/bpmn/BoxDeepCopyTest.py | 2 +- .../SpiffWorkflow/bpmn/BpmnLoaderForTests.py | 7 +- .../bpmn/BpmnWorkflowTestCase.py | 7 +- tests/SpiffWorkflow/bpmn/CustomScriptTest.py | 5 +- .../bpmn/FeelExpressionEngineTest.py | 5 +- .../SpiffWorkflow/bpmn/NavListMulipleEnds.py | 47 - .../bpmn/PythonScriptEngineEnvironmentTest.py | 80 ++ tests/SpiffWorkflow/bpmn/TooManyLoopsTest.py | 7 +- .../bpmn/data/ComplexNavigation.bpmn | 746 ---------- ...ExclusiveGatewayMultipleEndNavigation.bpmn | 143 -- .../bpmn/data/NavLeapFrogLong.bpmn | 1209 ----------------- .../bpmn/data/invalid_process_sub.bpmn | 39 - tests/SpiffWorkflow/bpmn/data/rrt.bpmn | 336 ----- .../bpmn/data/serialization/v1.0.json | 6 +- .../bpmn/data/task_data_size.bpmn | 81 ++ .../data/timer_event_changes_last_task.bpmn | 77 -- .../bpmn/events/EventBasedGatewayTest.py | 5 +- .../bpmn/events/TimerCycleStartTest.py | 7 +- .../bpmn/events/TimerCycleTest.py | 7 +- .../bpmn/events/TimerDateTest.py | 5 +- .../events/TimerDurationBoundaryOnTaskTest.py | 3 +- .../bpmn/events/TimerDurationTest.py | 3 +- .../bpmn/serializer/BaseTestCase.py | 3 +- .../serializer/BpmnWorkflowSerializerTest.py | 3 +- .../bpmn/serializer/VersionMigrationTest.py | 6 +- tests/SpiffWorkflow/camunda/BaseTestCase.py | 12 +- .../camunda/CallActivityMessageTest.py | 2 +- .../camunda/DMNCustomScriptTest.py | 5 +- .../camunda/MessageBoundaryEventTest.py | 3 +- .../camunda/MultiInstanceDMNTest.py | 10 +- .../camunda/data/exclusive_gateway_pmi.bpmn | 94 -- .../camunda/data/random_fact.svg | 4 - .../camunda/data/top_workflow.bpmn | 64 - .../camunda/specs/UserTaskSpecTest.py | 5 +- tests/SpiffWorkflow/dmn/DecisionRunner.py | 2 +- tests/SpiffWorkflow/dmn/HitPolicyTest.py | 13 +- .../dmn/feel_engine/FeelDictDecisionTest.py | 4 +- .../FeelDictDotNotationDecisionTest.py | 2 +- .../DictDotNotationDecisionTest.py | 2 +- ...tDotNotationDecisionWeirdCharactersTest.py | 2 +- .../dmn/python_engine/PythonDecisionRunner.py | 5 +- tests/SpiffWorkflow/spiff/BaseTestCase.py | 22 +- 42 files changed, 248 insertions(+), 2842 deletions(-) delete mode 100644 tests/SpiffWorkflow/bpmn/NavListMulipleEnds.py create mode 100644 tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py delete mode 100644 tests/SpiffWorkflow/bpmn/data/ComplexNavigation.bpmn delete mode 100644 tests/SpiffWorkflow/bpmn/data/ExclusiveGatewayMultipleEndNavigation.bpmn delete mode 100644 tests/SpiffWorkflow/bpmn/data/NavLeapFrogLong.bpmn delete mode 100644 tests/SpiffWorkflow/bpmn/data/invalid_process_sub.bpmn delete mode 100644 tests/SpiffWorkflow/bpmn/data/rrt.bpmn create mode 100644 tests/SpiffWorkflow/bpmn/data/task_data_size.bpmn delete mode 100644 tests/SpiffWorkflow/bpmn/data/timer_event_changes_last_task.bpmn delete mode 100644 tests/SpiffWorkflow/camunda/data/exclusive_gateway_pmi.bpmn delete mode 100644 tests/SpiffWorkflow/camunda/data/random_fact.svg delete mode 100644 tests/SpiffWorkflow/camunda/data/top_workflow.bpmn diff --git a/tests/SpiffWorkflow/bpmn/BoxDeepCopyTest.py b/tests/SpiffWorkflow/bpmn/BoxDeepCopyTest.py index 9ebade90..c0b3cc79 100644 --- a/tests/SpiffWorkflow/bpmn/BoxDeepCopyTest.py +++ b/tests/SpiffWorkflow/bpmn/BoxDeepCopyTest.py @@ -1,6 +1,6 @@ import unittest -from SpiffWorkflow.bpmn.PythonScriptEngine import Box +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box class BoxDeepCopyTest(unittest.TestCase): diff --git a/tests/SpiffWorkflow/bpmn/BpmnLoaderForTests.py b/tests/SpiffWorkflow/bpmn/BpmnLoaderForTests.py index 9f90268d..2623e688 100644 --- a/tests/SpiffWorkflow/bpmn/BpmnLoaderForTests.py +++ b/tests/SpiffWorkflow/bpmn/BpmnLoaderForTests.py @@ -7,7 +7,7 @@ from SpiffWorkflow.bpmn.parser.TaskParser import TaskParser from SpiffWorkflow.bpmn.parser.task_parsers import ConditionalGatewayParser from SpiffWorkflow.bpmn.parser.util import full_tag -from SpiffWorkflow.bpmn.serializer.bpmn_converters import BpmnTaskSpecConverter +from SpiffWorkflow.bpmn.serializer.helpers.spec import TaskSpecConverter # Many of our tests relied on the Packager to set the calledElement attribute on # Call Activities. I've moved that code to a customized parser. @@ -35,9 +35,6 @@ class TestUserTask(UserTask): task.set_data(choice=choice) task.complete() - @classmethod - def deserialize(self, serializer, wf_spec, s_state): - return serializer.deserialize_generic(wf_spec, s_state, TestUserTask) class TestExclusiveGatewayParser(ConditionalGatewayParser): @@ -47,7 +44,7 @@ class TestExclusiveGatewayParser(ConditionalGatewayParser): return cond return "choice == '%s'" % sequence_flow_node.get('name', None) -class TestUserTaskConverter(BpmnTaskSpecConverter): +class TestUserTaskConverter(TaskSpecConverter): def __init__(self, data_converter=None): super().__init__(TestUserTask, data_converter) diff --git a/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py b/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py index 8f2f0af5..ba564abc 100644 --- a/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py +++ b/tests/SpiffWorkflow/bpmn/BpmnWorkflowTestCase.py @@ -7,13 +7,16 @@ from SpiffWorkflow.bpmn.parser.BpmnParser import BpmnValidator from SpiffWorkflow.task import TaskState -from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer +from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer, DEFAULT_SPEC_CONFIG +from SpiffWorkflow.bpmn.serializer.task_spec import UserTaskConverter from .BpmnLoaderForTests import TestUserTaskConverter, TestBpmnParser __author__ = 'matth' +DEFAULT_SPEC_CONFIG['task_specs'].append(TestUserTaskConverter) -wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter([TestUserTaskConverter]) + +wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter(spec_config=DEFAULT_SPEC_CONFIG) class BpmnWorkflowTestCase(unittest.TestCase): diff --git a/tests/SpiffWorkflow/bpmn/CustomScriptTest.py b/tests/SpiffWorkflow/bpmn/CustomScriptTest.py index 8cbca47f..d2b21886 100644 --- a/tests/SpiffWorkflow/bpmn/CustomScriptTest.py +++ b/tests/SpiffWorkflow/bpmn/CustomScriptTest.py @@ -4,6 +4,7 @@ import unittest from SpiffWorkflow.exceptions import WorkflowTaskException from SpiffWorkflow.task import TaskState from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase @@ -17,8 +18,8 @@ class CustomBpmnScriptEngine(PythonScriptEngine): It will execute python code read in from the bpmn. It will also make any scripts in the scripts directory available for execution. """ def __init__(self): - augment_methods = {'custom_function': my_custom_function} - super().__init__(scripting_additions=augment_methods) + environment = TaskDataEnvironment({'custom_function': my_custom_function}) + super().__init__(environment=environment) class CustomInlineScriptTest(BpmnWorkflowTestCase): diff --git a/tests/SpiffWorkflow/bpmn/FeelExpressionEngineTest.py b/tests/SpiffWorkflow/bpmn/FeelExpressionEngineTest.py index 6fe07dec..474e988d 100644 --- a/tests/SpiffWorkflow/bpmn/FeelExpressionEngineTest.py +++ b/tests/SpiffWorkflow/bpmn/FeelExpressionEngineTest.py @@ -3,6 +3,7 @@ import unittest from SpiffWorkflow.bpmn.FeelLikeScriptEngine import FeelLikeScriptEngine, FeelInterval +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BoxedTaskDataEnvironment from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase import datetime @@ -12,7 +13,7 @@ __author__ = 'matth' class FeelExpressionTest(BpmnWorkflowTestCase): def setUp(self): - self.expressionEngine = FeelLikeScriptEngine() + self.expressionEngine = FeelLikeScriptEngine(environment=BoxedTaskDataEnvironment()) def testRunThroughExpressions(self): tests = [("string length('abcd')", 4, {}), @@ -62,7 +63,7 @@ class FeelExpressionTest(BpmnWorkflowTestCase): ] } x = self.expressionEngine._evaluate( - """sum([1 for x in exclusive if x.get('ExclusiveSpaceAMComputingID',None)==None])""", + """sum([1 for x in exclusive if x.get('ExclusiveSpaceAMComputingID',None)==None])""", data ) self.assertEqual(x, 1) diff --git a/tests/SpiffWorkflow/bpmn/NavListMulipleEnds.py b/tests/SpiffWorkflow/bpmn/NavListMulipleEnds.py deleted file mode 100644 index 4d410025..00000000 --- a/tests/SpiffWorkflow/bpmn/NavListMulipleEnds.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - - - -import unittest -from SpiffWorkflow.bpmn.workflow import BpmnWorkflow -from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase - -__author__ = 'kellym' - - -class NavListExclusiveGatewayTest(BpmnWorkflowTestCase): - """The example bpmn diagram looks roughly like this, a gateway - that leads to two different end points - - [Step 1] -> - -> 'False' -> [Alternate End] -> END A - -> 'True' -> [Step 2] -> END B - """ - - def setUp(self): - self.spec = self.load_workflow1_spec() - - def load_workflow1_spec(self): - return self.load_workflow_spec('ExclusiveGatewayMultipleEndNavigation.bpmn','ExclusiveGatewayMultipleEndNavigation') - - def testRunThroughHappy(self): - - self.workflow = BpmnWorkflow(self.spec) - self.workflow.do_engine_steps() - nav_list = self.workflow.get_nav_list() - self.assertEqual(6, len(nav_list)) - - self.assertEqual("Step 1", nav_list[0]["description"]) - self.assertEqual("GatewayToEnd", nav_list[1]["description"]) - self.assertEqual("False", nav_list[2]["description"]) - self.assertEqual("Step End", nav_list[3]["description"]) - self.assertEqual("True", nav_list[4]["description"]) - self.assertEqual("Step 2", nav_list[5]["description"]) - - self.assertEqual(0, nav_list[0]["indent"]) - - -def suite(): - return unittest.TestLoader().loadTestsFromTestCase(NavListExclusiveGatewayTest) -if __name__ == '__main__': - unittest.TextTestRunner(verbosity=2).run(suite()) diff --git a/tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py b/tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py new file mode 100644 index 00000000..cb9c40c0 --- /dev/null +++ b/tests/SpiffWorkflow/bpmn/PythonScriptEngineEnvironmentTest.py @@ -0,0 +1,80 @@ +import json + +from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase +from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BasePythonScriptEngineEnvironment +from SpiffWorkflow.bpmn.workflow import BpmnWorkflow +from SpiffWorkflow.task import TaskState + +def example_global(): + pass + +class NonTaskDataExampleEnvironment(BasePythonScriptEngineEnvironment): + def __init__(self, environment_globals, environment): + self.environment = environment + self.environment.update(environment_globals) + super().__init__(environment_globals) + + def evaluate(self, expression, context, external_methods=None): + pass + + def execute(self, script, context, external_methods=None): + self.environment.update(context) + self.environment.update(external_methods or {}) + exec(script, self.environment) + self.environment = {k: v for k, v in self.environment.items() if k not in external_methods} + + def user_defined_values(self): + return {k: v for k, v in self.environment.items() if k not in self.globals} + +class PythonScriptEngineEnvironmentTest(BpmnWorkflowTestCase): + + def setUp(self): + spec, subprocesses = self.load_workflow_spec('task_data_size.bpmn', 'Process_ccz6oq2') + self.workflow = BpmnWorkflow(spec, subprocesses) + + def testTaskDataSizeWithDefaultPythonScriptEngine(self): + self.workflow.do_engine_steps() + + self.assertIn("a", self.workflow.data) + self.assertIn("b", self.workflow.data) + self.assertIn("c", self.workflow.data) + self.assertIn("d", self.workflow.data) + + task_data_len = self._get_task_data_len() + d_uniques = set(self.workflow.data["d"]) + d_len = len(self.workflow.data["d"]) + + self.assertGreater(task_data_len, 15000) + self.assertEqual(d_len, 512*3) + self.assertEqual(d_uniques, {"a", "b", "c"}) + + def testTaskDataSizeWithNonTaskDataEnvironmentBasedPythonScriptEngine(self): + script_engine_environment = NonTaskDataExampleEnvironment({"example_global": example_global}, {}) + script_engine = PythonScriptEngine(environment=script_engine_environment) + self.workflow.script_engine = script_engine + + self.workflow.do_engine_steps() + self.workflow.data.update(script_engine.environment.user_defined_values()) + + self.assertIn("a", self.workflow.data) + self.assertIn("b", self.workflow.data) + self.assertIn("c", self.workflow.data) + self.assertIn("d", self.workflow.data) + self.assertNotIn("example_global", self.workflow.data) + + task_data_len = self._get_task_data_len() + d_uniques = set(self.workflow.data["d"]) + d_len = len(self.workflow.data["d"]) + + self.assertEqual(task_data_len, 2) + self.assertEqual(d_len, 512*3) + self.assertEqual(d_uniques, {"a", "b", "c"}) + + def _get_task_data_len(self): + tasks_to_check = self.workflow.get_tasks(TaskState.FINISHED_MASK) + task_data = [task.data for task in tasks_to_check] + task_data_to_check = list(filter(len, task_data)) + task_data_len = len(json.dumps(task_data_to_check)) + return task_data_len + diff --git a/tests/SpiffWorkflow/bpmn/TooManyLoopsTest.py b/tests/SpiffWorkflow/bpmn/TooManyLoopsTest.py index 072d9375..0b3d5603 100644 --- a/tests/SpiffWorkflow/bpmn/TooManyLoopsTest.py +++ b/tests/SpiffWorkflow/bpmn/TooManyLoopsTest.py @@ -4,6 +4,7 @@ import datetime import unittest from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase @@ -14,10 +15,10 @@ class CustomScriptEngine(PythonScriptEngine): It will execute python code read in from the bpmn. It will also make any scripts in the scripts directory available for execution. """ def __init__(self): - augment_methods = { + environment = TaskDataEnvironment({ 'timedelta': datetime.timedelta, - } - super().__init__(scripting_additions=augment_methods) + }) + super().__init__(environment=environment) class TooManyLoopsTest(BpmnWorkflowTestCase): diff --git a/tests/SpiffWorkflow/bpmn/data/ComplexNavigation.bpmn b/tests/SpiffWorkflow/bpmn/data/ComplexNavigation.bpmn deleted file mode 100644 index 87b743e0..00000000 --- a/tests/SpiffWorkflow/bpmn/data/ComplexNavigation.bpmn +++ /dev/null @@ -1,746 +0,0 @@ - - - - - Flow_0kcrx5l - - - - Flow_0kcrx5l - Flow_1seuuie - - - The Study's Responsible Organization is needed in order to confirm the Department Chair. If it is the same as the Primary Investigator's Primary Department show below, we have all the information needed to determine the Department Chair. - - -**Primary Investigator's Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - - - - - - - - - - - - Flow_12obxbo - Flow_1y4gjsg - - - Flow_02614fd - Flow_0c4tt8e - ro.chair = {} -ro.chair.uid = RO_Chair_CID -ro.chair.name_degree = RO_Chair_Name_Degree -ro.chair.title = RO_Chair_Title -ro.chair.sig_block = RO_Chair_Sig_Block - - - Flow_1seuuie - Flow_1ni06mz - Flow_1y9edqt - - - Flow_1y9edqt - Flow_1oriwwz - Flow_185jvp3 - - - Flow_185jvp3 - Flow_1dh8c45 - sch_enum = [] -if pi.E0.schoolAbbrv != "MD": - sch_enum_md = [ - { - "value": "MD", - "label": "Medicine" - }, - ] -else: - sch_enum_md = [] -if pi.E0.schoolAbbrv != "AS": - sch_enum_as = [ - { - "value": "AS", - "label": "Arts & Science" - }, - ] -else: - sch_enum_as = [] -if pi.E0.schoolAbbrv != "CU": - sch_enum_cu = [ - { - "value": "CU", - "label": "Education" - }, - ] -else: - sch_enum_cu = [] -if pi.E0.schoolAbbrv != "NR": - sch_enum_nr = [ - { - "value": "NR", - "label": "Nursing" - }, - ] -else: - sch_enum_nr = [] -sch_enum = sch_enum_md + sch_enum_as + sch_enum_cu + sch_enum_nr -del(sch_enum_md) -del(sch_enum_as) -del(sch_enum_cu) -del(sch_enum_nr) - - - - - - - - - - - - - - Flow_1dh8c45 - Flow_0mf9npl - - - Flow_1oriwwz - Flow_0nmpxmc - Flow_12obxbo - Flow_03s8gvx - Flow_0nzochy - Flow_0h955ao - - - Flow_1y4gjsg - Flow_0lnb8jw - Flow_1fqtd41 - Flow_0a626ba - - - Flow_0a626ba - Flow_0ssrpqx - if PIsPrimaryDepartmentSameAsRO.value == "diffSchool": - ro.schoolName = RO_StudySchool.label - ro.schoolAbbrv = RO_StudySchool.value - -if PIsPrimaryDepartmentSameAsRO.value != "yes": - if ro.schoolAbbrv == "MD": - ro.deptName = RO_StudyDeptMedicine.label - ro.deptAbbrv = RO_StudyDeptMedicine.value - elif ro.schoolAbbrv == "AS": - ro.deptName = RO_StudyDeptArtsSciences.label - ro.deptAbbrv = RO_StudyDeptArtsSciences.value - elif ro.schoolAbbrv == "CU": - ro.deptName = RO_StudyDeptEducation.label - ro.deptAbbrv = RO_StudyDeptEducation.value - else: - ro.deptName = "" - ro.deptAbbrv = "" - - - The Study's Responsible Organization is needed in order to confirm the Department Chair. If it is the same as the Primary Investigator's Primary Department show below, we have all the information needed to determine the Department Chair. - - -**Primary Investigator's Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - - - - - - - - - - - - Flow_0nzochy - Flow_0lnb8jw - - - The Study's Responsible Organization is needed in order to confirm the Department Chair. If it is the same as the Primary Investigator's Primary Department show below, we have all the information needed to determine the Department Chair. - - -**Primary Investigator's Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - - - - - - - - - - - - Flow_0h955ao - Flow_1fqtd41 - - - Flow_0mf9npl - Flow_0nmpxmc - ro.schoolName = RO_StudySchool.label -ro.schoolAbbrv = RO_StudySchool.value - - - Flow_03s8gvx - Flow_0ssrpqx - Flow_0tnnt3b - - - ro.schoolAbbrv == "CU" - - - - - - - PIsPrimaryDepartmentSameAsRO.value != "yes" - - - - PIsPrimaryDepartmentSameAsRO.value == 'diffSchool' - - - - - - ro.schoolAbbrv not in ["MD", "AS", "CU"] - - - - ro.schoolAbbrv == "AS" - - - - - - - - Flow_1ni06mz - Flow_0tnnt3b - Flow_02614fd - - - temp - Flow_15xpsq8 - Flow_1g7q28p - - - Flow_0cqbu1f - Flow_1d4sb3d - Flow_12oux1f - Flow_0ygr7cu - - - The following Primary Coordinators were entered in Protocol Builder: -{%+ for key, value in pcs.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_pcs %}, {% endif %}{% endfor %} -To Save the current settings for all Primary Coordinators, select Save All. - - -Otherwise, edit each Coordinator as necessary and select the Save button for each. - -### Please provide supplemental information for: - #### {{ pc.display_name }} - ##### Title: {{ pc.title }} - - ##### Department: {{ pc.department }} - ##### Affiliation: {{ pc.affiliation }} - - - - - - - Flow_12oux1f - Flow_1ik148z - - - - Flow_0c4tt8e - Flow_05g7d16 - Flow_13zasb1 - - - The PI is also the RO Chair - Flow_13zasb1 - Flow_0cqbu1f - - - Flow_0efu6u1 - Flow_0a3fjzp - Flow_0ljn2v6 - Flow_0pdoc38 - - - The following Sub-Investigators were entered in Protocol Builder: -{%+ for key, value in subs.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_subs %}, {% endif %}{% endfor %} -To Save the current settings for all Sub-Investigators, select Save All. - - -Otherwise, edit each Sub-Investigator as necessary and select the Save button for each. - - -### Please provide supplemental information for: - #### {{ sub.display_name }} - ##### Title: {{ sub.title }} - - ##### Department: {{ sub.department }} - ##### Affiliation: {{ sub.affiliation }} - - - - - - - Flow_0ljn2v6 - Flow_07vu2b0 - - - - Flow_1ik148z - Flow_0ygr7cu - Flow_0a3fjzp - Flow_0rstqv5 - - - The following Additional Coordinators were entered in Protocol Builder: -{%+ for key, value in acs.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_acs %}, {% endif %}{% endfor %} -To Save the current settings for all Additional Coordinators, select Save All. - - - - -Otherwise, edit each Coordinator as necessary and select the Save button for each. - - -### Please provide supplemental information for: - #### {{ acs.display_name }} - ##### Title: {{ acs.title }} - - - ##### Department: {{ acs.department }} - ##### Affiliation: {{ acs.affiliation }} - Flow_0rstqv5 - Flow_0efu6u1 - - - - Flow_0pdoc38 - Flow_07vu2b0 - Flow_1g7q28p - Flow_0qti1ms - - - The following Additional Personnel were entered in Protocol Builder: -{%+ for key, value in aps.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_aps %}, {% endif %}{% endfor %} -To Save the current settings for all Additional Personnel, select Save All. - - - - -Otherwise, edit each Additional Personnel as necessary and select the Save button for each. - - - - -### Please provide supplemental information for: - #### {{ ap.display_name }} - ##### Title: {{ ap.title }} - - - ##### Department: {{ ap.department }} - ##### Affiliation: {{ ap.affiliation }} - - - - - - - Flow_0qti1ms - Flow_15xpsq8 - - - - ***Name & Degree:*** {{ RO_Chair_Name_Degree }} -***School:*** {{ RO_School }} -***Department:*** {{ RO_Department }} -***Title:*** {{ RO_Chair_Title }} -***Email:*** {{ RO_Chair_CID }} - - -{% if RO_Chair_CID != dc.uid %} - *Does not match the Department Chair specified in Protocol Builder, {{ dc.display_name }}* -{% endif %} - - - - - - - - - - Flow_05g7d16 - Flow_1d4sb3d - - - - - - - - - - - RO_Chair_CID == pi.uid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/bpmn/data/ExclusiveGatewayMultipleEndNavigation.bpmn b/tests/SpiffWorkflow/bpmn/data/ExclusiveGatewayMultipleEndNavigation.bpmn deleted file mode 100644 index 28c4a553..00000000 --- a/tests/SpiffWorkflow/bpmn/data/ExclusiveGatewayMultipleEndNavigation.bpmn +++ /dev/null @@ -1,143 +0,0 @@ - - - - - Flow_0kcrx5l - - - ##### Please confirm Primary Investigator entered in Protocol Builder is correct and if so, provide additional information: -### **{{ pi.display_name }}** -***Email:*** {{ pi.email_address }} - -**Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - -{% if is_me_pi %} -Since you are the person entering this information, you already have access and will receive all emails. -{% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Flow_147b9li - Flow_0xnj2rp - - - - - Flow_1dcsioh - Flow_147b9li - Flow_00prawo - - - tru - - - false - - - Flow_16qr5jf - - - - Flow_0kcrx5l - Flow_1dcsioh - - - No PI entered in PB - Flow_00prawo - Flow_16qr5jf - - - Flow_0xnj2rp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/bpmn/data/NavLeapFrogLong.bpmn b/tests/SpiffWorkflow/bpmn/data/NavLeapFrogLong.bpmn deleted file mode 100644 index 6a92338e..00000000 --- a/tests/SpiffWorkflow/bpmn/data/NavLeapFrogLong.bpmn +++ /dev/null @@ -1,1209 +0,0 @@ - - - - - Flow_0kcrx5l - - - Flow_0kcrx5l - Flow_1dcsioh - current_user = ldap() -investigators = study_info('investigators') -# Primary Investigator -pi = investigators.get('PI', None) -is_cu_pi = False -if pi != None: - hasPI = True - study_data_set("PiUid",pi['uid']) - if pi.get('uid', None) != None: - pi_invalid_uid = False - if pi['uid'] == current_user['uid']: - is_cu_pi = True - else: - pi_invalid_uid = True -else: - hasPI = False - -# Department Chair -dc = investigators.get('DEPT_CH', None) -if dc != None: - if dc.get('uid', None) != None: - dc_invalid_uid = False - else: - dc_invalid_uid = True -else: - dc_invalid_uid = False - -# Primary Coordinators -pcs = {} -is_cu_pc = False -cnt_pcs_uid = 0 -for k in investigators.keys(): - if k in ['SC_I','SC_II','IRBC']: - investigator = investigators.get(k) - if investigator.get('uid', None) != None: - if investigator['uid'] != current_user['uid']: - pcs[k] = investigator - cnt_pcs_uid = cnt_pcs_uid + 1 - else: - is_cu_pc = True - is_cu_pc_role = investigator['label'] - else: - pcs[k] = investigator -cnt_pcs = len(pcs.keys()) -if cnt_pcs != cnt_pcs_uid: - pcs_invalid_uid = True -else: - pcs_invalid_uid = False -if cnt_pcs > 0: - del(k) - del(investigator) - -# Additional Coordinators -acs = {} -is_cu_ac = False -cnt_acs_uid = 0 -for k in investigators.keys(): - if k == 'AS_C': - investigator = investigators.get(k) - if investigator.get('uid', None) != None: - if investigator['uid'] != current_user['uid']: - acs[k] = investigator - cnt_acs_uid = cnt_acs_uid + 1 - else: - is_cu_ac = True - is_cu_ac_role = investigator['label'] - else: - acs[k] = investigator -cnt_acs = len(acs.keys()) -if cnt_pcs != cnt_pcs_uid: - acs_invalid_uid = True -else: - acs_invalid_uid = False -if cnt_acs > 0: - del(k) - del(investigator) - -# Sub-Investigatoers -subs = {} -is_cu_subs = False -cnt_subs_uid = 0 -for k in investigators.keys(): - if k[:2] == 'SI': - investigator = investigators.get(k) - if investigator.get('uid', None) != None: - if investigator['uid'] != current_user['uid']: - subs[k] = investigator - cnt_subs_uid = cnt_subs_uid + 1 - else: - is_cu_subs = True - else: - subs[k] = investigator -cnt_subs = len(subs.keys()) -if cnt_subs != cnt_subs_uid: - subs_invalid_uid = True -else: - subs_invalid_uid = False -if cnt_subs > 0: - del(k) - del(investigator) - -# Additional Personnel -aps = {} -is_cu_ap = False -cnt_aps_uid = 0 -for k in investigators.keys(): - if k in ['SCI','DC']: - investigator = investigators.get(k) - if investigator.get('uid', None) != None: - if investigator['uid'] != current_user['uid']: - aps[k] = investigator - cnt_aps_uid = cnt_aps_uid + 1 - else: - is_cu_ap = True - is_cu_ap_role = investigator['label'] - else: - aps[k] = investigator -cnt_aps = len(aps.keys()) -if cnt_aps != cnt_aps_uid: - aps_invalid_uid = True -else: - aps_invalid_uid = False -if cnt_aps > 0: - del(k) - del(investigator) -del(investigators) - - - temp - Flow_10zn0h1 - Flow_0kp47dz - - - ##### Please confirm Primary Investigator entered in Protocol Builder is correct and if so, provide additional information: -### **{{ pi.display_name }}** -***Email:*** {{ pi.email_address }} - -**Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - -{% if is_me_pi %} -Since you are the person entering this information, you already have access and will receive all emails. -{% endif %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Flow_1kg5jot - Flow_1mplloa - - - - - Flow_1dcsioh - Flow_147b9li - Flow_00prawo - - - - not(hasPI) or (hasPI and pi_invalid_uid) - - - No PI entered in PB - Flow_00prawo - Flow_16qr5jf - - - Flow_0kpe12r - Flow_1ayisx2 - Flow_0xifvai - Flow_1oqem42 - - - - - The following Primary Coordinators were entered in Protocol Builder: -{%+ for key, value in pcs.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_pcs %}, {% endif %}{% endfor %} -To Save the current settings for all Primary Coordinators, select Save All. - - -Otherwise, edit each Coordinator as necessary and select the Save button for each. - -### Please provide supplemental information for: - #### {{ pc.display_name }} - ##### Title: {{ pc.title }} - - ##### Department: {{ pc.department }} - ##### Affiliation: {{ pc.affiliation }} - - - - - - - Flow_0xifvai - Flow_1n0k4pd - - - - cnt_pcs == 0 - - - Flow_0tfprc8 - Flow_0tsdclr - Flow_1grahhv - LDAP_dept = pi.department -length_LDAP_dept = len(LDAP_dept) -pi.E0 = {} -if length_LDAP_dept > 0: - E0_start = LDAP_dept.find("E0:") + 3 - E0_slice = LDAP_dept[E0_start:length_LDAP_dept] - E0_first_hyphen = E0_slice.find("-") - E0_dept_start = E0_first_hyphen + 1 - pi.E0.schoolAbbrv = E0_slice[0:E0_first_hyphen] - isSpace = " " in E0_slice - if isSpace: - E0_first_space = E0_slice.find(" ") - E0_spec_start = E0_first_space + 1 - E0_spec_end = len(E0_slice) - pi.E0.deptAbbrv = E0_slice[E0_dept_start:E0_first_space] - pi.E0.specName = E0_slice[E0_spec_start:E0_spec_end] - else: - pi.E0.specName = "" -else: - pi.E0.schoolAbbrv = "Not in LDAP" - pi.E0.deptAbbrv = "Not in LDAP" - pi.E0.specName = "Not in LDAP" - - - - The Study's Responsible Organization is needed in order to confirm the Department Chair. If it is the same as the Primary Investigator's Primary Department show below, we have all the information needed to determine the Department Chair. - - -**Primary Investigator's Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - - - - - - - - - - - - Flow_0iuzu7j - Flow_0whqr3p - - - - Flow_070j5fg - Flow_0vi6thu - Flow_00yhlrq - - - - RO_Chair_CID == pi.uid - - - The PI is also the RO Chair - Flow_00yhlrq - Flow_0kpe12r - - - - Flow_12ss6u8 - Flow_0dt3pjw - Flow_05rqrlf - Flow_0jxzqw1 - - - - - cnt_subs == 0 - - - The following Sub-Investigators were entered in Protocol Builder: -{%+ for key, value in subs.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_subs %}, {% endif %}{% endfor %} -To Save the current settings for all Sub-Investigators, select Save All. - - -Otherwise, edit each Sub-Investigator as necessary and select the Save button for each. - - -### Please provide supplemental information for: - #### {{ sub.display_name }} - ##### Title: {{ sub.title }} - - ##### Department: {{ sub.department }} - ##### Affiliation: {{ sub.affiliation }} - - - - - - - Flow_05rqrlf - Flow_0ofpgml - - - - Please enter the Private Investigator in Protocol Builder. - Flow_16qr5jf - - - - - Flow_1grahhv - Flow_1kg5jot - pi.E0.schoolName = PI_E0_schoolName -pi.E0.deptName = PI_E0_deptName -pi_experience_key = "pi_experience_" + pi.user_id -pi.experience = user_data_get(pi_experience_key,"") -ro = {} -ro['chair'] = {} - - - - Flow_1oo0ijr - Flow_070j5fg - ro.chair = {} -ro.chair.uid = RO_Chair_CID -ro.chair.name_degree = RO_Chair_Name_Degree -ro.chair.title = RO_Chair_Title -ro.chair.sig_block = RO_Chair_Sig_Block - - - Flow_1n0k4pd - Flow_1oqem42 - Flow_1gtl2o3 - Flow_0dt3pjw - - - - - The following Additional Coordinators were entered in Protocol Builder: -{%+ for key, value in acs.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_acs %}, {% endif %}{% endfor %} -To Save the current settings for all Additional Coordinators, select Save All. - - - - -Otherwise, edit each Coordinator as necessary and select the Save button for each. - - -### Please provide supplemental information for: - #### {{ acs.display_name }} - ##### Title: {{ acs.title }} - - - ##### Department: {{ acs.department }} - ##### Affiliation: {{ acs.affiliation }} - Flow_1gtl2o3 - Flow_12ss6u8 - - - - cnt_acs == 0 - - - Flow_1va8c15 - Flow_1yd7kbi - Flow_0w4d2bz - - - Flow_1yd7kbi - Flow_13la8l3 - Flow_0ycdxbl - - - PIsPrimaryDepartmentSameAsRO.value != "yes" - - - - PIsPrimaryDepartmentSameAsRO.value == 'diffSchool' - - - Flow_0ycdxbl - Flow_1fj9iz0 - sch_enum = [] -if pi.E0.schoolAbbrv != "MD": - sch_enum_md = [ - { - "value": "MD", - "label": "Medicine" - }, - ] -else: - sch_enum_md = [] -if pi.E0.schoolAbbrv != "AS": - sch_enum_as = [ - { - "value": "AS", - "label": "Arts & Science" - }, - ] -else: - sch_enum_as = [] -if pi.E0.schoolAbbrv != "CU": - sch_enum_cu = [ - { - "value": "CU", - "label": "Education" - }, - ] -else: - sch_enum_cu = [] -if pi.E0.schoolAbbrv != "NR": - sch_enum_nr = [ - { - "value": "NR", - "label": "Nursing" - }, - ] -else: - sch_enum_nr = [] -sch_enum = sch_enum_md + sch_enum_as + sch_enum_cu + sch_enum_nr -del(sch_enum_md) -del(sch_enum_as) -del(sch_enum_cu) -del(sch_enum_nr) - - - - - - - - - - - - - - - Flow_1fj9iz0 - Flow_1yz8k2a - - - - - Flow_13la8l3 - Flow_0mdjaid - Flow_0fw4rck - Flow_1azfvtx - Flow_0giqf35 - Flow_0iuzu7j - - - ro.schoolAbbrv not in ["MD", "AS", "CU"] - - - Flow_0whqr3p - Flow_0zc01f9 - Flow_1vyg8ir - Flow_0m9peiz - - - - Flow_0m9peiz - Flow_1vv63qa - if PIsPrimaryDepartmentSameAsRO.value == "diffSchool": - ro.schoolName = RO_StudySchool.label - ro.schoolAbbrv = RO_StudySchool.value - -if PIsPrimaryDepartmentSameAsRO.value != "yes": - if ro.schoolAbbrv == "MD": - ro.deptName = RO_StudyDeptMedicine.label - ro.deptAbbrv = RO_StudyDeptMedicine.value - elif ro.schoolAbbrv == "AS": - ro.deptName = RO_StudyDeptArtsSciences.label - ro.deptAbbrv = RO_StudyDeptArtsSciences.value - elif ro.schoolAbbrv == "CU": - ro.deptName = RO_StudyDeptEducation.label - ro.deptAbbrv = RO_StudyDeptEducation.value - else: - ro.deptName = "" - ro.deptAbbrv = "" - - - The Study's Responsible Organization is needed in order to confirm the Department Chair. If it is the same as the Primary Investigator's Primary Department show below, we have all the information needed to determine the Department Chair. - - -**Primary Investigator's Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - - - - - - - - - - - - Flow_1azfvtx - Flow_0zc01f9 - - - Flow_1e0yt3v - Flow_0shnt6k - Flow_1va8c15 - ro = {} -ro['schoolName'] = PI_E0_schoolName -ro['schoolAbbrv'] = pi.E0.schoolAbbrv -ro['deptName'] = pi.E0.deptName -ro['deptAbbrv'] = pi.E0.deptAbbrv - - - - - - The Study's Responsible Organization is needed in order to confirm the Department Chair. If it is the same as the Primary Investigator's Primary Department show below, we have all the information needed to determine the Department Chair. - - -**Primary Investigator's Primary Appointment** -***School:*** {{ pi.E0.schoolName }} -***Department:*** {{ pi.E0.deptName }} - - - - - - - - - - - - - Flow_0giqf35 - Flow_1vyg8ir - - - - - - - Flow_1yz8k2a - Flow_0mdjaid - ro.schoolName = RO_StudySchool.label -ro.schoolAbbrv = RO_StudySchool.value - - - - ro.schoolAbbrv == "AS" - - - ro.schoolAbbrv == "CU" - - - Flow_1vv63qa - Flow_0fw4rck - Flow_0vff9k5 - - - - Flow_0ofpgml - Flow_0jxzqw1 - Flow_0q56tn8 - Flow_0kp47dz - - - - - cnt_aps == 0 - - - The following Additional Personnel were entered in Protocol Builder: -{%+ for key, value in aps.items() %}{{value.display_name}} ({{key}}){% if loop.index is lt cnt_aps %}, {% endif %}{% endfor %} -To Save the current settings for all Additional Personnel, select Save All. - - - - -Otherwise, edit each Additional Personnel as necessary and select the Save button for each. - - - - -### Please provide supplemental information for: - #### {{ ap.display_name }} - ##### Title: {{ ap.title }} - - - ##### Department: {{ ap.department }} - ##### Affiliation: {{ ap.affiliation }} - - - - - - - Flow_0q56tn8 - Flow_10zn0h1 - - - - Flow_147b9li - Flow_0tfprc8 - Flow_0nz62mu - - - - dc_invalid_uid or pcs_invalid_uid or acs_invalid_uid or subs_invalid_uid or aps_invalid_uid - - - Select No if all displayed invalid Computing IDs do not need system access and/or receive emails. If they do, correct in Protocol Builder first and then select Yes. - - -{% if dc_invalid_uid %} -Department Chair - {{ dc.error }} -{% endif %} -{% if pcs_invalid_uid %} -Primary Coordinators -{% for k, pc in pcs.items() %} - {% if pc.get('uid', None) == None: %} - {{ pc.error }} - {% endif %} -{% endfor %} -{% endif %} -{% if acs_invalid_uid %} -Additional Coordinators -{% for k, ac in acs.items() %} - {% if ac.get('uid', None) == None: %} - {{ ac.error }} - {% endif %} -{% endfor %} -{% endif %} -{% if subs_invalid_uid %} -Sub-Investigators -{% for k, sub in subs.items() %} - {% if sub.get('uid', None) == None: %} - {{ sub.error }} - {% endif %} -{% endfor %} -{% endif %} -{% if aps_invalid_uid %} -Additional Personnnel -{% for k, ap in aps.items() %} - {% if ap.get('uid', None) == None: %} - {{ ap.error }} - {% endif %} -{% endfor %} -{% endif %} - - - - - - - - - - Flow_0nz62mu - Flow_16bkbuc - - - Flow_16bkbuc - Flow_0tsdclr - Flow_1mtwuyq - - - - not(FixInvalidUIDs) - - - ***Name & Degree:*** {{ RO_Chair_Name_Degree }} -***School:*** {{ RO_School }} -***Department:*** {{ RO_Department }} -***Title:*** {{ RO_Chair_Title }} -***Email:*** {{ RO_Chair_CID }} - - -{% if RO_Chair_CID != dc.uid %} - *Does not match the Department Chair specified in Protocol Builder, {{ dc.display_name }}* -{% endif %} - - - - - - - - - - Flow_0vi6thu - Flow_1ayisx2 - - - - Flow_07ur9cc - Flow_0shnt6k - user_data_set(pi_experience_key, pi.experience) - - - Flow_1mplloa - Flow_07ur9cc - Flow_1e0yt3v - - - pi.experience != user_data_get(pi_experience_key,"") - - - - - Flow_0vff9k5 - Flow_0w4d2bz - Flow_1oo0ijr - - - Flow_1mtwuyq - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/bpmn/data/invalid_process_sub.bpmn b/tests/SpiffWorkflow/bpmn/data/invalid_process_sub.bpmn deleted file mode 100644 index 2a8793e9..00000000 --- a/tests/SpiffWorkflow/bpmn/data/invalid_process_sub.bpmn +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Flow_0xpz6la - - - Flow_0xpz6la - Flow_03yam6h - print('complicated common task') - - - - Flow_03yam6h - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/bpmn/data/rrt.bpmn b/tests/SpiffWorkflow/bpmn/data/rrt.bpmn deleted file mode 100644 index e6d1afb2..00000000 --- a/tests/SpiffWorkflow/bpmn/data/rrt.bpmn +++ /dev/null @@ -1,336 +0,0 @@ - - - - - SequenceFlow_05ja25w - - - ### UNIVERSITY OF VIRGINIA RESEARCH -#### Research Ramp-up Plan - - -As we plan for the resumption of on-grounds research, PIs are required to develop a Research Ramp-up Plan. Please use the ramp-up guidance provided to lay out your plan(s) to manage operations while prioritizing physical distancing, staggered work shifts to reduce group size, remote work, and other exposure-reducing measures. - - -Plans must be submitted to the Office of Research by Monday, May ?? for consideration in the first round of approvals. Plans will then be reviewed on a rolling basis going forward. - - -Instructions for Submitting: - - -1. Add a Request for each lab space you manage in a building. If your lab spans multiple rooms or floors in a single building, one request will be required for that lab. If your lab spans multipe buildings, one request for each building will be required for that lab. The primary reason for this differentiation is that in addition to obtaining approval to restart operations, this information will also be used after start up to assist with any contact tracing that may be needed. - - -2. Select each Request added and step through each form presented, responding to all required and applicable fields. You may be presented with different questions if activities in each lab differ. - - -3. After all forms have been completed, you will be presented with the option to create your Research Recovery Plan in Word format. Download the document and review it. If you see any corrections that need to be made, return to the coresponding form and make the correction. - - -4. Once the generated Research Recovery Plan is finalize, use the web site to submit it to the Office of the Vice President for Research for review. - - -Please submit questions on the Research Support website. - SequenceFlow_05ja25w - SequenceFlow_0h50bp3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0h50bp3 - SequenceFlow_0bqu7pp - - - - - - ### {{ LabName }} -#### Lab details - - -Your response to these questions will determine if you do or do not provide additional information regarding each topic later. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0bqu7pp - Flow_0scfmzc - - - SequenceFlow_1qtrgbv - - - - Review plan, make changes if needed, continue of ready to submit. - Flow_1b6vbkk - Flow_1e2qi9s - - - - Flow_1e2qi9s - SequenceFlow_1qtrgbv - CompleteTemplate ResearchRecoveryPlan.docx RESEARCH_RECOVERY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Flow_0so3402 - SequenceFlow_1yi9lig - - - Flow_0scfmzc - Flow_0so3402 - Flow_0141rp3 - - - isAnimalUse == True - - - - - - - - - - - - - - Flow_1121pfu - SequenceFlow_1b4non2 - - - Flow_0141rp3 - SequenceFlow_1yi9lig - Flow_1121pfu - SequenceFlow_1wp5zmg - - - isGrantSupport == True - - - SequenceFlow_1b4non2 - SequenceFlow_1wp5zmg - Flow_1b6vbkk - - - - - isGrantSupport == False - - - - isAnimalUse == False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/bpmn/data/serialization/v1.0.json b/tests/SpiffWorkflow/bpmn/data/serialization/v1.0.json index f580929a..39307bd3 100644 --- a/tests/SpiffWorkflow/bpmn/data/serialization/v1.0.json +++ b/tests/SpiffWorkflow/bpmn/data/serialization/v1.0.json @@ -142,7 +142,7 @@ "typename":"SequenceFlow" } }, - "typename":"TestUserTask", + "typename":"UserTask", "extensions":{} }, "sid-C014B4B9-889F-4EE9-9949-C89502C35CF0":{ @@ -697,7 +697,7 @@ "typename":"SequenceFlow" } }, - "typename":"TestUserTask", + "typename":"UserTask", "extensions":{} }, "sid-2EDAD784-7F15-486C-B805-D26EE25F8087":{ @@ -906,7 +906,7 @@ "typename":"SequenceFlow" } }, - "typename":"TestUserTask", + "typename":"UserTask", "extensions":{} }, "sid-BC014079-199F-4720-95CD-244B0ACB6DE1":{ diff --git a/tests/SpiffWorkflow/bpmn/data/task_data_size.bpmn b/tests/SpiffWorkflow/bpmn/data/task_data_size.bpmn new file mode 100644 index 00000000..22a39425 --- /dev/null +++ b/tests/SpiffWorkflow/bpmn/data/task_data_size.bpmn @@ -0,0 +1,81 @@ + + + + + Flow_177wrsb + + + + + Flow_0hkxb5e + + + + Flow_177wrsb + Flow_0eductu + a="a"*512 + + + Flow_0eductu + Flow_1xryi5d + b="b"*512 + + + + Flow_1xryi5d + Flow_1of7r00 + c="c"*512 + + + + Flow_1of7r00 + Flow_0hkxb5e + d=a+b+c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/SpiffWorkflow/bpmn/data/timer_event_changes_last_task.bpmn b/tests/SpiffWorkflow/bpmn/data/timer_event_changes_last_task.bpmn deleted file mode 100644 index 8b6acb97..00000000 --- a/tests/SpiffWorkflow/bpmn/data/timer_event_changes_last_task.bpmn +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Flow_164sojd - - - Flow_1m2vq4v - Flow_04tuv5z - - - - Flow_0ac4lx5 - - timedelta(milliseconds=2) - - - - - Flow_0ac4lx5 - timer_called = True - - - Some docs - Flow_04tuv5z - - - - - Flow_164sojd - Flow_1m2vq4v - timer_called = False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py b/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py index 6e549784..29febd24 100644 --- a/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py +++ b/tests/SpiffWorkflow/bpmn/events/EventBasedGatewayTest.py @@ -2,6 +2,7 @@ from datetime import timedelta from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from SpiffWorkflow.bpmn.specs.events.event_definitions import MessageEventDefinition from SpiffWorkflow.task import TaskState @@ -11,7 +12,7 @@ class EventBsedGatewayTest(BpmnWorkflowTestCase): def setUp(self): self.spec, self.subprocesses = self.load_workflow_spec('event-gateway.bpmn', 'Process_0pvx19v') - self.script_engine = PythonScriptEngine(default_globals={"timedelta": timedelta}) + self.script_engine = PythonScriptEngine(environment=TaskDataEnvironment({"timedelta": timedelta})) self.workflow = BpmnWorkflow(self.spec, script_engine=self.script_engine) def testEventBasedGateway(self): @@ -29,8 +30,8 @@ class EventBsedGatewayTest(BpmnWorkflowTestCase): self.workflow.script_engine = self.script_engine self.assertEqual(len(waiting_tasks), 1) self.workflow.catch(MessageEventDefinition('message_1')) - self.workflow.refresh_waiting_tasks() self.workflow.do_engine_steps() + self.workflow.refresh_waiting_tasks() self.assertEqual(self.workflow.is_completed(), True) self.assertEqual(self.workflow.get_tasks_from_spec_name('message_1_event')[0].state, TaskState.COMPLETED) self.assertEqual(self.workflow.get_tasks_from_spec_name('message_2_event')[0].state, TaskState.CANCELLED) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py b/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py index bf89912c..58e100ea 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerCycleStartTest.py @@ -5,6 +5,7 @@ import unittest import time from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase @@ -24,11 +25,11 @@ class CustomScriptEngine(PythonScriptEngine): It will execute python code read in from the bpmn. It will also make any scripts in the scripts directory available for execution. """ def __init__(self): - augment_methods = { + environment = TaskDataEnvironment({ 'custom_function': my_custom_function, 'timedelta': datetime.timedelta, - } - super().__init__(scripting_additions=augment_methods) + }) + super().__init__(environment=environment) class TimerCycleStartTest(BpmnWorkflowTestCase): diff --git a/tests/SpiffWorkflow/bpmn/events/TimerCycleTest.py b/tests/SpiffWorkflow/bpmn/events/TimerCycleTest.py index 5c61f381..452e71ed 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerCycleTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerCycleTest.py @@ -5,6 +5,7 @@ import unittest import time from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from SpiffWorkflow.task import TaskState from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase @@ -22,11 +23,11 @@ class CustomScriptEngine(PythonScriptEngine): It will execute python code read in from the bpmn. It will also make any scripts in the scripts directory available for execution. """ def __init__(self): - augment_methods = { + environment = TaskDataEnvironment({ 'custom_function': my_custom_function, 'timedelta': datetime.timedelta, - } - super().__init__(scripting_additions=augment_methods) + }) + super().__init__(environment=environment) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py b/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py index deebd775..e56cc393 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerDateTest.py @@ -6,6 +6,7 @@ import time from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase __author__ = 'kellym' @@ -14,10 +15,10 @@ __author__ = 'kellym' class TimerDateTest(BpmnWorkflowTestCase): def setUp(self): - self.script_engine = PythonScriptEngine(default_globals={ + self.script_engine = PythonScriptEngine(environment=TaskDataEnvironment({ "datetime": datetime.datetime, "timedelta": datetime.timedelta, - }) + })) self.spec, self.subprocesses = self.load_workflow_spec('timer-date-start.bpmn', 'date_timer') self.workflow = BpmnWorkflow(self.spec, self.subprocesses, script_engine=self.script_engine) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py b/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py index aff5d429..1cd2c17b 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerDurationBoundaryOnTaskTest.py @@ -6,6 +6,7 @@ from datetime import timedelta from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase __author__ = 'kellym' @@ -13,7 +14,7 @@ __author__ = 'kellym' class TimerDurationTest(BpmnWorkflowTestCase): def setUp(self): - self.script_engine = PythonScriptEngine(default_globals={"timedelta": timedelta}) + self.script_engine = PythonScriptEngine(environment=TaskDataEnvironment({"timedelta": timedelta})) self.spec, self.subprocesses = self.load_workflow_spec('boundary_timer_on_task.bpmn', 'test_timer') self.workflow = BpmnWorkflow(self.spec, self.subprocesses, script_engine=self.script_engine) diff --git a/tests/SpiffWorkflow/bpmn/events/TimerDurationTest.py b/tests/SpiffWorkflow/bpmn/events/TimerDurationTest.py index c8e72fcd..18cbd12d 100644 --- a/tests/SpiffWorkflow/bpmn/events/TimerDurationTest.py +++ b/tests/SpiffWorkflow/bpmn/events/TimerDurationTest.py @@ -5,6 +5,7 @@ import time from datetime import datetime, timedelta from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase __author__ = 'kellym' @@ -13,7 +14,7 @@ __author__ = 'kellym' class TimerDurationTest(BpmnWorkflowTestCase): def setUp(self): - self.script_engine = PythonScriptEngine(default_globals={"timedelta": timedelta}) + self.script_engine = PythonScriptEngine(environment=TaskDataEnvironment({"timedelta": timedelta})) self.spec, self.subprocesses = self.load_workflow_spec('timer.bpmn', 'timer') self.workflow = BpmnWorkflow(self.spec, self.subprocesses, script_engine=self.script_engine) diff --git a/tests/SpiffWorkflow/bpmn/serializer/BaseTestCase.py b/tests/SpiffWorkflow/bpmn/serializer/BaseTestCase.py index e392e5db..5fa99e92 100644 --- a/tests/SpiffWorkflow/bpmn/serializer/BaseTestCase.py +++ b/tests/SpiffWorkflow/bpmn/serializer/BaseTestCase.py @@ -4,7 +4,6 @@ import os from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from SpiffWorkflow.bpmn.parser.BpmnParser import BpmnParser from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer -from tests.SpiffWorkflow.bpmn.BpmnLoaderForTests import TestUserTaskConverter class BaseTestCase(unittest.TestCase): @@ -21,7 +20,7 @@ class BaseTestCase(unittest.TestCase): def setUp(self): super(BaseTestCase, self).setUp() - wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter([TestUserTaskConverter]) + wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter() self.serializer = BpmnWorkflowSerializer(wf_spec_converter, version=self.SERIALIZER_VERSION) spec, subprocesses = self.load_workflow_spec('random_fact.bpmn', 'random_fact') self.workflow = BpmnWorkflow(spec, subprocesses) diff --git a/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py b/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py index ed547952..88612867 100644 --- a/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py +++ b/tests/SpiffWorkflow/bpmn/serializer/BpmnWorkflowSerializerTest.py @@ -5,7 +5,6 @@ import json from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer from SpiffWorkflow.bpmn.workflow import BpmnWorkflow -from tests.SpiffWorkflow.bpmn.BpmnLoaderForTests import TestUserTaskConverter from .BaseTestCase import BaseTestCase @@ -71,7 +70,7 @@ class BpmnWorkflowSerializerTest(BaseTestCase): try: self.assertRaises(TypeError, self.serializer.serialize_json, self.workflow) - wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter([TestUserTaskConverter]) + wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter() custom_serializer = BpmnWorkflowSerializer(wf_spec_converter, version=self.SERIALIZER_VERSION,json_encoder_cls=MyJsonEncoder, json_decoder_cls=MyJsonDecoder) serialized_workflow = custom_serializer.serialize_json(self.workflow) finally: diff --git a/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py b/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py index cd38b5f8..cae051ba 100644 --- a/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py +++ b/tests/SpiffWorkflow/bpmn/serializer/VersionMigrationTest.py @@ -3,9 +3,11 @@ import time from SpiffWorkflow.task import TaskState from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from .BaseTestCase import BaseTestCase + class VersionMigrationTest(BaseTestCase): SERIALIZER_VERSION = "1.2" @@ -24,7 +26,7 @@ class VersionMigrationTest(BaseTestCase): def test_convert_1_1_to_1_2(self): fn = os.path.join(self.DATA_DIR, 'serialization', 'v1-1.json') wf = self.serializer.deserialize_json(open(fn).read()) - wf.script_engine = PythonScriptEngine(default_globals={"time": time}) + wf.script_engine = PythonScriptEngine(environment=TaskDataEnvironment({"time": time})) wf.refresh_waiting_tasks() wf.do_engine_steps() - self.assertTrue(wf.is_completed()) \ No newline at end of file + self.assertTrue(wf.is_completed()) diff --git a/tests/SpiffWorkflow/camunda/BaseTestCase.py b/tests/SpiffWorkflow/camunda/BaseTestCase.py index 67d9c590..8cdde562 100644 --- a/tests/SpiffWorkflow/camunda/BaseTestCase.py +++ b/tests/SpiffWorkflow/camunda/BaseTestCase.py @@ -1,22 +1,20 @@ # -*- coding: utf-8 -*- import os +from copy import deepcopy from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer from SpiffWorkflow.camunda.parser.CamundaParser import CamundaParser -from SpiffWorkflow.camunda.serializer.task_spec_converters import UserTaskConverter, StartEventConverter, EndEventConverter, \ - IntermediateCatchEventConverter, IntermediateThrowEventConverter, BoundaryEventConverter +from SpiffWorkflow.camunda.serializer.config import CAMUNDA_SPEC_CONFIG -from SpiffWorkflow.dmn.serializer.task_spec_converters import BusinessRuleTaskConverter +from SpiffWorkflow.dmn.serializer.task_spec import BusinessRuleTaskConverter from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase +CAMUNDA_SPEC_CONFIG['task_specs'].append(BusinessRuleTaskConverter) __author__ = 'danfunk' -wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter([ - UserTaskConverter, BusinessRuleTaskConverter, StartEventConverter, - EndEventConverter, BoundaryEventConverter, IntermediateCatchEventConverter, - IntermediateThrowEventConverter]) +wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter(CAMUNDA_SPEC_CONFIG) class BaseTestCase(BpmnWorkflowTestCase): """ Provides some basic tools for loading up and parsing camunda BPMN files """ diff --git a/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py b/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py index 400f6011..a7d9d6c5 100644 --- a/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py +++ b/tests/SpiffWorkflow/camunda/CallActivityMessageTest.py @@ -16,7 +16,7 @@ class CallActivityMessageTest(BaseTestCase): def testRunThroughHappy(self): self.actual_test(save_restore=False) - def testThroughSaveRestore(self): + def testRunThroughSaveRestore(self): self.actual_test(save_restore=True) def actual_test(self, save_restore=False): diff --git a/tests/SpiffWorkflow/camunda/DMNCustomScriptTest.py b/tests/SpiffWorkflow/camunda/DMNCustomScriptTest.py index cde4662c..23d25634 100644 --- a/tests/SpiffWorkflow/camunda/DMNCustomScriptTest.py +++ b/tests/SpiffWorkflow/camunda/DMNCustomScriptTest.py @@ -1,5 +1,6 @@ import unittest from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from .BaseTestCase import BaseTestCase @@ -12,8 +13,8 @@ def my_custom_function(txt): class CustomScriptEngine(PythonScriptEngine): def __init__(self): - augment_methods = {'my_custom_function': my_custom_function} - super().__init__(scripting_additions=augment_methods) + environment = TaskDataEnvironment({'my_custom_function': my_custom_function}) + super().__init__(environment=environment) class DMNCustomScriptTest(BaseTestCase): diff --git a/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py b/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py index ce830b3a..8c0bf3c9 100644 --- a/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py +++ b/tests/SpiffWorkflow/camunda/MessageBoundaryEventTest.py @@ -7,6 +7,7 @@ from datetime import timedelta from SpiffWorkflow.task import TaskState from SpiffWorkflow.bpmn.workflow import BpmnWorkflow from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from .BaseTestCase import BaseTestCase __author__ = 'kellym' @@ -15,7 +16,7 @@ __author__ = 'kellym' class MessageBoundaryTest(BaseTestCase): def setUp(self): - self.script_engine = PythonScriptEngine(default_globals={"timedelta": timedelta}) + self.script_engine = PythonScriptEngine(environment=TaskDataEnvironment({"timedelta": timedelta})) self.spec, self.subprocesses = self.load_workflow_spec('MessageBoundary.bpmn', 'Process_1kjyavs') self.workflow = BpmnWorkflow(self.spec, self.subprocesses, script_engine=self.script_engine) diff --git a/tests/SpiffWorkflow/camunda/MultiInstanceDMNTest.py b/tests/SpiffWorkflow/camunda/MultiInstanceDMNTest.py index c381d5b6..e31aa083 100644 --- a/tests/SpiffWorkflow/camunda/MultiInstanceDMNTest.py +++ b/tests/SpiffWorkflow/camunda/MultiInstanceDMNTest.py @@ -1,6 +1,8 @@ import unittest from SpiffWorkflow.bpmn.workflow import BpmnWorkflow +from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import BoxedTaskDataEnvironment from .BaseTestCase import BaseTestCase @@ -10,12 +12,13 @@ class MultiInstanceDMNTest(BaseTestCase): self.spec, subprocesses = self.load_workflow_spec( 'DMNMultiInstance.bpmn', 'Process_1', 'test_integer_decision_multi.dmn') self.workflow = BpmnWorkflow(self.spec) + self.script_engine = PythonScriptEngine(environment=BoxedTaskDataEnvironment()) + self.workflow.script_engine = self.script_engine def testConstructor(self): pass # this is accomplished through setup. def testDmnHappy(self): - self.workflow = BpmnWorkflow(self.spec) self.workflow.do_engine_steps() self.workflow.complete_next() self.workflow.do_engine_steps() @@ -25,16 +28,19 @@ class MultiInstanceDMNTest(BaseTestCase): def testDmnSaveRestore(self): - self.workflow = BpmnWorkflow(self.spec) self.save_restore() + self.workflow.script_engine = self.script_engine self.workflow.do_engine_steps() self.workflow.complete_next() self.save_restore() + self.workflow.script_engine = self.script_engine self.workflow.do_engine_steps() self.workflow.complete_next() self.save_restore() + self.workflow.script_engine = self.script_engine self.workflow.do_engine_steps() self.save_restore() + self.workflow.script_engine = self.script_engine self.assertEqual(self.workflow.data['stuff']['E']['y'], 'D') diff --git a/tests/SpiffWorkflow/camunda/data/exclusive_gateway_pmi.bpmn b/tests/SpiffWorkflow/camunda/data/exclusive_gateway_pmi.bpmn deleted file mode 100644 index 4acb9f8e..00000000 --- a/tests/SpiffWorkflow/camunda/data/exclusive_gateway_pmi.bpmn +++ /dev/null @@ -1,94 +0,0 @@ - - - - - Flow_1wis1un - - - - - - - - Flow_1wis1un - Flow_144jxvd - - - - Flow_144jxvd - Flow_1riszc2 - Flow_0xdvee4 - - - - morestuff == 'Yes' - - - Flow_13ncefd - Flow_0xdvee4 - - - - - - - - - Flow_1riszc2 - Flow_13ncefd - - 3 - - - - morestuff == 'No' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/camunda/data/random_fact.svg b/tests/SpiffWorkflow/camunda/data/random_fact.svg deleted file mode 100644 index 3078ea0e..00000000 --- a/tests/SpiffWorkflow/camunda/data/random_fact.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - -Set TypeDisplay FactUser sets the Fact.type to cat,norris, or buzzwordMakes an API call to get a factof the required type. \ No newline at end of file diff --git a/tests/SpiffWorkflow/camunda/data/top_workflow.bpmn b/tests/SpiffWorkflow/camunda/data/top_workflow.bpmn deleted file mode 100644 index c3657374..00000000 --- a/tests/SpiffWorkflow/camunda/data/top_workflow.bpmn +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Flow_1xegt6f - - - - - Flow_0qc6vpv - - - - - Flow_1xegt6f - Flow_11qyfqv - my_custom_function('test 1 from top workflow') - - - Flow_11qyfqv - Flow_0hntmrc - - - Flow_0hntmrc - Flow_0qc6vpv - my_custom_function('test 2 from top workflow') - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/SpiffWorkflow/camunda/specs/UserTaskSpecTest.py b/tests/SpiffWorkflow/camunda/specs/UserTaskSpecTest.py index 3de8fa2a..b24f1c37 100644 --- a/tests/SpiffWorkflow/camunda/specs/UserTaskSpecTest.py +++ b/tests/SpiffWorkflow/camunda/specs/UserTaskSpecTest.py @@ -1,7 +1,8 @@ import unittest from SpiffWorkflow.camunda.specs.UserTask import FormField, UserTask, Form, EnumFormField -from SpiffWorkflow.camunda.serializer.task_spec_converters import UserTaskConverter +from SpiffWorkflow.camunda.serializer.task_spec import UserTaskConverter +from SpiffWorkflow.bpmn.serializer.helpers.dictionary import DictionaryConverter from SpiffWorkflow.specs.WorkflowSpec import WorkflowSpec @@ -53,7 +54,7 @@ class UserTaskSpecTest(unittest.TestCase): self.form.add_field(field1) self.form.add_field(field2) - converter = UserTaskConverter() + converter = UserTaskConverter(DictionaryConverter()) dct = converter.to_dict(self.user_spec) self.assertEqual(dct['name'], 'userTask') self.assertEqual(dct['form'], { diff --git a/tests/SpiffWorkflow/dmn/DecisionRunner.py b/tests/SpiffWorkflow/dmn/DecisionRunner.py index 133f1292..efb9d89b 100644 --- a/tests/SpiffWorkflow/dmn/DecisionRunner.py +++ b/tests/SpiffWorkflow/dmn/DecisionRunner.py @@ -2,7 +2,7 @@ import os from lxml import etree -from SpiffWorkflow.bpmn.PythonScriptEngine import Box +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box from SpiffWorkflow.dmn.engine.DMNEngine import DMNEngine from SpiffWorkflow.dmn.parser.DMNParser import DMNParser, get_dmn_ns diff --git a/tests/SpiffWorkflow/dmn/HitPolicyTest.py b/tests/SpiffWorkflow/dmn/HitPolicyTest.py index 061ba660..898aeeb3 100644 --- a/tests/SpiffWorkflow/dmn/HitPolicyTest.py +++ b/tests/SpiffWorkflow/dmn/HitPolicyTest.py @@ -1,14 +1,11 @@ import os import unittest -from SpiffWorkflow.dmn.engine.DMNEngine import DMNEngine +from SpiffWorkflow.bpmn.serializer.helpers.dictionary import DictionaryConverter from SpiffWorkflow.dmn.parser.BpmnDmnParser import BpmnDmnParser -from SpiffWorkflow.dmn.serializer.task_spec_converters import \ - BusinessRuleTaskConverter +from SpiffWorkflow.dmn.serializer.task_spec import BusinessRuleTaskConverter from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase -from tests.SpiffWorkflow.dmn.DecisionRunner import DecisionRunner -from tests.SpiffWorkflow.dmn.python_engine.PythonDecisionRunner import \ - PythonDecisionRunner +from tests.SpiffWorkflow.dmn.python_engine.PythonDecisionRunner import PythonDecisionRunner class HitPolicyTest(BpmnWorkflowTestCase): @@ -38,8 +35,8 @@ class HitPolicyTest(BpmnWorkflowTestCase): runner = PythonDecisionRunner(file_name) decision_table = runner.decision_table self.assertEqual("COLLECT", decision_table.hit_policy) - dict = BusinessRuleTaskConverter().decision_table_to_dict(decision_table) - new_table = BusinessRuleTaskConverter().decision_table_from_dict(dict) + dict = BusinessRuleTaskConverter(DictionaryConverter()).decision_table_to_dict(decision_table) + new_table = BusinessRuleTaskConverter(DictionaryConverter()).decision_table_from_dict(dict) self.assertEqual("COLLECT", new_table.hit_policy) def suite(): diff --git a/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDecisionTest.py b/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDecisionTest.py index 1ab727f9..95c539c8 100644 --- a/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDecisionTest.py +++ b/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDecisionTest.py @@ -1,6 +1,6 @@ import unittest -from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box from .FeelDecisionRunner import FeelDecisionRunner @@ -19,7 +19,7 @@ class FeelDictDecisionTestClass(unittest.TestCase): "PEANUTS": {"delicious": True}, "SPAM": {"delicious": False} }} - PythonScriptEngine.convert_to_box(PythonScriptEngine(), data) + Box.convert_to_box(data) res = self.runner.decide(data) self.assertEqual(res.description, 'They are allergic to peanuts') diff --git a/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDotNotationDecisionTest.py b/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDotNotationDecisionTest.py index bf19b44e..6978fa9f 100644 --- a/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDotNotationDecisionTest.py +++ b/tests/SpiffWorkflow/dmn/feel_engine/FeelDictDotNotationDecisionTest.py @@ -1,6 +1,6 @@ import unittest -from SpiffWorkflow.bpmn.PythonScriptEngine import Box +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box from .FeelDecisionRunner import FeelDecisionRunner diff --git a/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionTest.py b/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionTest.py index 375b9fd1..a9e9e2d5 100644 --- a/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionTest.py +++ b/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionTest.py @@ -1,6 +1,6 @@ import unittest -from SpiffWorkflow.bpmn.PythonScriptEngine import Box +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box from .PythonDecisionRunner import PythonDecisionRunner diff --git a/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionWeirdCharactersTest.py b/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionWeirdCharactersTest.py index d81acb47..df569ccd 100644 --- a/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionWeirdCharactersTest.py +++ b/tests/SpiffWorkflow/dmn/python_engine/DictDotNotationDecisionWeirdCharactersTest.py @@ -1,6 +1,6 @@ import unittest -from SpiffWorkflow.bpmn.PythonScriptEngine import Box +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import Box from .PythonDecisionRunner import PythonDecisionRunner diff --git a/tests/SpiffWorkflow/dmn/python_engine/PythonDecisionRunner.py b/tests/SpiffWorkflow/dmn/python_engine/PythonDecisionRunner.py index c3ef77ce..e2e753c6 100644 --- a/tests/SpiffWorkflow/dmn/python_engine/PythonDecisionRunner.py +++ b/tests/SpiffWorkflow/dmn/python_engine/PythonDecisionRunner.py @@ -2,11 +2,12 @@ import datetime from decimal import Decimal from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine +from SpiffWorkflow.bpmn.PythonScriptEngineEnvironment import TaskDataEnvironment from ..DecisionRunner import DecisionRunner class PythonDecisionRunner(DecisionRunner): def __init__(self, filename): - scripting_additions={'Decimal': Decimal, 'datetime': datetime} - super().__init__(PythonScriptEngine(scripting_additions=scripting_additions), filename, 'python_engine') + environment = TaskDataEnvironment({'Decimal': Decimal, 'datetime': datetime}) + super().__init__(PythonScriptEngine(environment=environment), filename, 'python_engine') diff --git a/tests/SpiffWorkflow/spiff/BaseTestCase.py b/tests/SpiffWorkflow/spiff/BaseTestCase.py index b085d1f7..f1826a78 100644 --- a/tests/SpiffWorkflow/spiff/BaseTestCase.py +++ b/tests/SpiffWorkflow/spiff/BaseTestCase.py @@ -1,27 +1,17 @@ # -*- coding: utf-8 -*- import os +from copy import deepcopy from SpiffWorkflow.spiff.parser.process import SpiffBpmnParser, VALIDATOR -from SpiffWorkflow.spiff.serializer.task_spec_converters import NoneTaskConverter, \ - ManualTaskConverter, UserTaskConverter, ScriptTaskConverter, \ - SubWorkflowTaskConverter, TransactionSubprocessConverter, \ - CallActivityTaskConverter, \ - StartEventConverter, EndEventConverter, BoundaryEventConverter, \ - SendTaskConverter, ReceiveTaskConverter, \ - IntermediateCatchEventConverter, IntermediateThrowEventConverter, \ - ServiceTaskConverter -from SpiffWorkflow.dmn.serializer.task_spec_converters import BusinessRuleTaskConverter +from SpiffWorkflow.spiff.serializer.config import SPIFF_SPEC_CONFIG +from SpiffWorkflow.dmn.serializer.task_spec import BusinessRuleTaskConverter from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase -wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter([ - NoneTaskConverter, ManualTaskConverter, UserTaskConverter, ScriptTaskConverter, - SubWorkflowTaskConverter, TransactionSubprocessConverter, CallActivityTaskConverter, - StartEventConverter, EndEventConverter, BoundaryEventConverter, SendTaskConverter, ReceiveTaskConverter, - IntermediateCatchEventConverter, IntermediateThrowEventConverter, BusinessRuleTaskConverter, - ServiceTaskConverter -]) +SPIFF_SPEC_CONFIG['task_specs'].append(BusinessRuleTaskConverter) + +wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter(SPIFF_SPEC_CONFIG) class BaseTestCase(BpmnWorkflowTestCase): """ Provides some basic tools for loading up and parsing Spiff extensions"""