ruote 2.1.11 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. data/CHANGELOG.txt +60 -0
  2. data/CREDITS.txt +22 -4
  3. data/LICENSE.txt +1 -1
  4. data/README.rdoc +6 -7
  5. data/Rakefile +58 -59
  6. data/TODO.txt +137 -65
  7. data/couch_url.txt +1 -0
  8. data/jruby_issue.txt +32 -0
  9. data/lib/ruote.rb +1 -1
  10. data/lib/ruote/context.rb +12 -10
  11. data/lib/ruote/engine.rb +280 -145
  12. data/lib/ruote/engine/process_error.rb +5 -5
  13. data/lib/ruote/engine/process_status.rb +47 -28
  14. data/lib/ruote/exp/command.rb +7 -10
  15. data/lib/ruote/exp/commanded.rb +2 -2
  16. data/lib/ruote/exp/condition.rb +130 -43
  17. data/lib/ruote/exp/fe_add_branches.rb +2 -2
  18. data/lib/ruote/exp/fe_apply.rb +1 -1
  19. data/lib/ruote/exp/fe_cancel_process.rb +3 -3
  20. data/lib/ruote/exp/fe_command.rb +3 -3
  21. data/lib/ruote/exp/fe_concurrence.rb +4 -4
  22. data/lib/ruote/exp/fe_concurrent_iterator.rb +17 -5
  23. data/lib/ruote/exp/fe_cron.rb +3 -3
  24. data/lib/ruote/exp/fe_cursor.rb +5 -5
  25. data/lib/ruote/exp/fe_define.rb +3 -3
  26. data/lib/ruote/exp/fe_echo.rb +3 -3
  27. data/lib/ruote/exp/fe_equals.rb +2 -2
  28. data/lib/ruote/exp/fe_error.rb +2 -2
  29. data/lib/ruote/exp/fe_filter.rb +519 -0
  30. data/lib/ruote/exp/fe_forget.rb +9 -2
  31. data/lib/ruote/exp/fe_given.rb +154 -0
  32. data/lib/ruote/exp/fe_if.rb +16 -13
  33. data/lib/ruote/exp/fe_inc.rb +3 -3
  34. data/lib/ruote/exp/fe_iterator.rb +4 -4
  35. data/lib/ruote/exp/fe_let.rb +75 -0
  36. data/lib/ruote/exp/fe_listen.rb +68 -12
  37. data/lib/ruote/exp/fe_lose.rb +110 -0
  38. data/lib/ruote/exp/fe_noop.rb +1 -1
  39. data/lib/ruote/exp/{fe_when.rb → fe_once.rb} +25 -21
  40. data/lib/ruote/exp/fe_participant.rb +14 -17
  41. data/lib/ruote/exp/fe_redo.rb +10 -6
  42. data/lib/ruote/exp/fe_ref.rb +1 -1
  43. data/lib/ruote/exp/fe_registerp.rb +112 -0
  44. data/lib/ruote/exp/fe_reserve.rb +3 -3
  45. data/lib/ruote/exp/fe_restore.rb +2 -2
  46. data/lib/ruote/exp/fe_save.rb +2 -2
  47. data/lib/ruote/exp/fe_sequence.rb +3 -4
  48. data/lib/ruote/exp/fe_set.rb +16 -7
  49. data/lib/ruote/exp/fe_subprocess.rb +23 -1
  50. data/lib/ruote/exp/fe_that.rb +92 -0
  51. data/lib/ruote/exp/fe_undo.rb +3 -3
  52. data/lib/ruote/exp/fe_unregisterp.rb +71 -0
  53. data/lib/ruote/exp/fe_wait.rb +2 -2
  54. data/lib/ruote/exp/flowexpression.rb +153 -78
  55. data/lib/ruote/exp/iterator.rb +2 -2
  56. data/lib/ruote/exp/merge.rb +2 -2
  57. data/lib/ruote/exp/ro_attributes.rb +14 -12
  58. data/lib/ruote/exp/ro_filters.rb +136 -0
  59. data/lib/ruote/exp/ro_persist.rb +51 -35
  60. data/lib/ruote/exp/ro_variables.rb +18 -27
  61. data/lib/ruote/fei.rb +73 -33
  62. data/lib/ruote/id/mnemo_wfid_generator.rb +1 -1
  63. data/lib/ruote/id/wfid_generator.rb +11 -4
  64. data/lib/ruote/log/default_history.rb +122 -0
  65. data/lib/ruote/log/pretty.rb +36 -8
  66. data/lib/ruote/log/storage_history.rb +37 -5
  67. data/lib/ruote/log/test_logger.rb +26 -24
  68. data/lib/ruote/log/wait_logger.rb +5 -3
  69. data/lib/ruote/part/block_participant.rb +22 -11
  70. data/lib/ruote/part/engine_participant.rb +6 -7
  71. data/lib/ruote/part/local_participant.rb +6 -12
  72. data/lib/ruote/part/no_op_participant.rb +4 -4
  73. data/lib/ruote/part/null_participant.rb +4 -4
  74. data/lib/ruote/part/smtp_participant.rb +4 -4
  75. data/lib/ruote/part/storage_participant.rb +40 -20
  76. data/lib/ruote/part/template.rb +4 -4
  77. data/lib/ruote/participant.rb +0 -1
  78. data/lib/ruote/{parser.rb → reader.rb} +30 -25
  79. data/lib/ruote/{parser → reader}/ruby_dsl.rb +28 -11
  80. data/lib/ruote/{parser → reader}/xml.rb +6 -5
  81. data/lib/ruote/receiver/base.rb +35 -13
  82. data/lib/ruote/storage/base.rb +20 -18
  83. data/lib/ruote/storage/composite_storage.rb +10 -10
  84. data/lib/ruote/storage/fs_storage.rb +17 -10
  85. data/lib/ruote/storage/hash_storage.rb +29 -18
  86. data/lib/ruote/svc/dispatch_pool.rb +41 -14
  87. data/lib/ruote/svc/dollar_sub.rb +50 -17
  88. data/lib/ruote/svc/error_handler.rb +19 -11
  89. data/lib/ruote/svc/expression_map.rb +4 -4
  90. data/lib/ruote/svc/participant_list.rb +105 -100
  91. data/lib/ruote/svc/tracker.rb +58 -18
  92. data/lib/ruote/svc/treechecker.rb +51 -24
  93. data/lib/ruote/tree_dot.rb +4 -4
  94. data/lib/ruote/util/filter.rb +440 -0
  95. data/lib/ruote/util/hashdot.rb +4 -4
  96. data/lib/ruote/util/look.rb +2 -6
  97. data/lib/ruote/util/lookup.rb +9 -7
  98. data/lib/ruote/util/misc.rb +40 -8
  99. data/lib/ruote/util/ometa.rb +1 -1
  100. data/lib/ruote/util/serializer.rb +4 -4
  101. data/lib/ruote/util/subprocess.rb +29 -9
  102. data/lib/ruote/util/time.rb +4 -4
  103. data/lib/ruote/util/tree.rb +3 -3
  104. data/lib/ruote/version.rb +2 -2
  105. data/lib/ruote/worker.rb +55 -32
  106. data/lib/ruote/workitem.rb +64 -11
  107. data/ruote.gemspec +31 -302
  108. data/test/bm/launch_bench.rb +37 -0
  109. data/test/functional/base.rb +60 -18
  110. data/test/functional/concurrent_base.rb +2 -2
  111. data/test/functional/ct_0_concurrence.rb +1 -1
  112. data/test/functional/ct_1_iterator.rb +1 -1
  113. data/test/functional/ct_2_cancel.rb +1 -1
  114. data/test/functional/eft_0_process_definition.rb +2 -2
  115. data/test/functional/eft_10_cancel_process.rb +1 -1
  116. data/test/functional/eft_11_wait.rb +19 -11
  117. data/test/functional/eft_12_listen.rb +79 -13
  118. data/test/functional/eft_13_iterator.rb +13 -10
  119. data/test/functional/eft_14_cursor.rb +98 -9
  120. data/test/functional/eft_15_loop.rb +6 -4
  121. data/test/functional/eft_16_if.rb +12 -0
  122. data/test/functional/eft_18_concurrent_iterator.rb +31 -32
  123. data/test/functional/eft_19_reserve.rb +4 -4
  124. data/test/functional/eft_1_echo.rb +9 -0
  125. data/test/functional/eft_20_save.rb +4 -4
  126. data/test/functional/{eft_28_when.rb → eft_28_once.rb} +33 -7
  127. data/test/functional/eft_30_ref.rb +17 -2
  128. data/test/functional/eft_31_registerp.rb +130 -0
  129. data/test/functional/eft_32_lose.rb +93 -0
  130. data/test/functional/eft_33_let.rb +31 -0
  131. data/test/functional/eft_34_given.rb +123 -0
  132. data/test/functional/eft_35_filter.rb +269 -0
  133. data/test/functional/eft_3_participant.rb +4 -6
  134. data/test/functional/eft_4_set.rb +16 -2
  135. data/test/functional/eft_5_subprocess.rb +2 -4
  136. data/test/functional/eft_6_concurrence.rb +29 -29
  137. data/test/functional/eft_8_undo.rb +39 -3
  138. data/test/functional/eft_9_redo.rb +94 -2
  139. data/test/functional/ft_10_dollar.rb +81 -2
  140. data/test/functional/ft_11_recursion.rb +13 -17
  141. data/test/functional/ft_12_launchitem.rb +9 -5
  142. data/test/functional/ft_13_variables.rb +7 -9
  143. data/test/functional/ft_14_re_apply.rb +6 -9
  144. data/test/functional/ft_15_timeout.rb +18 -18
  145. data/test/functional/ft_16_participant_params.rb +1 -3
  146. data/test/functional/ft_17_conditional.rb +25 -2
  147. data/test/functional/ft_18_kill.rb +65 -12
  148. data/test/functional/ft_1_process_status.rb +147 -71
  149. data/test/functional/ft_20_storage_participant.rb +0 -1
  150. data/test/functional/ft_21_forget.rb +82 -1
  151. data/test/functional/{ft_24_block_participants.rb → ft_24_block_participant.rb} +42 -11
  152. data/test/functional/ft_25_receiver.rb +47 -17
  153. data/test/functional/{ft_26_participant_timeout.rb → ft_26_participant_rtimeout.rb} +56 -19
  154. data/test/functional/ft_29_part_template.rb +6 -5
  155. data/test/functional/ft_2_errors.rb +21 -37
  156. data/test/functional/ft_30_smtp_participant.rb +1 -1
  157. data/test/functional/ft_31_part_blocking.rb +8 -6
  158. data/test/functional/ft_34_cursor_rewind.rb +13 -10
  159. data/test/functional/ft_35_add_service.rb +1 -1
  160. data/test/functional/ft_36_storage_history.rb +24 -1
  161. data/test/functional/ft_37_default_history.rb +109 -0
  162. data/test/functional/ft_38_participant_more.rb +10 -10
  163. data/test/functional/ft_39_wait_for.rb +12 -9
  164. data/test/functional/ft_3_participant_registration.rb +111 -32
  165. data/test/functional/ft_40_wait_logger.rb +2 -1
  166. data/test/functional/ft_41_participants.rb +30 -4
  167. data/test/functional/ft_43_participant_on_reply.rb +6 -23
  168. data/test/functional/ft_45_participant_accept.rb +4 -4
  169. data/test/functional/ft_46_launch_single.rb +36 -2
  170. data/test/functional/ft_47_wfid_generator.rb +54 -0
  171. data/test/functional/ft_48_lose.rb +112 -0
  172. data/test/functional/ft_49_engine_on_error.rb +201 -0
  173. data/test/functional/ft_4_cancel.rb +66 -6
  174. data/test/functional/ft_50_engine_config.rb +22 -0
  175. data/test/functional/ft_51_misc.rb +67 -0
  176. data/test/functional/ft_52_case.rb +134 -0
  177. data/test/functional/ft_53_engine_on_terminate.rb +95 -0
  178. data/test/functional/ft_54_patterns.rb +104 -0
  179. data/test/functional/{ft_37_engine_participant.rb → ft_55_engine_participant.rb} +4 -5
  180. data/test/functional/ft_56_filter_attribute.rb +259 -0
  181. data/test/functional/ft_5_on_error.rb +77 -30
  182. data/test/functional/ft_6_on_cancel.rb +66 -11
  183. data/test/functional/ft_7_tags.rb +94 -5
  184. data/test/functional/ft_8_participant_consumption.rb +36 -5
  185. data/test/functional/ft_9_subprocesses.rb +10 -10
  186. data/test/functional/rt_1_listen.rb +3 -3
  187. data/test/functional/{rt_3_when.rb → rt_3_once.rb} +4 -4
  188. data/test/functional/storage_helper.rb +15 -13
  189. data/test/functional/test.rb +1 -3
  190. data/test/test_helper.rb +0 -8
  191. data/test/unit/storage.rb +154 -10
  192. data/test/unit/{ut_0_ruby_parser.rb → ut_0_ruby_reader.rb} +61 -11
  193. data/test/unit/ut_11_lookup.rb +7 -0
  194. data/test/unit/ut_13_serializer.rb +1 -1
  195. data/test/unit/ut_15_util.rb +23 -0
  196. data/test/unit/{ut_16_parser.rb → ut_16_reader.rb} +11 -13
  197. data/test/unit/ut_1_fei.rb +57 -10
  198. data/test/unit/ut_20_composite_storage.rb +25 -11
  199. data/test/unit/ut_21_participant_list.rb +47 -0
  200. data/test/unit/ut_22_filter.rb +903 -0
  201. data/test/unit/ut_3_wait_logger.rb +2 -6
  202. data/test/unit/ut_6_condition.rb +164 -17
  203. data/test/unit/ut_7_workitem.rb +28 -0
  204. data/test/unit/ut_8_tree_to_dot.rb +1 -1
  205. data/test/unit/{ut_9_xml_parser.rb → ut_9_xml_reader.rb} +5 -5
  206. metadata +108 -84
  207. data/.gitignore +0 -4
  208. data/examples/barley.rb +0 -391
  209. data/examples/flickr_report.rb +0 -107
  210. data/examples/pong.rb +0 -37
  211. data/examples/ruote_quickstart.rb +0 -43
  212. data/examples/web_first_page.rb +0 -68
  213. data/lib/ruote/part/hash_participant.rb +0 -91
  214. data/test/README.rdoc +0 -15
  215. data/test/functional/crunner.sh +0 -19
  216. data/test/pdef.xml +0 -7
  217. 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/part/hash_participant'
