support dmn files in process model unit test w/ burnettk

This commit is contained in:
jasquat 2023-09-25 12:19:35 -04:00
parent f00a0fbbf2
commit 3e0c503119
1 changed files with 8 additions and 4 deletions

View File

@ -94,12 +94,10 @@ class ProcessModelTestRunnerMostlyPureSpiffDelegate(ProcessModelTestRunnerDelega
def instantiate_executer(self, bpmn_file: str) -> BpmnWorkflow:
parser = MyCustomParser()
bpmn_file_etree = self._get_etree_from_bpmn_file(bpmn_file)
parser.add_bpmn_xml(bpmn_file_etree, filename=os.path.basename(bpmn_file))
self._add_bpmn_file_to_parser(parser, bpmn_file)
all_related = self._find_related_bpmn_files(bpmn_file)
for related_file in all_related:
related_file_etree = self._get_etree_from_bpmn_file(related_file)
parser.add_bpmn_xml(related_file_etree, filename=os.path.basename(related_file))
self._add_bpmn_file_to_parser(parser, related_file)
sub_parsers = list(parser.process_parsers.values())
executable_process = None
for sub_parser in sub_parsers:
@ -131,6 +129,12 @@ class ProcessModelTestRunnerMostlyPureSpiffDelegate(ProcessModelTestRunnerDelega
return ready_tasks[0]
return None
def _add_bpmn_file_to_parser(self, parser: MyCustomParser, bpmn_file: str) -> None:
related_file_etree = self._get_etree_from_bpmn_file(bpmn_file)
parser.add_bpmn_xml(related_file_etree, filename=os.path.basename(bpmn_file))
dmn_file_glob = os.path.join(os.path.dirname(bpmn_file), "*.dmn")
parser.add_dmn_files_by_glob(dmn_file_glob)
def _get_etree_from_bpmn_file(self, bpmn_file: str) -> etree._Element:
data = None
with open(bpmn_file, "rb") as f_handle: