ruote 2.1.7 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. data/CHANGELOG.txt +13 -0
  2. data/CREDITS.txt +2 -1
  3. data/Rakefile +4 -3
  4. data/TODO.txt +11 -1
  5. data/lib/ruote/exp/fe_concurrence.rb +26 -2
  6. data/lib/ruote/exp/fe_participant.rb +1 -1
  7. data/lib/ruote/exp/merge.rb +16 -9
  8. data/lib/ruote/fei.rb +1 -1
  9. data/lib/ruote/parser.rb +2 -1
  10. data/lib/ruote/part/smtp_participant.rb +22 -41
  11. data/lib/ruote/part/storage_participant.rb +20 -1
  12. data/lib/ruote/part/template.rb +34 -18
  13. data/lib/ruote/storage/base.rb +2 -20
  14. data/lib/ruote/storage/composite_storage.rb +134 -0
  15. data/lib/ruote/storage/fs_storage.rb +15 -1
  16. data/lib/ruote/util/dollar.rb +1 -0
  17. data/lib/ruote/util/misc.rb +5 -1
  18. data/lib/ruote/util/time.rb +13 -3
  19. data/lib/ruote/version.rb +1 -1
  20. data/lib/ruote/worker.rb +2 -2
  21. data/ruote.gemspec +18 -12
  22. data/test/bm/seq_thousand.rb +1 -1
  23. data/test/functional/base.rb +6 -8
  24. data/test/functional/crunner.rb +2 -0
  25. data/test/functional/eft_0_process_definition.rb +2 -2
  26. data/test/functional/eft_10_cancel_process.rb +2 -2
  27. data/test/functional/eft_11_wait.rb +3 -3
  28. data/test/functional/eft_12_listen.rb +1 -1
  29. data/test/functional/eft_13_iterator.rb +14 -14
  30. data/test/functional/eft_14_cursor.rb +12 -12
  31. data/test/functional/eft_15_loop.rb +2 -2
  32. data/test/functional/eft_16_if.rb +11 -15
  33. data/test/functional/eft_17_equals.rb +2 -2
  34. data/test/functional/eft_18_concurrent_iterator.rb +35 -8
  35. data/test/functional/eft_1_echo.rb +1 -1
  36. data/test/functional/eft_21_restore.rb +3 -3
  37. data/test/functional/eft_22_noop.rb +1 -1
  38. data/test/functional/eft_23_apply.rb +9 -9
  39. data/test/functional/eft_25_command.rb +1 -1
  40. data/test/functional/eft_27_inc.rb +12 -12
  41. data/test/functional/eft_28_when.rb +4 -4
  42. data/test/functional/eft_2_sequence.rb +3 -3
  43. data/test/functional/eft_3_participant.rb +5 -5
  44. data/test/functional/eft_4_set.rb +12 -12
  45. data/test/functional/eft_5_subprocess.rb +8 -8
  46. data/test/functional/eft_6_concurrence.rb +17 -4
  47. data/test/functional/eft_7_forget.rb +1 -1
  48. data/test/functional/eft_8_undo.rb +3 -3
  49. data/test/functional/ft_0_worker.rb +17 -1
  50. data/test/functional/ft_10_dollar.rb +9 -9
  51. data/test/functional/ft_11_recursion.rb +2 -2
  52. data/test/functional/ft_13_variables.rb +4 -4
  53. data/test/functional/ft_17_conditional.rb +5 -5
  54. data/test/functional/ft_19_alias.rb +1 -1
  55. data/test/functional/ft_1_process_status.rb +1 -1
  56. data/test/functional/ft_20_storage_participant.rb +2 -0
  57. data/test/functional/ft_22_process_definitions.rb +11 -4
  58. data/test/functional/ft_24_block_participants.rb +13 -4
  59. data/test/functional/ft_27_var_indirection.rb +5 -5
  60. data/test/functional/ft_28_null_noop_participants.rb +1 -1
  61. data/test/functional/ft_29_part_template.rb +4 -23
  62. data/test/functional/ft_30_smtp_participant.rb +50 -4
  63. data/test/functional/ft_32_fs_history.rb +4 -8
  64. data/test/functional/ft_33_participant_subprocess_priority.rb +1 -1
  65. data/test/functional/ft_36_storage_history.rb +2 -2
  66. data/test/functional/ft_5_on_error.rb +5 -5
  67. data/test/functional/ft_8_participant_consumption.rb +2 -2
  68. data/test/path_helper.rb +1 -1
  69. data/test/test_helper.rb +17 -0
  70. data/test/unit/storage.rb +2 -17
  71. data/test/unit/ut_19_part_template.rb +76 -0
  72. data/test/unit/ut_1_fei.rb +13 -0
  73. data/test/unit/ut_20_composite_storage.rb +34 -0
  74. metadata +111 -55