10
+ require 'ruote/participant'
11
11
 
12
12
 
13
13
  class EftUndoTest < Test::Unit::TestCase
@@ -23,7 +23,7 @@ class EftUndoTest < Test::Unit::TestCase
23
23
  echo 'over'
24
24
  end
25
25
 
26
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
26
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
27
27
 
28
28
  #noisy
29
29
 
@@ -47,7 +47,7 @@ class EftUndoTest < Test::Unit::TestCase
47
47
  echo 'over'
48
48
  end
49
49
 
50
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
50
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
51
51
 
52
52
  #noisy
53
53
 
@@ -74,5 +74,41 @@ class EftUndoTest < Test::Unit::TestCase
74
74
 
75
75
  assert_trace '.', pdef
76
76
  end
77
+
78
+ def test_undo_missing_tag
79
+
80
+ pdef = Ruote.process_definition do
81
+ cancel :nada
82
+ echo '.'
83
+ end
84
+
85
+ assert_trace '.', pdef
86
+ end
87
+
88
+ def test_undo_tag_pointing_nowhere
89
+
90
+ pdef = Ruote.process_definition do
91
+ set 'v:nada' => []
92
+ cancel :nada
93
+ echo '.'
94
+ end
95
+
96
+ #@engine.noisy = true
97
+
98
+ assert_trace '.', pdef
99
+ end
100
+
101
+ def test_undo_tag_pointing_to_missing_fei
102
+
103
+ pdef = Ruote.process_definition do
104
+ set 'v:nada' => { 'wfid' => '${wfid}', 'expid' => '${expid}', 'engine_id' => '${engine_id}' }
105
+ cancel :nada
106
+ echo '.'
107
+ end
108
+
109
+ #@engine.noisy = true
110
+
111
+ assert_trace '.', pdef
112
+ end
77
113
  end
