2022-10-12 10:19:53 -04:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
|
|
|
2022-11-04 09:33:42 -04:00
|
|
|
from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer
|
2022-10-12 10:19:53 -04:00
|
|
|
from SpiffWorkflow.camunda.parser.CamundaParser import CamundaParser
|
2022-11-04 09:33:42 -04:00
|
|
|
from SpiffWorkflow.camunda.serializer.task_spec_converters import UserTaskConverter, StartEventConverter, EndEventConverter, \
|
2022-10-12 10:19:53 -04:00
|
|
|
IntermediateCatchEventConverter, IntermediateThrowEventConverter, BoundaryEventConverter
|
|
|
|
|
2022-11-04 09:33:42 -04:00
|
|
|
from SpiffWorkflow.dmn.serializer.task_spec_converters import BusinessRuleTaskConverter
|
2022-10-12 10:19:53 -04:00
|
|
|
|
|
|
|
from tests.SpiffWorkflow.bpmn.BpmnWorkflowTestCase import BpmnWorkflowTestCase
|
|
|
|
|
|
|
|
|
|
|
|
__author__ = 'danfunk'
|
|
|
|
|
|
|
|
wf_spec_converter = BpmnWorkflowSerializer.configure_workflow_spec_converter([
|
|
|
|
UserTaskConverter, BusinessRuleTaskConverter, StartEventConverter,
|
|
|
|
EndEventConverter, BoundaryEventConverter, IntermediateCatchEventConverter,
|
|
|
|
IntermediateThrowEventConverter])
|
|
|
|
|
|
|
|
class BaseTestCase(BpmnWorkflowTestCase):
|
|
|
|
""" Provides some basic tools for loading up and parsing camunda BPMN files """
|
|
|
|
|
|
|
|
serializer = BpmnWorkflowSerializer(wf_spec_converter)
|
|
|
|
|
2022-11-18 10:03:32 -05:00
|
|
|
def get_parser(self, filename, dmn_filename=None):
|
|
|
|
f = os.path.join(os.path.dirname(__file__), 'data', filename)
|
2022-10-12 10:19:53 -04:00
|
|
|
parser = CamundaParser()
|
2022-11-18 10:03:32 -05:00
|
|
|
parser.add_bpmn_files_by_glob(f)
|
2022-10-12 10:19:53 -04:00
|
|
|
if dmn_filename is not None:
|
|
|
|
dmn = os.path.join(os.path.dirname(__file__), 'data', 'dmn', dmn_filename)
|
|
|
|
parser.add_dmn_files_by_glob(dmn)
|
2022-11-18 10:03:32 -05:00
|
|
|
return parser
|
|
|
|
|
|
|
|
def load_workflow_spec(self, filename, process_name, dmn_filename=None):
|
|
|
|
parser = self.get_parser(filename, dmn_filename)
|
2022-10-12 10:19:53 -04:00
|
|
|
top_level_spec = parser.get_spec(process_name)
|
|
|
|
subprocesses = parser.get_subprocess_specs(process_name)
|
|
|
|
return top_level_spec, subprocesses
|
|
|
|
|
|
|
|
def reload_save_restore(self):
|
|
|
|
self.save_restore()
|