@@ -23,7 +23,7 @@ class EftIteratorTest < Test::Unit::TestCase
23
23
 
24
24
  #noisy
25
25
 
26
- assert_trace(pdef, 'done.')
26
+ assert_trace('done.', pdef)
27
27
  end
28
28
 
29
29
  def test_iterator
@@ -40,7 +40,7 @@ class EftIteratorTest < Test::Unit::TestCase
40
40
 
41
41
  #noisy
42
42
 
43
- assert_trace(pdef, %w[ alice/0_0_0 bob/0_0_0 charly/0_0_0 ])
43
+ assert_trace(%w[ alice/0_0_0 bob/0_0_0 charly/0_0_0 ], pdef)
44
44
  end
45
45
 
46
46
  def test_to_f
@@ -57,7 +57,7 @@ class EftIteratorTest < Test::Unit::TestCase
57
57
 
58
58
  #noisy
59
59
 
60
- assert_trace(pdef, %w[ alice/0_0_0 bob/0_0_0 charly/0_0_0 ])
60
+ assert_trace(%w[ alice/0_0_0 bob/0_0_0 charly/0_0_0 ], pdef)
61
61
  end
62
62
 
63
63
  PDEF0 = Ruote.process_definition :name => 'test' do
@@ -81,7 +81,7 @@ class EftIteratorTest < Test::Unit::TestCase
81
81
 
82
82
  #noisy
83
83
 
84
- assert_trace(PDEF0, %w[ alice bob done. ])
84
+ assert_trace(%w[ alice bob done. ], PDEF0)
85
85
  end
86
86
 
87
87
  def test_rewind
@@ -100,7 +100,7 @@ class EftIteratorTest < Test::Unit::TestCase
100
100
 
101
101
  #noisy
102
102
 
103
- assert_trace(PDEF0, %w[ alice bob alice bob charly done. ])
103
+ assert_trace(%w[ alice bob alice bob charly done. ], PDEF0)
104
104
  end
105
105
 
106
106
  def test_skip
@@ -115,7 +115,7 @@ class EftIteratorTest < Test::Unit::TestCase
115
115
 
116
116
  #noisy
117
117
 
118
- assert_trace(PDEF0, %w[ alice charly done.])
118
+ assert_trace(%w[ alice charly done.], PDEF0)
119
119
  end
120
120
 
121
121
  def test_jump
@@ -130,7 +130,7 @@ class EftIteratorTest < Test::Unit::TestCase
130
130
 
131
131
  #noisy
132
132
 
133
- assert_trace(PDEF0, %w[ alice charly done.])
133
+ assert_trace(%w[ alice charly done.], PDEF0)
134
134
  end
135
135
 
136
136
  def test_skip_command
@@ -150,7 +150,7 @@ class EftIteratorTest < Test::Unit::TestCase
150
150
 
151
151
  #noisy
152
152
 
153
- assert_trace(pdef, %w[ alice/0_0_0_0 charly/0_0_0_0 ])
153
+ assert_trace(%w[ alice/0_0_0_0 charly/0_0_0_0 ], pdef)
154
154
  end
155
155
 
156
156
  def test_break_if
@@ -167,7 +167,7 @@ class EftIteratorTest < Test::Unit::TestCase
167
167
 
168
168
  #noisy
169
169
 
170
- assert_trace(pdef, %w[ a/0_0_0 b/0_0_0 ])
170
+ assert_trace(%w[ a/0_0_0 b/0_0_0 ], pdef)
171
171
  end
172
172
 
173
173
  def test_break_unless
@@ -185,7 +185,7 @@ class EftIteratorTest < Test::Unit::TestCase
185
185
 
186
186
  #noisy
187
187
 
188
- assert_trace(pdef, %w[ a/0_1_0 b/0_1_0 ])
188
+ assert_trace(%w[ a/0_1_0 b/0_1_0 ], pdef)
189
189
  end
190
190
 
191
191
  def test_iterator_with_hash_as_input
@@ -203,7 +203,7 @@ class EftIteratorTest < Test::Unit::TestCase
203
203
 