78
114
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  require File.join(File.dirname(__FILE__), 'base')
9
9
 
10
- require 'ruote/part/hash_participant'
10
+ require 'ruote/participant'
11
11
 
12
12
 
13
13
  class EftRedoTest < Test::Unit::TestCase
@@ -22,7 +22,7 @@ class EftRedoTest < Test::Unit::TestCase
22
22
  end
23
23
  end
24
24
 
25
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
25
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
26
26
 
27
27
  #noisy
28
28
 
@@ -42,5 +42,97 @@ class EftRedoTest < Test::Unit::TestCase
42
42
 
43
43
  assert_equal 3, logger.log.select { |e| e['action'] == 'entered_tag' }.size
44
44
  end
45
+
46
+ def test_redo_missing_tag
47
+
48
+ pdef = Ruote.process_definition do
49
+ _redo :nada
50
+ echo '.'
51
+ end
52
+
53
+ assert_trace '.', pdef
54
+ end
55
+
56
+ def test_redo_tag_pointing_nowhere
57
+
58
+ pdef = Ruote.process_definition do
59
+ set 'v:nada' => []
60
+ _redo :nada
61
+ echo '.'
62
+ end
63
+
64
+ #@engine.noisy = true
65
+
66
+ assert_trace '.', pdef
67
+ end
68
+
69
+ def test_redo_tag_pointing_to_missing_fei
70
+
71
+ pdef = Ruote.process_definition do
72
+ set 'v:nada' => { 'wfid' => '${wfid}', 'expid' => '${expid}', 'engine_id' => '${engine_id}' }
73
+ _redo :nada
74
+ echo '.'
75
+ end
76
+
77
+ #@engine.noisy = true
78
+
79
+ assert_trace '.', pdef
80
+ end
81
+
82
+ def test_forget_and_redo
83
+
84
+ pdef = Ruote.process_definition do
85
+ sequence :tag => 'x' do
86
+ alpha :forget => true
87
+ _redo 'x'
88
+ end
89
+ end
90
+
91
+ #noisy
92
+
93
+ @engine.register 'alpha', Ruote::StorageParticipant
94
+
95
+ wfid = @engine.launch(pdef)
96
+
97
+ while @engine.storage_participant.size < 2
98
+ sleep 0.350
99
+ end
100
+
101
+ assert_not_nil @engine.process(wfid)
102
+ assert_equal [], @engine.errors
103
+ end
104
+
105
+ class Alpha
106
+ include Ruote::LocalParticipant
107
+ @@seen = false
108
+ def consume(workitem)
109
+ (workitem.fields['alpha'] ||= []) << 'x'
110
+ workitem.fields['over'] = @@seen
111
+ @@seen = true
112
+ reply_to_engine(workitem)
113
+ end
114
+ end
115
+
116
+ def test_redo__blank_workitem
117
+
118
+ @engine.register do
119
+ alpha Alpha
120
+ end
121
+
122
+ pdef = Ruote.process_definition do
123
+ sequence :tag => 'x' do
124
+ alpha
125
+ _redo 'x', :unless => '${over}'
126
+ end
127
+ end
128
+
129
+ #noisy
130
+
131
+ wfid = @engine.launch(pdef)
132
+
133
+ r = @engine.wait_for(wfid)
134
+
135
+ assert_equal %w[ x ], r['workitem']['fields']['alpha']
136
+ end
45
137
  end
