Skip to content

Commit

Permalink
added test about processses when on_cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Nov 3, 2009
1 parent 92110bd commit 63b1e69
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TODO.txt
Expand Up @@ -258,3 +258,5 @@

[ ] run full tests at low load with --dm

[ ] port subprocess on_cancel test from ruote 0.9 http://groups.google.com/group/openwferu-users/t/75f02bdadf7b93eb

33 changes: 33 additions & 0 deletions test/functional/ft_1_process_status.rb
Expand Up @@ -362,5 +362,38 @@ def test_tree_rewrite
["sequence", {"name"=>"test"}, [["sequence", {}, [["alpha", {}, []], ["charly", {}, []], ["charly", {}, []]]], ["participant", {"ref"=>"delta"}, []]]],
tree1)
end

def test_when_on_cancel_subprocess

pdef = Ruote.process_definition :name => 'test' do
sequence :on_cancel => 'sub0' do
alpha
end
define 'sub0' do
alpha
end
end

alpha = @engine.register_participant :alpha, Ruote::HashParticipant

#noisy

wfid = @engine.launch(pdef)

wait_for(:alpha)

@engine.cancel_process(wfid)

wait_for(:alpha)

assert_match /#{wfid}_\d+/, alpha.first.fei.wfid

assert_equal(
["sequence", {"name"=>"test"}, [["define", {"sub0"=>nil}, [["alpha", {}, []]]], ["sequence", {"on_cancel"=>"sub0"}, [["alpha", {}, []]]]]],
@engine.process(wfid).original_tree)
assert_equal(
["sequence", {"name"=>"test"}, [["sequence", {"sub0"=>nil}, [["participant", {"ref"=>"alpha"}, []]]], ["subprocess", {"ref"=>"sub0"}, [["alpha", {}, []]]]]],
@engine.process(wfid).current_tree)
end
end

0 comments on commit 63b1e69

Please sign in to comment.