204
204
  #noisy
205
205
 
206
- assert_trace pdef, %w[ a:A b:B ]
206
+ assert_trace %w[ a:A b:B ], pdef
207
207
  end
208
208
 
209
209
  def test_implicit_i_variable
@@ -220,7 +220,7 @@ class EftIteratorTest < Test::Unit::TestCase
220
220
 
221
221
  #noisy
222
222
 
223
- assert_trace(pdef, %w[ alice:0/0_0_0 bob:1/0_0_0 charly:2/0_0_0 ])
223
+ assert_trace(%w[ alice:0/0_0_0 bob:1/0_0_0 charly:2/0_0_0 ], pdef)
224
224
  end
225
225
 
226
226
  def test_nested_break
@@ -241,7 +241,7 @@ class EftIteratorTest < Test::Unit::TestCase
241
241
 
242
242
  #noisy
243
243
 
244
- assert_trace pdef, %w[ 0_a 1_a ]
244
+ assert_trace %w[ 0_a 1_a ], pdef
245
245
  end
246
246
 
247
247
  def test_external_break
@@ -261,7 +261,7 @@ class EftIteratorTest < Test::Unit::TestCase
261
261
 
262
262
  #noisy
263
263
 
264
- assert_trace pdef, %w[ 1 2 ]
264
+ assert_trace %w[ 1 2 ], pdef
265
265
  end
266
266
  end
267
267
 
@@ -22,7 +22,7 @@ class EftCursorTest < Test::Unit::TestCase
22
22
 
23
23
  #noisy
24
24
 
25
- assert_trace(pdef, '')
25
+ assert_trace('', pdef)
26
26
  end
27
27
 
28
28
  def test_cursor
@@ -36,7 +36,7 @@ class EftCursorTest < Test::Unit::TestCase
36
36
 
37
37
  #noisy
38
38
 
39
- assert_trace(pdef, %w[ a b ])
39
+ assert_trace(%w[ a b ], pdef)
40
40
  end
41
41
 
42
42
  def test_skip
@@ -52,7 +52,7 @@ class EftCursorTest < Test::Unit::TestCase
52
52
 
53
53
  #noisy
54
54
 
55
- assert_trace(pdef, %w[ a c ])
55
+ assert_trace(%w[ a c ], pdef)
56
56
  end
57
57
 
58
58
  def test_break
@@ -67,7 +67,7 @@ class EftCursorTest < Test::Unit::TestCase
67
67
 
68
68
  #noisy
69
69
 
70
- assert_trace(pdef, 'a')
70
+ assert_trace('a', pdef)
71
71
  end
72
72
 
73
73
  def test_stop
@@ -82,7 +82,7 @@ class EftCursorTest < Test::Unit::TestCase
82
82
 
83
83
  #noisy
84
84
 
85
- assert_trace(pdef, 'a')
85
+ assert_trace('a', pdef)
86
86
  end
87
87
 
88
88
  def test_jump_to_tag
@@ -98,7 +98,7 @@ class EftCursorTest < Test::Unit::TestCase
98
98
 
99
99
  #noisy
100
100
 
101
- assert_trace(pdef, %w[ a c ])
101
+ assert_trace(%w[ a c ], pdef)
102
102
  end
103
103
 
104
104
  def test_jump_to_variable_tag
@@ -117,7 +117,7 @@ class EftCursorTest < Test::Unit::TestCase
117
117
 
118
118
  #noisy
119
119
 
120
- assert_trace(pdef, %w[ a b d ])
120
+ assert_trace(%w[ a b d ], pdef)
121
121
  end
122
122
 
123
123
  def test_rewind_if
@@ -140,7 +140,7 @@ class EftCursorTest < Test::Unit::TestCase
140
140
 
141
141
  #noisy
142
142
 
143
- assert_trace(pdef, %w[ a ] * 5)
143
+ assert_trace(%w[ a ] * 5, pdef)
144
144
  end
145
145
 
146
146
  def test_jump_to
@@ -171,7 +171,7 @@ class EftCursorTest < Test::Unit::TestCase
171
171
 
172
172
  #noisy
173
173
 
174
- assert_trace pdef, %w[ a r a r a r p ]
174
+ assert_trace %w[ a r a r a r p ], pdef
175
175
  # ARP nostalgy....
176
176
  end
177
177
 
@@ -244,7 +244,7 @@ class EftCursorTest < Test::Unit::TestCase
244
244
 
245
245
  #noisy
246
246
 