46
138
 
@@ -88,7 +88,14 @@ class FtDollarTest < Test::Unit::TestCase
88
88
 
89
89
  #noisy
90
90
 
91
- assert_trace('><', pdef)
91
+ wfid = @engine.launch(pdef)
92
+
93
+ @engine.wait_for(wfid)
94
+
95
+ assert_equal(
96
+ "#<ArgumentError: 'ruby_eval_allowed' is set to false, cannot evaluate" +
97
+ " >1 + 2< (http://ruote.rubyforge.org/dollar.html)>",
98
+ @engine.errors.first.message)
92
99
  end
93
100
 
94
101
  def test_r
@@ -167,7 +174,7 @@ class FtDollarTest < Test::Unit::TestCase
167
174
 
168
175
  @engine.wait_for(wfid)
169
176
 
170
- assert_equal "0_0_0!!#{wfid}\n#{wfid}", @tracer.to_s
177
+ assert_match /^0_0_0![^!]+!#{wfid}\n#{wfid}$/, @tracer.to_s
171
178
  end
172
179
 
173
180
  def test_direct_access_to_fields
@@ -185,5 +192,77 @@ class FtDollarTest < Test::Unit::TestCase
185
192
 
186
193
  assert_trace 'alpha/bravo/charly', pdef
187
194
  end
