def test_loop_execution_no_wait(self): adhesive.process.process = read_bpmn_file( "test/adhesive/xml/loop.bpmn") process_executor = ProcessExecutor(adhesive.process, wait_tasks=False) data = process_executor.execute() assert_equal_execution( { "Build Germanium Image on mac": 1, "Build Germanium Image on windows": 1, "Build Germanium Image on linux": 1, "Test Browser ie on linux": 1, "Cleanup Platform linux": 3, "Cleanup Platform windows": 3, "Cleanup Platform mac": 3, "Test Browser chrome on linux": 1, "Test Browser edge on linux": 1, "Test Browser edge on windows": 1, "Test Browser chrome on windows": 1, "Test Browser ie on windows": 1, "Test Browser chrome on mac": 1, "Test Browser edge on mac": 1, "Test Browser ie on mac": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_link_back_execution(self): adhesive.process.process = read_bpmn_file("test/adhesive/xml/link-back.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "Increment X by 1": 5, "Build Germanium Image": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_link_back_execution(self): adhesive.process.process = read_bpmn_file( "test/adhesive/xml/user-task-join.bpmn" ) process_executor = ProcessExecutor( adhesive.process, ut_provider=TestUserTaskProvider() ) data = process_executor.execute() self.assertEqual("OK", data.OK) self.assertEqual("Cancel", data.Cancel) self.assertEqual("branch", data.branch) self.assertEqual("12.0", data.version) self.assertFalse(process_executor.events)
def test_basic_execution(self): """ Load a simple process and execute it. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/adhesive-basic.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "Build Germanium Image": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_parallel_gateway_non_wait(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/gateway-parallel.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "Test Chrome": 3, "Build Germanium Image": 3, }, data.executions, ) self.assertFalse(process_executor.events)
def test_error_propagates_up(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/error-event-subprocess-propagates-up.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "Error Was Caught": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_log_redirection(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/redirect-logs.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "sh: echo hello world && echo bad world >&2 && echo good world": 1, "Store current execution id": 1, }, data.executions, ) self.assertFalse(process_executor.events) adhesive_temp_folder = config.current.temp_folder path_to_glob = os.path.join(adhesive_temp_folder, data.execution_id, "logs", "_4", "*", "stdout") log_path = glob.glob(path_to_glob) if not log_path: raise Exception( f"Unable to match any file for glob {path_to_glob}") with open(log_path[0], "rt") as f: self.assertEqual( f.read(), "sh: echo hello world && " "echo bad world >&2 && " "echo good world\nhello world\ngood world\n", ) log_path = glob.glob( os.path.join(adhesive_temp_folder, data.execution_id, "logs", "_4", "*", "stderr")) with open(log_path[0], "rt") as f: self.assertEqual(f.read(), "bad world\n")
def test_script_task_execution(self): adhesive.process.process = read_bpmn_file( "test/adhesive/xml/script.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "Script Task": 1, "Build Germanium Image": 1, }, data.executions, ) self.assertFalse( process_executor.events, "Some events were not unregistered and/or executed.", )
def test_exclusive_gateway_non_wait(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/gateway-exclusive-sign.bpmn") process_executor = ProcessExecutor(adhesive.process, wait_tasks=False) data = process_executor.execute() assert_equal_execution( { "Test Chrome": 1, "Test Firefox": 1, "Build Germanium Image": 2, }, data.executions, ) self.assertFalse(process_executor.events)
def test_simple_execution_non_wait(self): """ Load a simple process and execute it. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/adhesive.bpmn") process_executor = ProcessExecutor(adhesive.process, wait_tasks=False) data = process_executor.execute() assert_equal_execution( { "Ensure Docker Tooling": 1, "Build Germanium Image": 1, "Test Chrome": 1, "Test Firefox": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_error_interrupting(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/error-event-interrupting.bpmn" ) process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() print(data._error) assert_equal_execution( { "Cleanup Broken Tasks": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_exclusive_gateway_non_wait(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/gateway-complex.bpmn") process_executor = ProcessExecutor(adhesive.process, wait_tasks=False) data = process_executor.execute() assert_equal_execution( { "Test Firefox": 1, "Test Chrome": 1, "Test Browser chrome on linux": 2, "Test Browser firefox on linux": 2, }, data.executions, ) self.assertFalse(process_executor.events)
def test_inclusive_gateway(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/gateway-inclusive.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "Test Chrome": 1, "Test Firefox": 1, "Build Germanium Image": 1, "Cleanup Broken Tasks": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_sub_process_execution(self): """ Load a process that contains a sub process and execute it. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/adhesive_subprocess.bpmn") process_executor = ProcessExecutor(adhesive.process) data = process_executor.execute() assert_equal_execution( { "Ensure Docker Tooling": 1, "Build Germanium Image": 1, "Prepare Firefox": 1, "Test Firefox": 1, "Test Chrome": 1, }, data.executions, ) self.assertFalse(process_executor.events)
def test_lane_non_wait(self): """ Load a process with a gateway and test it.. """ adhesive.process.process = read_bpmn_file( "test/adhesive/xml/lane.bpmn") process_executor = ProcessExecutor(adhesive.process, wait_tasks=False) data = process_executor.execute() assert_equal_execution( { "Prepare Firefox": 1, "Test Chrome": 1, "Test Firefox": 2, "Ensure Docker Tooling": 1, "Build Germanium Image": 4, }, data.executions, ) self.assertFalse(process_executor.events)