247
- assert_trace pdef, %w[ a b ]
247
+ assert_trace %w[ a b ], pdef
248
248
  end
249
249
 
250
250
  def test_break_if
@@ -258,7 +258,7 @@ class EftCursorTest < Test::Unit::TestCase
258
258
 
259
259
  #noisy
260
260
 
261
- assert_trace pdef, 'done.'
261
+ assert_trace 'done.', pdef
262
262
  end
263
263
 
264
264
  def test_over_unless
@@ -272,7 +272,7 @@ class EftCursorTest < Test::Unit::TestCase
272
272
 
273
273
  #noisy
274
274
 
275
- assert_trace pdef, 'done.'
275
+ assert_trace 'done.', pdef
276
276
  end
277
277
  end
278
278
 
@@ -38,7 +38,7 @@ class EftLoopTest < Test::Unit::TestCase
38
38
  if workitem.fields['count'] > 5
39
39
  end
40
40
 
41
- assert_trace(pdef, %w[ a b a b a b ])
41
+ assert_trace(%w[ a b a b a b ], pdef)
42
42
  end
43
43
 
44
44
  def test_repeat
@@ -61,7 +61,7 @@ class EftLoopTest < Test::Unit::TestCase
61
61
  if workitem.fields['count'] > 5
62
62
  end
63
63
 
64
- assert_trace(pdef, %w[ a a a a a a ])
64
+ assert_trace(%w[ a a a a a a ], pdef)
65
65
  end
66
66
  end
67
67
 
@@ -22,7 +22,7 @@ class EftIfTest < Test::Unit::TestCase
22
22
 
23
23
  #noisy
24
24
 
25
- assert_trace(pdef, 'then')
25
+ assert_trace('then', pdef)
26
26
  end
27
27
 
28
28
  def test_else
@@ -36,7 +36,7 @@ class EftIfTest < Test::Unit::TestCase
36
36
 
37
37
  #noisy
38
38
 
39
- assert_trace(pdef, 'else')
39
+ assert_trace('else', pdef)
40
40
  end
41
41
 
42
42
  def test_missing_then
@@ -51,7 +51,7 @@ class EftIfTest < Test::Unit::TestCase
51
51
 
52
52
  #noisy
53
53
 
54
- assert_trace(pdef, 'done.')
54
+ assert_trace('done.', pdef)
55
55
  end
56
56
 
57
57
  def test_missing_else
@@ -67,7 +67,7 @@ class EftIfTest < Test::Unit::TestCase
67
67
 
68
68
  #noisy
69
69
 
70
- assert_trace(pdef, 'done.')
70
+ assert_trace('done.', pdef)
71
71
  end
72
72
 
73
73
  def test_equals_true
@@ -82,7 +82,7 @@ class EftIfTest < Test::Unit::TestCase
82
82
 
83
83
  #noisy
84
84
 
85
- assert_trace(pdef, 'then')
85
+ assert_trace('then', pdef)
86
86
  end
87
87
 
88
88
  def test_equals_false
@@ -97,7 +97,7 @@ class EftIfTest < Test::Unit::TestCase
97
97
 
98
98
  #noisy
99
99
 
100
- assert_trace(pdef, 'else')
100
+ assert_trace('else', pdef)
101
101
  end
102
102
 
103
103
  def test_equals_true_no_then
@@ -113,7 +113,7 @@ class EftIfTest < Test::Unit::TestCase
113
113
 
114
114
  #noisy
115
115
 
116
- assert_trace(pdef, 'done.')
116
+ assert_trace('done.', pdef)
117
117
  end
118
118
 
119
119
  def test_attribute_text
@@ -141,16 +141,12 @@ class EftIfTest < Test::Unit::TestCase
141
141
 
142
142
  #noisy
143
143
 
144
- assert_trace(pdef, %w[ then else else else ])
144
+ assert_trace(%w[ then else else else ], pdef)
145
145
  end
146
146
 
147
147
  def test_xml_equals
148
148
 
149
- begin
150
- require 'yajl'
151
- rescue LoadError
152
- require 'json'
153
- end
149
+ require_json
154
150
  Rufus::Json.detect_backend
155
151
  # making sure JSON dup is available in case of HashStorage
156
152
 
@@ -165,11 +161,11 @@ class EftIfTest < Test::Unit::TestCase
165
161
  </process-definition>
166
162
  }
167
163
 