195
+
196
+ def test_dollar_quote
197
+
198
+ pdef = Ruote.define do
199
+ set 'f:a' => 'alpha'
200
+ set 'f:b' => 'bra vo'
201
+ echo '${"f:a}'
202
+ echo "${'f:a}"
203
+ echo 'ok', :if => "${'f:b} == 'bra vo'"
204
+ end
205
+
206
+ assert_trace %w[ "alpha" "alpha" ok ], pdef
207
+ end
208
+
209
+ def test_literally
210
+
211
+ pdef = Ruote.define do
212
+ set 'f:a' => %w[ A B C ]
213
+ set 'f:b' => 'a'
214
+ set 'v:c' => %w[ venture capitalist ]
215
+ set 'f:A' => '$f:a'
216
+ set 'f:B' => '$f:${b}'
217
+ set 'f:C' => '$v:c'
218
+ set 'f:D' => '$f:nada'
219
+ set 'f:E' => '$v:nada'
220
+ set 'f:F' => '$a'
221
+ set 'f:G' => '$nada'
222
+ set 'f:H' => '$a '
223
+ filter :f => /^[a-c]$/, :del => true
224
+ end
225
+
226
+ #noisy
227
+
228
+ wfid = @engine.launch(pdef)
229
+
230
+ r = @engine.wait_for(wfid)
231
+
232
+ assert_equal(
233
+ {
234
+ 'A' => %w[ A B C ],
235
+ 'B' => %w[ A B C ],
236
+ 'C' => %w[ venture capitalist ],
237
+ 'D' => '$f:nada',
238
+ 'E' => '$v:nada',
239
+ 'F' => %w[ A B C ],
240
+ 'G' => '$nada',
241
+ 'H' => '$a '
242
+ },
243
+ r['workitem']['fields'])
244
+ end
245
+
246
+ def test_literally_and_participant_params
247
+
248
+ pdef = Ruote.define do
249
+ set 'f:a' => %w[ A B C ]
250
+ alpha :b => '$f:a'
251
+ end
252
+
253
+ @engine.register_participant :alpha do |wi|
254
+ wi.fields['parameters'] = wi.fields['params']
255
+ end
256
+
257
+ #noisy
258
+
259
+ wfid = @engine.launch(pdef)
260
+
261
+ r = @engine.wait_for(wfid)
262
+
263
+ assert_equal(
264
+ { 'b' => %w[ A B C ], 'ref' => 'alpha' },
265
+ r['workitem']['fields']['parameters'])
266
+ end
188
267
  end
