openwferu 0.9.13 → 0.9.14
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/bigflow.rb +19 -0
- data/examples/csv_weather.rb +23 -0
- data/examples/engine_template.rb +7 -0
- data/lib/openwfe/contextual.rb +0 -2
- data/lib/openwfe/engine/engine.rb +137 -34
- data/lib/openwfe/engine/file_persisted_engine.rb +0 -5
- data/lib/openwfe/exceptions.rb +0 -2
- data/lib/openwfe/expool/errorjournal.rb +83 -7
- data/lib/openwfe/expool/expressionpool.rb +279 -60
- data/lib/openwfe/expool/expstorage.rb +7 -6
- data/lib/openwfe/expool/yamlexpstorage.rb +17 -14
- data/lib/openwfe/expressions/condition.rb +10 -7
- data/lib/openwfe/expressions/environment.rb +11 -1
- data/lib/openwfe/expressions/fe_command.rb +14 -1
- data/lib/openwfe/expressions/fe_cron.rb +29 -14
- data/lib/openwfe/expressions/fe_define.rb +26 -1
- data/lib/openwfe/expressions/fe_iterator.rb +2 -0
- data/lib/openwfe/expressions/fe_losfor.rb +20 -15
- data/lib/openwfe/expressions/fe_misc.rb +0 -2
- data/lib/openwfe/expressions/fe_participant.rb +78 -24
- data/lib/openwfe/expressions/fe_reserve.rb +0 -2
- data/lib/openwfe/expressions/fe_sleep.rb +0 -4
- data/lib/openwfe/expressions/fe_subprocess.rb +34 -0
- data/lib/openwfe/expressions/fe_value.rb +46 -4
- data/lib/openwfe/expressions/fe_wait.rb +0 -2
- data/lib/openwfe/expressions/flowexpression.rb +39 -9
- data/lib/openwfe/expressions/raw.rb +73 -48
- data/lib/openwfe/expressions/raw_prog.rb +45 -15
- data/lib/openwfe/expressions/simplerep.rb +54 -7
- data/lib/openwfe/expressions/time.rb +5 -2
- data/lib/openwfe/expressions/timeout.rb +0 -2
- data/lib/openwfe/flowexpressionid.rb +26 -2
- data/lib/openwfe/participants/enoparticipants.rb +6 -1
- data/lib/openwfe/participants/participant.rb +0 -2
- data/lib/openwfe/participants/participantmap.rb +21 -7
- data/lib/openwfe/participants/participants.rb +29 -0
- data/lib/openwfe/rest/exception.rb +0 -2
- data/lib/openwfe/storage/yamlfilestorage.rb +4 -1
- data/lib/openwfe/util/dollar.rb +0 -2
- data/lib/openwfe/util/lru.rb +0 -2
- data/lib/openwfe/util/observable.rb +1 -1
- data/lib/openwfe/util/scheduler.rb +4 -4
- data/lib/openwfe/util/schedulers.rb +0 -2
- data/lib/openwfe/util/workqueue.rb +34 -91
- data/lib/openwfe/utils.rb +35 -28
- data/lib/openwfe/version.rb +1 -1
- data/lib/openwfe/workitem.rb +1 -1
- data/test/clone_test.rb +51 -0
- data/test/concurrence_test.rb +78 -0
- data/test/cron_test_2.rb +50 -0
- data/test/flowtestbase.rb +40 -12
- data/test/ft_21_cron.rb +32 -6
- data/test/ft_26_load.rb +8 -2
- data/test/ft_26c_load.rb +19 -0
- data/test/ft_27_getflowpos.rb +4 -4
- data/test/ft_2_concurrence.rb +14 -9
- data/test/ft_32_journal.rb +1 -1
- data/test/ft_32c_journal.rb +3 -2
- data/test/ft_32d_journal.rb +2 -1
- data/test/ft_34_cancelwfid.rb +7 -3
- data/test/ft_35_localdefs.rb +13 -0
- data/test/ft_38_tag.rb +8 -6
- data/test/ft_49_condition.rb +7 -1
- data/test/ft_55_ptimeout.rb +13 -14
- data/test/ft_57_a.rb +17 -0
- data/test/ft_58_ejournal.rb +3 -3
- data/test/ft_59_ps.rb +6 -6
- data/test/ft_60_ecancel.rb +3 -5
- data/test/ft_61_elsub.rb +2 -4
- data/test/ft_63_pause.rb +122 -0
- data/test/ft_64_alias.rb +102 -0
- data/test/ft_64_clone.rb +69 -0
- data/test/ft_65_stringlaunch.rb +61 -0
- data/test/ft_66_subforget.rb +70 -0
- data/test/ft_67_schedlaunch.rb +102 -0
- data/test/ft_68_ifparticipant.rb +70 -0
- data/test/ft_69_cancelmissing.rb +49 -0
- data/test/ft_6_lambda.rb +23 -3
- data/test/ft_70_lookupvar.rb +55 -0
- data/test/ft_7_lose.rb +1 -1
- data/test/ft_tests.rb +10 -1
- data/test/hparticipant_test.rb +6 -6
- data/test/param_test.rb +1 -1
- data/test/{rake_test.rb → rake_ltest.rb} +9 -2
- data/test/rake_qtest.rb +3 -1
- data/test/raw_prog_test.rb +11 -3
- data/test/restart_sleep_test.rb +44 -6
- data/test/ruby_procdef_test.rb +129 -0
- data/test/rutest_utils.rb +1 -0
- data/test/sec_test.rb +3 -3
- metadata +19 -4
data/test/ft_63_pause.rb
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'flowtestbase'
|
9
|
+
require 'openwfe/def'
|
10
|
+
require 'openwfe/worklist/storeparticipant'
|
11
|
+
|
12
|
+
include OpenWFE
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest63 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def setup
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def teardown
|
22
|
+
#end
|
23
|
+
|
24
|
+
|
25
|
+
#
|
26
|
+
# Test 0
|
27
|
+
#
|
28
|
+
|
29
|
+
class Test0 < ProcessDefinition
|
30
|
+
sequence do
|
31
|
+
participant :alpha
|
32
|
+
_print "done."
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
#def xxxx_0
|
37
|
+
def test_0
|
38
|
+
|
39
|
+
#log_level_to_debug
|
40
|
+
|
41
|
+
sa = @engine.register_participant :alpha, OpenWFE::HashParticipant
|
42
|
+
|
43
|
+
fei = @engine.launch Test0
|
44
|
+
|
45
|
+
sleep 0.200
|
46
|
+
|
47
|
+
assert_equal(
|
48
|
+
@engine.process_status(fei.wfid).expressions[0].fei.wfid,
|
49
|
+
fei.wfid)
|
50
|
+
#puts @engine.process_status(fei.wfid)
|
51
|
+
#puts @engine.list_process_status
|
52
|
+
|
53
|
+
assert ! @engine.process_status(fei.wfid).paused?
|
54
|
+
|
55
|
+
@engine.pause_process fei.workflow_instance_id
|
56
|
+
|
57
|
+
assert @engine.process_status(fei.wfid).paused?
|
58
|
+
|
59
|
+
hp = @engine.get_participant :alpha
|
60
|
+
wi = hp.first_workitem
|
61
|
+
hp.forward wi
|
62
|
+
|
63
|
+
sleep 0.200
|
64
|
+
|
65
|
+
assert_equal @engine.process_status(fei.wfid).errors.size, 1
|
66
|
+
assert_equal @tracer.to_s, ""
|
67
|
+
|
68
|
+
@engine.resume_process fei.workflow_instance_id
|
69
|
+
|
70
|
+
ps = @engine.process_status fei.wfid
|
71
|
+
#puts ps
|
72
|
+
assert_equal ps.errors.size, 0
|
73
|
+
assert ! ps.paused?
|
74
|
+
|
75
|
+
sleep 0.200
|
76
|
+
|
77
|
+
assert_nil @engine.process_status(fei.wfid)
|
78
|
+
assert_equal @tracer.to_s, "done."
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
#
|
83
|
+
# Test 1
|
84
|
+
#
|
85
|
+
|
86
|
+
class Test1 < ProcessDefinition
|
87
|
+
sequence do
|
88
|
+
participant :alpha
|
89
|
+
_print "done."
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
#def xxxx_1
|
94
|
+
def test_1
|
95
|
+
|
96
|
+
#log_level_to_debug
|
97
|
+
|
98
|
+
sa = @engine.register_participant :alpha, OpenWFE::NullParticipant
|
99
|
+
|
100
|
+
fei = @engine.launch Test1
|
101
|
+
|
102
|
+
sleep 0.200
|
103
|
+
|
104
|
+
assert ! @engine.process_status(fei.wfid).paused?
|
105
|
+
|
106
|
+
@engine.pause_process fei.wfid
|
107
|
+
|
108
|
+
sleep 0.200
|
109
|
+
|
110
|
+
assert @engine.process_status(fei.wfid).paused?
|
111
|
+
|
112
|
+
@engine.resume_process fei.wfid
|
113
|
+
|
114
|
+
assert ! @engine.process_status(fei.wfid).paused?
|
115
|
+
|
116
|
+
@engine.cancel_process fei.wfid
|
117
|
+
|
118
|
+
sleep 0.200
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
data/test/ft_64_alias.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'openwfe/def'
|
9
|
+
|
10
|
+
require 'flowtestbase'
|
11
|
+
|
12
|
+
|
13
|
+
class FlowTest64a < Test::Unit::TestCase
|
14
|
+
include FlowTestBase
|
15
|
+
|
16
|
+
#def teardown
|
17
|
+
#end
|
18
|
+
|
19
|
+
#def setup
|
20
|
+
#end
|
21
|
+
|
22
|
+
|
23
|
+
#
|
24
|
+
# TEST 0
|
25
|
+
|
26
|
+
class Test0 < ProcessDefinition
|
27
|
+
sequence do
|
28
|
+
participant :bravo
|
29
|
+
participant :abracadabra
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
#def xxxx_0
|
34
|
+
def test_0
|
35
|
+
|
36
|
+
@engine.register_participant "a.*" do |workitem|
|
37
|
+
@tracer << workitem.participant_name
|
38
|
+
@tracer << "\n"
|
39
|
+
end
|
40
|
+
|
41
|
+
@engine.register_participant :bravo, AliasParticipant.new("alpha")
|
42
|
+
|
43
|
+
dotest(Test0, "alpha\nabracadabra")
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
#
|
48
|
+
# TEST 1
|
49
|
+
|
50
|
+
class Test1 < ProcessDefinition
|
51
|
+
sequence do
|
52
|
+
set :v => "toto", :val => "elvis"
|
53
|
+
toto
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_1
|
58
|
+
|
59
|
+
#log_level_to_debug
|
60
|
+
|
61
|
+
@engine.register_participant "elvis" do
|
62
|
+
@tracer << "sivle"
|
63
|
+
end
|
64
|
+
|
65
|
+
dotest(Test1, "sivle")
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
#
|
70
|
+
# TEST 2
|
71
|
+
|
72
|
+
class Test2 < ProcessDefinition
|
73
|
+
|
74
|
+
#
|
75
|
+
# some aliases
|
76
|
+
|
77
|
+
set :v => "alice", :val => "elvis"
|
78
|
+
set :v => "bob", :val => "elvis"
|
79
|
+
|
80
|
+
#
|
81
|
+
# the body of the process
|
82
|
+
|
83
|
+
sequence do
|
84
|
+
alice
|
85
|
+
bob
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_2
|
90
|
+
|
91
|
+
#log_level_to_debug
|
92
|
+
|
93
|
+
@engine.register_participant "elvis" do |workitem|
|
94
|
+
@tracer << workitem.fei.expression_id
|
95
|
+
@tracer << "\n"
|
96
|
+
end
|
97
|
+
|
98
|
+
dotest(Test2, "0.2.0\n0.2.1")
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
data/test/ft_64_clone.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'openwfe/def'
|
9
|
+
|
10
|
+
require 'flowtestbase'
|
11
|
+
|
12
|
+
|
13
|
+
class FlowTest64 < Test::Unit::TestCase
|
14
|
+
include FlowTestBase
|
15
|
+
|
16
|
+
#def teardown
|
17
|
+
#end
|
18
|
+
|
19
|
+
#def setup
|
20
|
+
#end
|
21
|
+
|
22
|
+
|
23
|
+
#
|
24
|
+
# TEST 0
|
25
|
+
|
26
|
+
class Box
|
27
|
+
|
28
|
+
attr_reader :content
|
29
|
+
|
30
|
+
def initialize (content)
|
31
|
+
@content = content
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Test0 < ProcessDefinition
|
36
|
+
sequence do
|
37
|
+
participant :alpha
|
38
|
+
participant :bravo
|
39
|
+
_print "ok"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
#def xxxx_0
|
44
|
+
def test_0
|
45
|
+
|
46
|
+
box1 = nil
|
47
|
+
|
48
|
+
@engine.register_participant :alpha do |workitem|
|
49
|
+
# nothing
|
50
|
+
end
|
51
|
+
|
52
|
+
@engine.register_participant :bravo do |workitem|
|
53
|
+
|
54
|
+
box1 = OpenWFE::fulldup(workitem.box)
|
55
|
+
end
|
56
|
+
|
57
|
+
box0 = Box.new("books")
|
58
|
+
|
59
|
+
li = LaunchItem.new(Test0)
|
60
|
+
li.box = box0
|
61
|
+
|
62
|
+
dotest(li, "ok")
|
63
|
+
|
64
|
+
assert_equal box1.content, "books"
|
65
|
+
assert_not_equal box1.object_id, box0.object_id
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
|
8
|
+
require 'flowtestbase'
|
9
|
+
require 'openwfe/def'
|
10
|
+
|
11
|
+
include OpenWFE
|
12
|
+
|
13
|
+
|
14
|
+
class FlowTest65 < Test::Unit::TestCase
|
15
|
+
include FlowTestBase
|
16
|
+
|
17
|
+
#def setup
|
18
|
+
#end
|
19
|
+
|
20
|
+
#def teardown
|
21
|
+
#end
|
22
|
+
|
23
|
+
|
24
|
+
#
|
25
|
+
# Test 0
|
26
|
+
#
|
27
|
+
|
28
|
+
TEST0 = """
|
29
|
+
class Test0 < ProcessDefinition
|
30
|
+
_print 'ok.'
|
31
|
+
end
|
32
|
+
""".strip
|
33
|
+
|
34
|
+
#def xxxx_0
|
35
|
+
def test_0
|
36
|
+
@engine.launch(TEST0)
|
37
|
+
sleep 0.200
|
38
|
+
assert_equal @tracer.to_s, "ok."
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
#
|
43
|
+
# Test 1
|
44
|
+
#
|
45
|
+
|
46
|
+
TEST1 = """
|
47
|
+
<process-definition name='65_1' revision='0.1'>
|
48
|
+
<print>ok.</print>
|
49
|
+
</process-definition>
|
50
|
+
""".strip
|
51
|
+
|
52
|
+
#def xxxx_1
|
53
|
+
def test_1
|
54
|
+
|
55
|
+
@engine.launch(TEST1)
|
56
|
+
sleep 0.200
|
57
|
+
assert_equal @tracer.to_s, "ok."
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Mon Oct 9 22:19:44 JST 2006
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'openwfe/def'
|
11
|
+
|
12
|
+
require 'flowtestbase'
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest66 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def teardown
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def setup
|
22
|
+
#end
|
23
|
+
|
24
|
+
#
|
25
|
+
# TEST 0
|
26
|
+
|
27
|
+
class Test0 < ProcessDefinition
|
28
|
+
sequence do
|
29
|
+
subproc :forget => true
|
30
|
+
_print "main done."
|
31
|
+
end
|
32
|
+
process_definition :name => :subproc do
|
33
|
+
sequence do
|
34
|
+
_print "sub done."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_0
|
40
|
+
|
41
|
+
#log_level_to_debug
|
42
|
+
|
43
|
+
dotest(Test0, "main done.\nsub done.", 0.600)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
#
|
48
|
+
# TEST 1
|
49
|
+
|
50
|
+
class Test1 < ProcessDefinition
|
51
|
+
sequence do
|
52
|
+
subproc
|
53
|
+
_print "main done."
|
54
|
+
end
|
55
|
+
process_definition :name => :subproc do
|
56
|
+
sequence do
|
57
|
+
_print "sub done."
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_1
|
63
|
+
|
64
|
+
#log_level_to_debug
|
65
|
+
|
66
|
+
dotest(Test1, "sub done.\nmain done.")
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,102 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Tue Sep 11 08:48:18 JST 2007
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'openwfe/def'
|
11
|
+
|
12
|
+
require 'flowtestbase'
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest67 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def teardown
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def setup
|
22
|
+
#end
|
23
|
+
|
24
|
+
#
|
25
|
+
# TEST 0
|
26
|
+
|
27
|
+
class Test0 < ProcessDefinition
|
28
|
+
_print "hell0"
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_0
|
32
|
+
|
33
|
+
#log_level_to_debug
|
34
|
+
|
35
|
+
@engine.launch(Test0, :in => "2s")
|
36
|
+
|
37
|
+
sleep 0.200
|
38
|
+
|
39
|
+
assert_equal @tracer.to_s, ""
|
40
|
+
|
41
|
+
sleep 2.500
|
42
|
+
|
43
|
+
assert_equal @tracer.to_s, "hell0"
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# TEST 1
|
48
|
+
|
49
|
+
#def xxxx_1
|
50
|
+
def test_1
|
51
|
+
|
52
|
+
#log_level_to_debug
|
53
|
+
|
54
|
+
t = Time.now
|
55
|
+
|
56
|
+
@engine.launch(Test0, :at => (t + 2).to_s)
|
57
|
+
|
58
|
+
sleep 0.200
|
59
|
+
|
60
|
+
assert_equal @tracer.to_s, ""
|
61
|
+
|
62
|
+
sleep 2.500
|
63
|
+
|
64
|
+
assert_equal @tracer.to_s, "hell0"
|
65
|
+
end
|
66
|
+
|
67
|
+
#
|
68
|
+
# TEST 2
|
69
|
+
|
70
|
+
#def xxxx_2
|
71
|
+
def test_2
|
72
|
+
|
73
|
+
log_level_to_debug
|
74
|
+
|
75
|
+
@engine.launch(Test0, :cron => "* * * * *")
|
76
|
+
|
77
|
+
assert_equal @tracer.to_s, ""
|
78
|
+
|
79
|
+
sleep 130
|
80
|
+
|
81
|
+
assert_equal @tracer.to_s, "hell0\nhell0"
|
82
|
+
end
|
83
|
+
|
84
|
+
#
|
85
|
+
# TEST 3
|
86
|
+
|
87
|
+
#def xxxx_3
|
88
|
+
def test_3
|
89
|
+
|
90
|
+
log_level_to_debug
|
91
|
+
|
92
|
+
@engine.launch(Test0, :every => "2s")
|
93
|
+
|
94
|
+
assert_equal @tracer.to_s, ""
|
95
|
+
|
96
|
+
sleep 5
|
97
|
+
|
98
|
+
assert_equal @tracer.to_s, "hell0\nhell0"
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Tue Sep 11 21:32:10 JST 2007
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'openwfe/def'
|
11
|
+
|
12
|
+
require 'flowtestbase'
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest68 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def teardown
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def setup
|
22
|
+
#end
|
23
|
+
|
24
|
+
#
|
25
|
+
# TEST 0
|
26
|
+
|
27
|
+
class Test0 < ProcessDefinition
|
28
|
+
sequence do
|
29
|
+
alpha :id => 0
|
30
|
+
alpha :id => 1, :if => "${r:$count > 1}"
|
31
|
+
alpha :id => 2
|
32
|
+
alpha :id => 3, :if => "${r:$count > 1}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_0
|
37
|
+
|
38
|
+
#log_level_to_debug
|
39
|
+
|
40
|
+
$count = 0
|
41
|
+
|
42
|
+
@engine.register_participant :alpha do |workitem|
|
43
|
+
@tracer << "#{workitem.params["id"]} #{$count}\n"
|
44
|
+
$count += 1
|
45
|
+
end
|
46
|
+
|
47
|
+
dotest(Test0, "0 0\n2 1\n3 2")
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# TEST 1
|
52
|
+
|
53
|
+
class Test1 < ProcessDefinition
|
54
|
+
sequence do
|
55
|
+
subp :id => 0
|
56
|
+
subp :id => 1, :unless => "true"
|
57
|
+
subp :id => 2
|
58
|
+
end
|
59
|
+
process_definition :name => "subp" do
|
60
|
+
_print "${id}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_0
|
65
|
+
|
66
|
+
dotest(Test1, "0\n2")
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Thu Sep 13 09:50:29 JST 2007
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'openwfe/def'
|
11
|
+
|
12
|
+
require 'flowtestbase'
|
13
|
+
|
14
|
+
|
15
|
+
class FlowTest69 < Test::Unit::TestCase
|
16
|
+
include FlowTestBase
|
17
|
+
|
18
|
+
#def teardown
|
19
|
+
#end
|
20
|
+
|
21
|
+
#def setup
|
22
|
+
#end
|
23
|
+
|
24
|
+
#
|
25
|
+
# TEST 0
|
26
|
+
|
27
|
+
class Test0 < ProcessDefinition
|
28
|
+
#__bravo
|
29
|
+
participant :ref => "__bravo"
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_0
|
33
|
+
|
34
|
+
#log_level_to_debug
|
35
|
+
|
36
|
+
fei = @engine.launch(Test0)
|
37
|
+
|
38
|
+
sleep 0.200
|
39
|
+
|
40
|
+
assert @engine.process_status(fei.wfid).errors.size > 0
|
41
|
+
|
42
|
+
@engine.cancel_process fei
|
43
|
+
|
44
|
+
assert_nil @engine.process_status(fei.wfid)
|
45
|
+
assert_equal @engine.list_process_status, {}
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
data/test/ft_6_lambda.rb
CHANGED
@@ -21,8 +21,8 @@ class FlowTest6 < Test::Unit::TestCase
|
|
21
21
|
#end
|
22
22
|
|
23
23
|
def test_lambda_0
|
24
|
-
|
25
|
-
dotest(
|
24
|
+
|
25
|
+
dotest(
|
26
26
|
'''<process-definition name="lambda_0" revision="0">
|
27
27
|
<sequence>
|
28
28
|
<set variable="inside1">
|
@@ -35,7 +35,27 @@ class FlowTest6 < Test::Unit::TestCase
|
|
35
35
|
<print>over</print>
|
36
36
|
</sequence>
|
37
37
|
</process-definition>''', """bonjour world
|
38
|
-
over"""
|
38
|
+
over""")
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# TEST 1
|
43
|
+
|
44
|
+
class Test1 < OpenWFE::ProcessDefinition
|
45
|
+
sequence do
|
46
|
+
_set :v => "inside1" do
|
47
|
+
process_definition do
|
48
|
+
_print "hello ${name}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
inside1 :name => "mundo"
|
52
|
+
_print "done."
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_1
|
57
|
+
|
58
|
+
dotest(Test1, "hello mundo\ndone.")
|
39
59
|
end
|
40
60
|
|
41
61
|
end
|