ruote 2.1.11 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +60 -0
- data/CREDITS.txt +22 -4
- data/LICENSE.txt +1 -1
- data/README.rdoc +6 -7
- data/Rakefile +58 -59
- data/TODO.txt +137 -65
- data/couch_url.txt +1 -0
- data/jruby_issue.txt +32 -0
- data/lib/ruote.rb +1 -1
- data/lib/ruote/context.rb +12 -10
- data/lib/ruote/engine.rb +280 -145
- data/lib/ruote/engine/process_error.rb +5 -5
- data/lib/ruote/engine/process_status.rb +47 -28
- data/lib/ruote/exp/command.rb +7 -10
- data/lib/ruote/exp/commanded.rb +2 -2
- data/lib/ruote/exp/condition.rb +130 -43
- data/lib/ruote/exp/fe_add_branches.rb +2 -2
- data/lib/ruote/exp/fe_apply.rb +1 -1
- data/lib/ruote/exp/fe_cancel_process.rb +3 -3
- data/lib/ruote/exp/fe_command.rb +3 -3
- data/lib/ruote/exp/fe_concurrence.rb +4 -4
- data/lib/ruote/exp/fe_concurrent_iterator.rb +17 -5
- data/lib/ruote/exp/fe_cron.rb +3 -3
- data/lib/ruote/exp/fe_cursor.rb +5 -5
- data/lib/ruote/exp/fe_define.rb +3 -3
- data/lib/ruote/exp/fe_echo.rb +3 -3
- data/lib/ruote/exp/fe_equals.rb +2 -2
- data/lib/ruote/exp/fe_error.rb +2 -2
- data/lib/ruote/exp/fe_filter.rb +519 -0
- data/lib/ruote/exp/fe_forget.rb +9 -2
- data/lib/ruote/exp/fe_given.rb +154 -0
- data/lib/ruote/exp/fe_if.rb +16 -13
- data/lib/ruote/exp/fe_inc.rb +3 -3
- data/lib/ruote/exp/fe_iterator.rb +4 -4
- data/lib/ruote/exp/fe_let.rb +75 -0
- data/lib/ruote/exp/fe_listen.rb +68 -12
- data/lib/ruote/exp/fe_lose.rb +110 -0
- data/lib/ruote/exp/fe_noop.rb +1 -1
- data/lib/ruote/exp/{fe_when.rb → fe_once.rb} +25 -21
- data/lib/ruote/exp/fe_participant.rb +14 -17
- data/lib/ruote/exp/fe_redo.rb +10 -6
- data/lib/ruote/exp/fe_ref.rb +1 -1
- data/lib/ruote/exp/fe_registerp.rb +112 -0
- data/lib/ruote/exp/fe_reserve.rb +3 -3
- data/lib/ruote/exp/fe_restore.rb +2 -2
- data/lib/ruote/exp/fe_save.rb +2 -2
- data/lib/ruote/exp/fe_sequence.rb +3 -4
- data/lib/ruote/exp/fe_set.rb +16 -7
- data/lib/ruote/exp/fe_subprocess.rb +23 -1
- data/lib/ruote/exp/fe_that.rb +92 -0
- data/lib/ruote/exp/fe_undo.rb +3 -3
- data/lib/ruote/exp/fe_unregisterp.rb +71 -0
- data/lib/ruote/exp/fe_wait.rb +2 -2
- data/lib/ruote/exp/flowexpression.rb +153 -78
- data/lib/ruote/exp/iterator.rb +2 -2
- data/lib/ruote/exp/merge.rb +2 -2
- data/lib/ruote/exp/ro_attributes.rb +14 -12
- data/lib/ruote/exp/ro_filters.rb +136 -0
- data/lib/ruote/exp/ro_persist.rb +51 -35
- data/lib/ruote/exp/ro_variables.rb +18 -27
- data/lib/ruote/fei.rb +73 -33
- data/lib/ruote/id/mnemo_wfid_generator.rb +1 -1
- data/lib/ruote/id/wfid_generator.rb +11 -4
- data/lib/ruote/log/default_history.rb +122 -0
- data/lib/ruote/log/pretty.rb +36 -8
- data/lib/ruote/log/storage_history.rb +37 -5
- data/lib/ruote/log/test_logger.rb +26 -24
- data/lib/ruote/log/wait_logger.rb +5 -3
- data/lib/ruote/part/block_participant.rb +22 -11
- data/lib/ruote/part/engine_participant.rb +6 -7
- data/lib/ruote/part/local_participant.rb +6 -12
- data/lib/ruote/part/no_op_participant.rb +4 -4
- data/lib/ruote/part/null_participant.rb +4 -4
- data/lib/ruote/part/smtp_participant.rb +4 -4
- data/lib/ruote/part/storage_participant.rb +40 -20
- data/lib/ruote/part/template.rb +4 -4
- data/lib/ruote/participant.rb +0 -1
- data/lib/ruote/{parser.rb → reader.rb} +30 -25
- data/lib/ruote/{parser → reader}/ruby_dsl.rb +28 -11
- data/lib/ruote/{parser → reader}/xml.rb +6 -5
- data/lib/ruote/receiver/base.rb +35 -13
- data/lib/ruote/storage/base.rb +20 -18
- data/lib/ruote/storage/composite_storage.rb +10 -10
- data/lib/ruote/storage/fs_storage.rb +17 -10
- data/lib/ruote/storage/hash_storage.rb +29 -18
- data/lib/ruote/svc/dispatch_pool.rb +41 -14
- data/lib/ruote/svc/dollar_sub.rb +50 -17
- data/lib/ruote/svc/error_handler.rb +19 -11
- data/lib/ruote/svc/expression_map.rb +4 -4
- data/lib/ruote/svc/participant_list.rb +105 -100
- data/lib/ruote/svc/tracker.rb +58 -18
- data/lib/ruote/svc/treechecker.rb +51 -24
- data/lib/ruote/tree_dot.rb +4 -4
- data/lib/ruote/util/filter.rb +440 -0
- data/lib/ruote/util/hashdot.rb +4 -4
- data/lib/ruote/util/look.rb +2 -6
- data/lib/ruote/util/lookup.rb +9 -7
- data/lib/ruote/util/misc.rb +40 -8
- data/lib/ruote/util/ometa.rb +1 -1
- data/lib/ruote/util/serializer.rb +4 -4
- data/lib/ruote/util/subprocess.rb +29 -9
- data/lib/ruote/util/time.rb +4 -4
- data/lib/ruote/util/tree.rb +3 -3
- data/lib/ruote/version.rb +2 -2
- data/lib/ruote/worker.rb +55 -32
- data/lib/ruote/workitem.rb +64 -11
- data/ruote.gemspec +31 -302
- data/test/bm/launch_bench.rb +37 -0
- data/test/functional/base.rb +60 -18
- data/test/functional/concurrent_base.rb +2 -2
- data/test/functional/ct_0_concurrence.rb +1 -1
- data/test/functional/ct_1_iterator.rb +1 -1
- data/test/functional/ct_2_cancel.rb +1 -1
- data/test/functional/eft_0_process_definition.rb +2 -2
- data/test/functional/eft_10_cancel_process.rb +1 -1
- data/test/functional/eft_11_wait.rb +19 -11
- data/test/functional/eft_12_listen.rb +79 -13
- data/test/functional/eft_13_iterator.rb +13 -10
- data/test/functional/eft_14_cursor.rb +98 -9
- data/test/functional/eft_15_loop.rb +6 -4
- data/test/functional/eft_16_if.rb +12 -0
- data/test/functional/eft_18_concurrent_iterator.rb +31 -32
- data/test/functional/eft_19_reserve.rb +4 -4
- data/test/functional/eft_1_echo.rb +9 -0
- data/test/functional/eft_20_save.rb +4 -4
- data/test/functional/{eft_28_when.rb → eft_28_once.rb} +33 -7
- data/test/functional/eft_30_ref.rb +17 -2
- data/test/functional/eft_31_registerp.rb +130 -0
- data/test/functional/eft_32_lose.rb +93 -0
- data/test/functional/eft_33_let.rb +31 -0
- data/test/functional/eft_34_given.rb +123 -0
- data/test/functional/eft_35_filter.rb +269 -0
- data/test/functional/eft_3_participant.rb +4 -6
- data/test/functional/eft_4_set.rb +16 -2
- data/test/functional/eft_5_subprocess.rb +2 -4
- data/test/functional/eft_6_concurrence.rb +29 -29
- data/test/functional/eft_8_undo.rb +39 -3
- data/test/functional/eft_9_redo.rb +94 -2
- data/test/functional/ft_10_dollar.rb +81 -2
- data/test/functional/ft_11_recursion.rb +13 -17
- data/test/functional/ft_12_launchitem.rb +9 -5
- data/test/functional/ft_13_variables.rb +7 -9
- data/test/functional/ft_14_re_apply.rb +6 -9
- data/test/functional/ft_15_timeout.rb +18 -18
- data/test/functional/ft_16_participant_params.rb +1 -3
- data/test/functional/ft_17_conditional.rb +25 -2
- data/test/functional/ft_18_kill.rb +65 -12
- data/test/functional/ft_1_process_status.rb +147 -71
- data/test/functional/ft_20_storage_participant.rb +0 -1
- data/test/functional/ft_21_forget.rb +82 -1
- data/test/functional/{ft_24_block_participants.rb → ft_24_block_participant.rb} +42 -11
- data/test/functional/ft_25_receiver.rb +47 -17
- data/test/functional/{ft_26_participant_timeout.rb → ft_26_participant_rtimeout.rb} +56 -19
- data/test/functional/ft_29_part_template.rb +6 -5
- data/test/functional/ft_2_errors.rb +21 -37
- data/test/functional/ft_30_smtp_participant.rb +1 -1
- data/test/functional/ft_31_part_blocking.rb +8 -6
- data/test/functional/ft_34_cursor_rewind.rb +13 -10
- data/test/functional/ft_35_add_service.rb +1 -1
- data/test/functional/ft_36_storage_history.rb +24 -1
- data/test/functional/ft_37_default_history.rb +109 -0
- data/test/functional/ft_38_participant_more.rb +10 -10
- data/test/functional/ft_39_wait_for.rb +12 -9
- data/test/functional/ft_3_participant_registration.rb +111 -32
- data/test/functional/ft_40_wait_logger.rb +2 -1
- data/test/functional/ft_41_participants.rb +30 -4
- data/test/functional/ft_43_participant_on_reply.rb +6 -23
- data/test/functional/ft_45_participant_accept.rb +4 -4
- data/test/functional/ft_46_launch_single.rb +36 -2
- data/test/functional/ft_47_wfid_generator.rb +54 -0
- data/test/functional/ft_48_lose.rb +112 -0
- data/test/functional/ft_49_engine_on_error.rb +201 -0
- data/test/functional/ft_4_cancel.rb +66 -6
- data/test/functional/ft_50_engine_config.rb +22 -0
- data/test/functional/ft_51_misc.rb +67 -0
- data/test/functional/ft_52_case.rb +134 -0
- data/test/functional/ft_53_engine_on_terminate.rb +95 -0
- data/test/functional/ft_54_patterns.rb +104 -0
- data/test/functional/{ft_37_engine_participant.rb → ft_55_engine_participant.rb} +4 -5
- data/test/functional/ft_56_filter_attribute.rb +259 -0
- data/test/functional/ft_5_on_error.rb +77 -30
- data/test/functional/ft_6_on_cancel.rb +66 -11
- data/test/functional/ft_7_tags.rb +94 -5
- data/test/functional/ft_8_participant_consumption.rb +36 -5
- data/test/functional/ft_9_subprocesses.rb +10 -10
- data/test/functional/rt_1_listen.rb +3 -3
- data/test/functional/{rt_3_when.rb → rt_3_once.rb} +4 -4
- data/test/functional/storage_helper.rb +15 -13
- data/test/functional/test.rb +1 -3
- data/test/test_helper.rb +0 -8
- data/test/unit/storage.rb +154 -10
- data/test/unit/{ut_0_ruby_parser.rb → ut_0_ruby_reader.rb} +61 -11
- data/test/unit/ut_11_lookup.rb +7 -0
- data/test/unit/ut_13_serializer.rb +1 -1
- data/test/unit/ut_15_util.rb +23 -0
- data/test/unit/{ut_16_parser.rb → ut_16_reader.rb} +11 -13
- data/test/unit/ut_1_fei.rb +57 -10
- data/test/unit/ut_20_composite_storage.rb +25 -11
- data/test/unit/ut_21_participant_list.rb +47 -0
- data/test/unit/ut_22_filter.rb +903 -0
- data/test/unit/ut_3_wait_logger.rb +2 -6
- data/test/unit/ut_6_condition.rb +164 -17
- data/test/unit/ut_7_workitem.rb +28 -0
- data/test/unit/ut_8_tree_to_dot.rb +1 -1
- data/test/unit/{ut_9_xml_parser.rb → ut_9_xml_reader.rb} +5 -5
- metadata +108 -84
- data/.gitignore +0 -4
- data/examples/barley.rb +0 -391
- data/examples/flickr_report.rb +0 -107
- data/examples/pong.rb +0 -37
- data/examples/ruote_quickstart.rb +0 -43
- data/examples/web_first_page.rb +0 -68
- data/lib/ruote/part/hash_participant.rb +0 -91
- data/test/README.rdoc +0 -15
- data/test/functional/crunner.sh +0 -19
- data/test/pdef.xml +0 -7
- data/test/unit/ut_2_wfidgen.rb +0 -21
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
require File.join(File.dirname(__FILE__), 'base')
|
9
9
|
|
10
|
-
require 'ruote/
|
10
|
+
require 'ruote/participant'
|
11
11
|
|
12
12
|
|
13
13
|
class FtOnCancelTest < Test::Unit::TestCase
|
@@ -21,7 +21,7 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
nemo = @engine.register_participant :nemo, Ruote::
|
24
|
+
nemo = @engine.register_participant :nemo, Ruote::StorageParticipant
|
25
25
|
|
26
26
|
@engine.register_participant :catcher do
|
27
27
|
@tracer << "caught\n"
|
@@ -46,7 +46,7 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
nemo = @engine.register_participant :nemo, Ruote::
|
49
|
+
nemo = @engine.register_participant :nemo, Ruote::StorageParticipant
|
50
50
|
|
51
51
|
#noisy
|
52
52
|
|
@@ -78,7 +78,7 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
alpha = @engine.register_participant :alpha, Ruote::
|
81
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
82
82
|
|
83
83
|
#noisy
|
84
84
|
|
@@ -108,8 +108,8 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
|
112
|
-
|
111
|
+
@engine.register_participant :alpha, Ruote::StorageParticipant
|
112
|
+
sto = @engine.register_participant :bravo, Ruote::StorageParticipant
|
113
113
|
|
114
114
|
#noisy
|
115
115
|
|
@@ -117,13 +117,15 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
117
117
|
|
118
118
|
wait_for(:alpha)
|
119
119
|
|
120
|
-
fei =
|
121
|
-
|
120
|
+
fei = @engine.process(wfid).expressions.find { |e|
|
121
|
+
e.fei.expid == '0_1'
|
122
|
+
}.fei
|
123
|
+
|
122
124
|
@engine.cancel_expression(fei)
|
123
125
|
|
124
126
|
wait_for(:bravo)
|
125
127
|
|
126
|
-
assert_equal 1,
|
128
|
+
assert_equal 1, sto.size
|
127
129
|
end
|
128
130
|
|
129
131
|
def test_on_cancel_subprocess
|
@@ -137,8 +139,8 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
137
139
|
end
|
138
140
|
end
|
139
141
|
|
140
|
-
|
141
|
-
|
142
|
+
@engine.register_participant :alpha, Ruote::StorageParticipant
|
143
|
+
@engine.register_participant :bravo, Ruote::StorageParticipant
|
142
144
|
|
143
145
|
#noisy
|
144
146
|
|
@@ -161,5 +163,58 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
161
163
|
["sequence", {"on_cancel"=>"sub0", "_triggered"=>"on_cancel"}, [["alpha", {}, []]]]]],
|
162
164
|
@engine.process(wfid).current_tree)
|
163
165
|
end
|
166
|
+
|
167
|
+
def test_on_cancel_participant_resume
|
168
|
+
|
169
|
+
pdef = Ruote.define do
|
170
|
+
sequence do
|
171
|
+
alpha :on_cancel => 'bail_out'
|
172
|
+
echo 'done.'
|
173
|
+
end
|
174
|
+
define 'bail_out' do
|
175
|
+
echo 'bailed'
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
@engine.register :alpha, Ruote::StorageParticipant
|
180
|
+
|
181
|
+
#noisy
|
182
|
+
|
183
|
+
wfid = @engine.launch(pdef)
|
184
|
+
|
185
|
+
@engine.wait_for(:alpha)
|
186
|
+
|
187
|
+
@engine.cancel(@engine.storage_participant.first)
|
188
|
+
|
189
|
+
@engine.wait_for(wfid)
|
190
|
+
|
191
|
+
assert_equal "bailed\ndone.", @tracer.to_s
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_on_cancel_wait_resume
|
195
|
+
|
196
|
+
pdef = Ruote.define do
|
197
|
+
sequence do
|
198
|
+
#alpha :on_cancel => 'bail_out'
|
199
|
+
wait '1d', :on_cancel => 'bail_out'
|
200
|
+
echo 'done.'
|
201
|
+
end
|
202
|
+
define 'bail_out' do
|
203
|
+
echo 'bailed'
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
#noisy
|
208
|
+
|
209
|
+
wfid = @engine.launch(pdef)
|
210
|
+
|
211
|
+
@engine.wait_for(6)
|
212
|
+
|
213
|
+
@engine.cancel(@engine.process(wfid).expressions.last)
|
214
|
+
|
215
|
+
@engine.wait_for(wfid)
|
216
|
+
|
217
|
+
assert_equal "bailed\ndone.", @tracer.to_s
|
218
|
+
end
|
164
219
|
end
|
165
220
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
require File.join(File.dirname(__FILE__), 'base')
|
9
9
|
|
10
|
-
require 'ruote/
|
10
|
+
require 'ruote/participant'
|
11
11
|
|
12
12
|
|
13
13
|
class FtTagsTest < Test::Unit::TestCase
|
@@ -21,7 +21,7 @@ class FtTagsTest < Test::Unit::TestCase
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
alpha = @engine.register_participant :alpha, Ruote::
|
24
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
25
25
|
|
26
26
|
#noisy
|
27
27
|
|
@@ -60,7 +60,7 @@ class FtTagsTest < Test::Unit::TestCase
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
alpha = @engine.register_participant :alpha, Ruote::
|
63
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
64
64
|
|
65
65
|
#noisy
|
66
66
|
|
@@ -70,8 +70,10 @@ class FtTagsTest < Test::Unit::TestCase
|
|
70
70
|
|
71
71
|
assert_equal 1, @engine.process(wfid).tags.size
|
72
72
|
|
73
|
-
fei =
|
74
|
-
|
73
|
+
fei = @engine.process(wfid).expressions.find { |e|
|
74
|
+
e.fei.expid == '0_1_0'
|
75
|
+
}.fei
|
76
|
+
|
75
77
|
@engine.cancel_expression(fei)
|
76
78
|
|
77
79
|
wait_for(:alpha)
|
@@ -84,5 +86,92 @@ class FtTagsTest < Test::Unit::TestCase
|
|
84
86
|
|
85
87
|
assert_equal 0, @engine.process(wfid).tags.size
|
86
88
|
end
|
89
|
+
|
90
|
+
def test_unset_tag_when_parent_gone
|
91
|
+
|
92
|
+
pdef = Ruote.process_definition do
|
93
|
+
concurrence :count => 1 do
|
94
|
+
alpha :tag => 'main'
|
95
|
+
sequence do
|
96
|
+
bravo
|
97
|
+
undo :ref => 'main'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
#@engine.noisy = true
|
103
|
+
|
104
|
+
@engine.register :alpha, Ruote::NullParticipant
|
105
|
+
@engine.register :bravo, Ruote::NoOpParticipant
|
106
|
+
|
107
|
+
wfid = @engine.launch(pdef)
|
108
|
+
|
109
|
+
@engine.wait_for(23)
|
110
|
+
|
111
|
+
assert_nil @engine.process(wfid)
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_tags_and_workitems
|
115
|
+
|
116
|
+
pdef = Ruote.define do
|
117
|
+
sequence :tag => 'first-stage' do
|
118
|
+
alpha
|
119
|
+
end
|
120
|
+
sequence :tag => 'second-stage' do
|
121
|
+
bravo
|
122
|
+
charly :tag => 'third-stage'
|
123
|
+
end
|
124
|
+
david
|
125
|
+
end
|
126
|
+
|
127
|
+
@engine.register { catchall }
|
128
|
+
|
129
|
+
wfid = @engine.launch(pdef)
|
130
|
+
@engine.wait_for(:alpha)
|
131
|
+
wi = @engine.storage_participant.first
|
132
|
+
|
133
|
+
assert_equal %w[ first-stage ], wi.tags
|
134
|
+
|
135
|
+
@engine.storage_participant.reply(wi)
|
136
|
+
@engine.wait_for(:bravo)
|
137
|
+
wi = @engine.storage_participant.first
|
138
|
+
|
139
|
+
assert_equal %w[ second-stage ], wi.tags
|
140
|
+
|
141
|
+
@engine.storage_participant.reply(wi)
|
142
|
+
@engine.wait_for(:charly)
|
143
|
+
wi = @engine.storage_participant.first
|
144
|
+
|
145
|
+
assert_equal %w[ second-stage third-stage ], wi.tags
|
146
|
+
|
147
|
+
@engine.storage_participant.reply(wi)
|
148
|
+
@engine.wait_for(:david)
|
149
|
+
wi = @engine.storage_participant.first
|
150
|
+
|
151
|
+
assert_equal [], wi.tags
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_tag_and_define
|
155
|
+
|
156
|
+
pdef = Ruote.define :tag => 'nada' do
|
157
|
+
alpha
|
158
|
+
end
|
159
|
+
|
160
|
+
@engine.register 'alpha', Ruote::StorageParticipant
|
161
|
+
|
162
|
+
#noisy
|
163
|
+
|
164
|
+
wfid = @engine.launch(pdef)
|
165
|
+
@engine.wait_for(:alpha)
|
166
|
+
|
167
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'entered_tag' }.size
|
168
|
+
|
169
|
+
wi = @engine.storage_participant.first
|
170
|
+
@engine.storage_participant.reply(wi)
|
171
|
+
|
172
|
+
@engine.wait_for(wfid)
|
173
|
+
|
174
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'left_tag' }.size
|
175
|
+
end
|
87
176
|
end
|
88
177
|
|
@@ -32,7 +32,7 @@ class FtParticipantConsumptionTest < Test::Unit::TestCase
|
|
32
32
|
# as well
|
33
33
|
|
34
34
|
assert_equal(
|
35
|
-
|
35
|
+
3, logger.log.select { |e| e['participant_name'] == 'alpha' }.size)
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_missing_participant_name
|
@@ -74,20 +74,51 @@ class FtParticipantConsumptionTest < Test::Unit::TestCase
|
|
74
74
|
|
75
75
|
def test_dispatch_time
|
76
76
|
|
77
|
-
wis = []
|
77
|
+
@engine.context.stash[:wis] = []
|
78
78
|
|
79
79
|
pdef = Ruote.process_definition { alpha; alpha }
|
80
80
|
|
81
81
|
@engine.register_participant 'alpha' do |workitem|
|
82
|
-
wis << workitem.to_h.dup
|
82
|
+
stash[:wis] << workitem.to_h.dup
|
83
83
|
end
|
84
84
|
|
85
85
|
assert_trace('', pdef)
|
86
86
|
|
87
87
|
assert_equal(
|
88
|
-
String,
|
88
|
+
String,
|
89
|
+
@engine.context.stash[:wis].first['fields']['dispatched_at'].class)
|
90
|
+
|
89
91
|
assert_not_equal(
|
90
|
-
wis.first['fields']['dispathed_at'],
|
92
|
+
@engine.context.stash[:wis].first['fields']['dispathed_at'],
|
93
|
+
@engine.context.stash[:wis].last['fields']['dispatched_at'])
|
94
|
+
end
|
95
|
+
|
96
|
+
class MyParticipant
|
97
|
+
include Ruote::LocalParticipant
|
98
|
+
|
99
|
+
def consume(workitem)
|
100
|
+
reply_to_engine(workitem)
|
101
|
+
end
|
102
|
+
|
103
|
+
def do_not_thread(workitem)
|
104
|
+
@context.tracer << workitem.fields['msg']
|
105
|
+
true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_do_not_thread_and_workitem
|
110
|
+
|
111
|
+
pdef = Ruote.define do
|
112
|
+
alpha
|
113
|
+
end
|
114
|
+
|
115
|
+
@engine.register_participant :alpha, MyParticipant
|
116
|
+
|
117
|
+
wfid = @engine.launch(pdef, 'msg' => 'kilroy')
|
118
|
+
|
119
|
+
@engine.wait_for(wfid)
|
120
|
+
|
121
|
+
assert_equal 'kilroy', @tracer.to_s
|
91
122
|
end
|
92
123
|
end
|
93
124
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
require File.join(File.dirname(__FILE__), 'base')
|
9
9
|
|
10
|
-
require 'ruote/
|
10
|
+
require 'ruote/participant'
|
11
11
|
|
12
12
|
|
13
13
|
class FtSubprocessesTest < Test::Unit::TestCase
|
@@ -26,7 +26,7 @@ class FtSubprocessesTest < Test::Unit::TestCase
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
bravo = @engine.register_participant :bravo, Ruote::
|
29
|
+
bravo = @engine.register_participant :bravo, Ruote::StorageParticipant
|
30
30
|
|
31
31
|
#noisy
|
32
32
|
|
@@ -55,7 +55,7 @@ class FtSubprocessesTest < Test::Unit::TestCase
|
|
55
55
|
assert_equal 2, logger.log.select { |e| e['action'] == 'launch' }.size
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
58
|
+
def test_subid
|
59
59
|
|
60
60
|
pdef = Ruote.process_definition do
|
61
61
|
sequence do
|
@@ -70,10 +70,10 @@ class FtSubprocessesTest < Test::Unit::TestCase
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
wfids = []
|
73
|
+
@engine.context.stash[:wfids] = []
|
74
74
|
|
75
75
|
@engine.register_participant :alpha do |workitem|
|
76
|
-
wfids << workitem.fei.
|
76
|
+
stash[:wfids] << workitem.fei.subid
|
77
77
|
end
|
78
78
|
|
79
79
|
#noisy
|
@@ -82,10 +82,10 @@ class FtSubprocessesTest < Test::Unit::TestCase
|
|
82
82
|
|
83
83
|
wait_for(:alpha)
|
84
84
|
wait_for(:alpha)
|
85
|
-
wait_for(
|
85
|
+
wait_for(6)
|
86
86
|
|
87
|
-
assert_equal 2, wfids.size
|
88
|
-
assert_equal 2, wfids.sort.uniq.size
|
87
|
+
assert_equal 2, @engine.context.stash[:wfids].size
|
88
|
+
assert_equal 2, @engine.context.stash[:wfids].sort.uniq.size
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_cancel_and_subprocess
|
@@ -99,7 +99,7 @@ class FtSubprocessesTest < Test::Unit::TestCase
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
alpha = @engine.register_participant :alpha, Ruote::
|
102
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
103
103
|
|
104
104
|
wfid = @engine.launch(pdef)
|
105
105
|
|
@@ -126,7 +126,7 @@ class FtSubprocessesTest < Test::Unit::TestCase
|
|
126
126
|
alpha
|
127
127
|
end
|
128
128
|
|
129
|
-
alpha = @engine.register_participant :alpha, Ruote::
|
129
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
130
130
|
|
131
131
|
#noisy
|
132
132
|
|
@@ -9,7 +9,7 @@ require File.join(File.dirname(__FILE__), 'base')
|
|
9
9
|
require File.join(File.dirname(__FILE__), 'restart_base')
|
10
10
|
|
11
11
|
|
12
|
-
require 'ruote/
|
12
|
+
require 'ruote/participant'
|
13
13
|
|
14
14
|
|
15
15
|
class RtListenTest < Test::Unit::TestCase
|
@@ -23,7 +23,7 @@ class RtListenTest < Test::Unit::TestCase
|
|
23
23
|
pdef = Ruote.process_definition do
|
24
24
|
concurrence do
|
25
25
|
sequence do
|
26
|
-
listen :to => '
|
26
|
+
listen :to => '/^al.*/', :upon => 'reply'
|
27
27
|
echo 'done.'
|
28
28
|
end
|
29
29
|
alpha
|
@@ -32,7 +32,7 @@ class RtListenTest < Test::Unit::TestCase
|
|
32
32
|
|
33
33
|
#puts; noisy
|
34
34
|
|
35
|
-
alpha = @engine.register_participant :alpha, Ruote::
|
35
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
36
36
|
|
37
37
|
wfid = @engine.launch(pdef)
|
38
38
|
|
@@ -13,26 +13,26 @@ class RtWhenTest < Test::Unit::TestCase
|
|
13
13
|
include FunctionalBase
|
14
14
|
include RestartBase
|
15
15
|
|
16
|
-
def
|
16
|
+
def test_once_and_restart
|
17
17
|
|
18
18
|
do_test('1s')
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def test_once_cron_and_restart
|
22
22
|
|
23
23
|
do_test('* * * * * *')
|
24
24
|
end
|
25
25
|
|
26
26
|
protected
|
27
27
|
|
28
|
-
def do_test
|
28
|
+
def do_test(freq)
|
29
29
|
|
30
30
|
start_new_engine
|
31
31
|
|
32
32
|
pdef = Ruote.process_definition :name => 'test' do
|
33
33
|
sequence do
|
34
34
|
echo 'in'
|
35
|
-
|
35
|
+
once '${v:resume}', :freq => freq
|
36
36
|
echo 'out.'
|
37
37
|
end
|
38
38
|
end
|