189
268
 
@@ -16,16 +16,10 @@ class FtRecursionTest < Test::Unit::TestCase
16
16
  class CountingParticipant
17
17
  include Ruote::LocalParticipant
18
18
 
19
- attr_reader :wfids
19
+ def consume(workitem)
20
20
 
21
- def initialize
22
-
23
- @wfids = []
24
- end
25
-
26
- def consume (workitem)
27
-
28
- @wfids << "#{workitem.fei.wfid}|#{workitem.fei.sub_wfid}"
21
+ @context.stash[:wfids] ||= []
22
+ @context.stash[:wfids] << "#{workitem.fei.wfid}|#{workitem.fei.subid}"
29
23
 
30
24
  workitem.fields['count'] ||= 0
31
25
  workitem.fields['count'] = workitem.fields['count'] + 1
@@ -39,12 +33,14 @@ class FtRecursionTest < Test::Unit::TestCase
39
33
  end
40
34
  end
41
35
 
42
- def cancel (fei, flavour)
36
+ def cancel(fei, flavour)
43
37
  end
44
38
  end
45
39
 
46
40
  def test_main_recursion
47
41
 
42
+ @engine.context.stash[:wfids] = []
43
+
48
44
  pdef = Ruote.process_definition :name => 'def0' do
49
45
  sequence do