168
- assert_trace(pdef, { 'state' => 'A' }, 'alpha')
164
+ assert_trace('alpha', { 'state' => 'A' }, pdef)
169
165
 
170
166
  @tracer.clear
171
167
 
172
- assert_trace(pdef, { :state => 'A' }, 'alpha')
168
+ assert_trace('alpha', { :state => 'A' }, pdef)
173
169
  end
174
170
  end
175
171
 
@@ -30,7 +30,7 @@ class EftEqualsTest < Test::Unit::TestCase
30
30
 
31
31
  #noisy
32
32
 
33
- assert_trace(pdef, %w[ false ] * 4)
33
+ assert_trace(%w[ false ] * 4, pdef)
34
34
  end
35
35
 
36
36
  def test_true
@@ -49,7 +49,7 @@ class EftEqualsTest < Test::Unit::TestCase
49
49
 
50
50
  #noisy
51
51
 
52
- assert_trace(pdef, %w[ true ] * 2)
52
+ assert_trace(%w[ true ] * 2, pdef)
53
53
  end
54
54
  end
55
55
 
@@ -26,7 +26,7 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase
26
26
 
27
27
  #noisy
28
28
 
29
- assert_trace(pdef, 'done.')
29
+ assert_trace('done.', pdef)
30
30
  end
31
31
 
32
32
  def test_empty_list
@@ -42,7 +42,7 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase
42
42
 
43
43
  #noisy
44
44
 
45
- assert_trace(pdef, 'done.')
45
+ assert_trace('done.', pdef)
46
46
  end
47
47
 
48
48
  def test_iterator
@@ -192,7 +192,7 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase
192
192
 
193
193
  #noisy
194
194
 
195
- assert_trace pdef, %w[ p1:a:A out ]
195
+ assert_trace %w[ p1:a:A out ], pdef
196
196
  end
197
197
 
198
198
  def test_without_to
@@ -205,7 +205,7 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase
205
205
 
206
206
  #noisy
207
207
 
208
- assert_trace pdef, %w[ a a ]
208
+ assert_trace %w[ a a ], pdef
209
209
  end
210
210
 
211
211
  def test_branches_att
@@ -218,7 +218,7 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase
218
218
 
219
219
  #noisy
220
220
 
221
- assert_trace pdef, %w[ a a ]
221
+ assert_trace %w[ a a ], pdef
222
222
  end
223
223
 
224
224
  def test_implicit_i_variable
@@ -252,7 +252,7 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase
252
252
 
253
253
  #noisy
254
254
 
255
- assert_trace pdef, *%w[ a b c ].permutation.to_a
255
+ assert_trace *%w[ a b c ].permutation.to_a, pdef
256
256
  end
257
257
 
258
258
  def test_merge_type_isolate
@@ -273,13 +273,40 @@ class EftConcurrentIteratorTest < Test::Unit::TestCase
273
273
 
274
274
  #noisy
275
275
 
276
- assert_trace(
277
- pdef, %w{ . . . })
276
+ assert_trace(%w[ . . . ], pdef)
278
277
 
279
278
  mf = ('0'..'2').to_a.map { |k| mf[k]['f'] }.sort
280
279
  assert_equal %w[ a b c ], mf
281
280
  end
282
281
 
282
+ def test_merge_type_stack
283
+
284
+ pdef = Ruote.process_definition do
285
+ concurrent_iterator :on => 'a, b', :to_f => 'f', :merge_type => 'stack' do
286
+ echo '.'
287
+ end
288
+ bravo
289
+ end
290
+
291
+ mf = nil
292
+
293
+ @engine.register_participant :bravo do |workitem|
294
+ mf = workitem.fields
295
+ nil
296
+ end
297
+
298
+ #noisy
299
+
300
+ assert_trace(%w[ . . ], pdef)
301
+
302
+ assert_equal(
303
+ [["a"], ["b"]],
304
+ mf['stack'].collect { |f| f.values }.sort)
305
+ assert_equal(
306
+ {"on"=>"a, b", "to_f"=>"f", "merge_type"=>"stack"},
307
+ mf['stack_attributes'])
308
+ end
309
+
283
310
  def test_cancel
284
311
 
285
312
  n = 77
@@ -37,7 +37,7 @@ class EftEchoTest < Test::Unit::TestCase
37
37
 
38
38
  #noisy
39
39
 
40
- assert_trace(pdef, 'a')
40
+ assert_trace('a', pdef)
41
41
  end
42
42
 
43
43
  #def test_print_escape