-
Notifications
You must be signed in to change notification settings - Fork 80
/
ft_7_tags.rb
87 lines (58 loc) · 1.67 KB
/
ft_7_tags.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# Testing Ruote (OpenWFEru)
#
# Wed Jun 10 11:03:26 JST 2009
#
require File.dirname(__FILE__) + '/base'
require 'ruote/part/hash_participant'
class FtTagsTest < Test::Unit::TestCase
include FunctionalBase
def test_tag
pdef = Ruote.process_definition do
sequence :tag => 'main' do
alpha :tag => 'part'
end
end
alpha = @engine.register_participant :alpha, Ruote::HashParticipant
#noisy
wfid = @engine.launch(pdef)
wait_for(:alpha)
ps = @engine.process_status(wfid)
#p ps.variables
#ps.expressions.each { |e| p [ e.fei, e.variables ] }
assert_equal '0_0', ps.variables['main'].expid
assert_equal '0_0_0', ps.variables['part'].expid
assert_equal 2, logger.log.select { |e| e[1] == :entered_tag }.size
alpha.reply(alpha.first)
wait_for(wfid)
assert_equal 2, logger.log.select { |e| e[1] == :left_tag }.size
end
# making sure a tag is removed in case of on_cancel
#
def test_on_cancel
pdef = Ruote.process_definition do
sequence do
sequence :tag => 'a', :on_cancel => 'decom' do
alpha
end
alpha
end
define 'decom' do
alpha
end
end
alpha = @engine.register_participant :alpha, Ruote::HashParticipant
#noisy
wfid = @engine.launch(pdef)
wait_for(:alpha)
assert_equal 1, @engine.process_status(wfid).tags.size
fei = alpha.first.fei.dup
fei.expid = '0_1_0'
@engine.cancel_expression(fei)
wait_for(:alpha)
assert_equal 0, @engine.process_status(wfid).tags.size
alpha.reply(alpha.first)
wait_for(:alpha)
assert_equal 0, @engine.process_status(wfid).tags.size
end
end