50
46
  alpha
@@ -52,19 +48,19 @@ class FtRecursionTest < Test::Unit::TestCase
52
48
  end
53
49
  end
54
50
 
55
- alpha = @engine.register_participant :alpha, CountingParticipant.new
51
+ alpha = @engine.register_participant :alpha, CountingParticipant
56
52
 
57
53
  #noisy
58
54
 
59
55
  assert_trace(%w[ 1 2 3 4 5 6 ], pdef)
60
56
 
61
- #p alpha.wfids.uniq
62
-
63
- assert_equal 6, alpha.wfids.uniq.size
57
+ assert_equal 6, @engine.context.stash[:wfids].uniq.size
64
58
  end
65
59
 
66
60
  def test_sub_recursion
67
61
 
62
+ @engine.context.stash[:wfids] = []
63
+
68
64
  pdef = Ruote.process_definition do
69
65
  define 'sub0' do
70
66
  sequence do
@@ -75,7 +71,7 @@ class FtRecursionTest < Test::Unit::TestCase
75
71
  sub0
76
72
  end
77
73
 
78
- alpha = @engine.register_participant :alpha, CountingParticipant.new
74
+ alpha = @engine.register_participant :alpha, CountingParticipant
79
75
 
80
76
  #noisy
81
77
 
@@ -83,7 +79,7 @@ class FtRecursionTest < Test::Unit::TestCase
83
79
 
84
80
  #p alpha.wfids.uniq
85
81
 
86
- assert_equal 6, alpha.wfids.uniq.size
82
+ assert_equal 6, @engine.context.stash[:wfids].uniq.size
87
83
  end
88
84
 
89
85
  def test_forgotten_main_recursion
@@ -97,7 +93,7 @@ class FtRecursionTest < Test::Unit::TestCase
97
93
  end
98
94
  end
99
95
 
100
- alpha = @engine.register_participant :alpha, CountingParticipant.new
96
+ alpha = @engine.register_participant :alpha, CountingParticipant
101
97
 
102
98
  #noisy
103
99
 
@@ -17,10 +17,8 @@ class FtLaunchitemTest < Test::Unit::TestCase
17
17
  alpha
18
18
  end
19
19
 
20
- fields = nil
21
-
22
20
  @engine.register_participant :alpha do |workitem|
23
- fields = workitem.fields
21
+ stash[:fields] = workitem.fields
24
22
  @tracer << 'a'
25
23
  nil
26
24
  end
@@ -32,8 +30,14 @@ class FtLaunchitemTest < Test::Unit::TestCase
32
30
 
33
31
  assert_equal('a', @tracer.to_s)
34
32
 
35
- assert_not_nil(fields.delete('dispatched_at'))
36
- assert_equal({"a"=>0, "b"=>1, "params"=>{"ref"=>"alpha"}}, fields)
33
+ @engine.context.stash[:fields].delete('__result__')
34
+
35
+ assert_not_nil(
36
+ @engine.context.stash[:fields].delete('dispatched_at'))
37
+
38
+ assert_equal(
39
+ {"a"=>0, "b"=>1, "params"=>{"ref"=>"alpha"}},
40
+ @engine.context.stash[:fields])
37
41
  end
38
42
  end
39
43
 
@@ -104,7 +104,7 @@ class FtVariablesTest < Test::Unit::TestCase
104
104
  end
105
105
  end
106
106
 
107
- results = []
107
+ @engine.context.stash[:results] = []
108
108
 
109
109
  @engine.register_participant :alpha do |workitem, fexp|
110
110
 
@@ -112,20 +112,18 @@ class FtVariablesTest < Test::Unit::TestCase
112
112
  public :locate_var
113
113
  end
114
114
 
115
- results << fexp.locate_var('//a')
116
- results << fexp.locate_var('/a').first.fei.to_storage_id
117
- results << fexp.locate_var('a').first.fei.to_storage_id
115
+ stash[:results] << fexp.locate_var('//a')
116
+ stash[:results] << fexp.locate_var('/a').first.fei.to_storage_id
117
+ stash[:results] << fexp.locate_var('a').first.fei.to_storage_id
118
118
  end
119
119
 
120
120
  #noisy
121
121
 
122
122
  assert_trace 'done.', pdef
123
123
 
124
- #p results
125
-
126
- assert_equal(nil, results[0])
127
- assert_match(/^0||\d+_\d+$/, results[1])
128
- assert_match(/^0\_0|\d+|\d+_\d+$/, results[2])
124
+ assert_equal(nil, @engine.context.stash[:results][0])
125
+ assert_match(/^0||\d+_\d+$/, @engine.context.stash[:results][1])
126
+ assert_match(/^0\_0|\d+|\d+_\d+$/, @engine.context.stash[:results][2])
129
127
  end
130
128
 
131
129
  def test_lookup_in_var
@@ -7,9 +7,6 @@
7
7
 
8
8
  require File.join(File.dirname(__FILE__), 'base')
9
9
 
10
- require 'ruote/part/hash_participant'
11
- require 'ruote/part/storage_participant'
12
-
13
10
 
14
11
  class FtReApplyTest < Test::Unit::TestCase
15
12
  include FunctionalBase
@@ -23,7 +20,7 @@ class FtReApplyTest < Test::Unit::TestCase
23
20
 
24
21
  def test_re_apply
25
22
 
26
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
23
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
27
24
 
28
25
  #noisy
29
26
 
@@ -54,7 +51,7 @@ class FtReApplyTest < Test::Unit::TestCase
54
51
 
55
52
  def test_cancel_and_re_apply
56
53
 
57
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
54
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
58
55
 
59
56
  #noisy
60
57
 
@@ -85,7 +82,7 @@ class FtReApplyTest < Test::Unit::TestCase
85
82
 
86
83
  def test_update_expression_and_re_apply
87
84
 
88
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
85
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
89
86
 
90
87
  #noisy
91
88
 
@@ -129,7 +126,7 @@ class FtReApplyTest < Test::Unit::TestCase
129
126
  end
130
127
  end
131
128
 
132
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
129
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
133
130
 
134
131
  #noisy
135
132
 
@@ -167,7 +164,7 @@ class FtReApplyTest < Test::Unit::TestCase
167
164
  end
168
165
  end
169
166
 
170
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
167
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
171
168
 
172
169
  #noisy
173
170
 
@@ -198,7 +195,7 @@ class FtReApplyTest < Test::Unit::TestCase
198
195
 
199
196
  def test_re_apply_with_new_tree
200
197
 
201
- alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
198
+ alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
202
199
 
203
200
  #noisy
204
201