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
@@ -28,7 +28,7 @@ class EftConcurrenceTest < Test::Unit::TestCase
28
28
 
29
29
  #noisy
30
30
 
31
- assert_trace pdef, %w[ alpha alpha ]
31
+ assert_trace %w[ alpha alpha ], pdef
32
32
  end
33
33
 
34
34
  def test_over_if
@@ -61,7 +61,7 @@ class EftConcurrenceTest < Test::Unit::TestCase
61
61
 
62
62
  #noisy
63
63
 
64
- assert_trace(pdef, %w[ alpha ] * 3)
64
+ assert_trace(%w[ alpha ] * 3, pdef)
65
65
 
66
66
  #assert_equal(
67
67
  # {'1'=>{"seen"=>"indeed"}, '0'=>{}, "params"=>{"ref"=>"bravo"}},
@@ -105,7 +105,7 @@ class EftConcurrenceTest < Test::Unit::TestCase
105
105
 
106
106
  #noisy
107
107
 
108
- assert_trace(pdef, %w[ a a done. ])
108
+ assert_trace(%w[ a a done. ], pdef)
109
109
  end
110
110
 
111
111
  def test_remaining_forget_when_no_remains
@@ -120,7 +120,7 @@ class EftConcurrenceTest < Test::Unit::TestCase
120
120
 
121
121
  #noisy
122
122
 
123
- assert_trace pdef, %w[ a b done. ], %w[ b a done. ]
123
+ assert_trace %w[ a b done. ], %w[ b a done. ], pdef
124
124
  end
125
125
 
126
126
  # helper
@@ -188,6 +188,19 @@ class EftConcurrenceTest < Test::Unit::TestCase
188
188
  assert_equal(%w[ seen ], wi.fields['1'].keys)
189
189
  end
190
190
 
191
+ def test_concurrence_merge_type_stack
192
+
193
+ wi = run_concurrence({ :merge_type => :stack }, false)
194
+
195
+ assert_equal(
196
+ %w[ params stack stack_attributes ],
197
+ wi.fields.keys.collect { |k| k.to_s }.sort)
198
+
199
+ assert_equal({ 'ref' => 'alpha' }, wi.fields['params'])
200
+ assert_equal(%w[ seen ], wi.fields['stack'][0].keys)
201
+ assert_equal(%w[ seen ], wi.fields['stack'][1].keys)
202
+ end
203
+
191
204
  # helper
192
205
  #
193
206
  def run_test_count (remaining, noise)
@@ -55,7 +55,7 @@ class EftForgetTest < Test::Unit::TestCase
55
55
  # echo '2_${v:a}'
56
56
  # end
57
57
  # noisy
58
- # assert_trace pdef, %w[ 1_1 0_0 2_1 ]
58
+ # assert_trace %w[ 1_1 0_0 2_1 ], pdef
59
59
  #end
60
60
  end
61
61
 
@@ -27,7 +27,7 @@ class EftUndoTest < Test::Unit::TestCase
27
27
 
28
28
  #noisy
29
29
 
30
- assert_trace pdef, %w[ over ]
30
+ assert_trace %w[ over ], pdef
31
31
 
32
32
  assert_equal 0, alpha.size
33
33
 
@@ -51,7 +51,7 @@ class EftUndoTest < Test::Unit::TestCase
51
51
 
52
52
  #noisy
53
53
 
54
- assert_trace pdef, %w[ over ]
54
+ assert_trace %w[ over ], pdef
55
55
 
56
56
  assert_equal 0, alpha.size
57
57
 
@@ -72,7 +72,7 @@ class EftUndoTest < Test::Unit::TestCase
72
72
 
73
73
  #noisy
74
74
 
75
- assert_trace pdef, '.'
75
+ assert_trace '.', pdef
76
76
  end
77
77
  end
78
78
 
@@ -7,6 +7,8 @@
7
7
 
8
8
  require File.join(File.dirname(__FILE__), 'base')
9
9
 
10
+ require 'ruote/part/null_participant'
11
+
10
12
 
11
13
  class FtWorkerTest < Test::Unit::TestCase
12
14
  include FunctionalBase
@@ -18,7 +20,7 @@ class FtWorkerTest < Test::Unit::TestCase
18
20
  pdef = Ruote.process_definition do
19
21
  end
20
22
 
21
- assert_trace pdef, ''
23
+ assert_trace '', pdef
22
24
 
23
25
  #puts; logger.log.each { |e| p e }; puts
24
26
  assert_equal %w[ launch terminated ], logger.log.map { |e| e['action'] }
@@ -42,5 +44,19 @@ class FtWorkerTest < Test::Unit::TestCase
42
44
 
43
45
  assert_equal 1, @engine.storage.get_many('msgs').size
44
46
  end
47
+
48
+ def test_remaining_messages
49
+
50
+ @engine.register_participant :alfred, Ruote::NullParticipant
51
+
52
+ pdef = Ruote.process_definition do
53
+ end
54
+
55
+ assert_trace '', pdef
56
+
57
+ sleep 0.300
58
+
59
+ assert_equal [], @engine.storage.get_msgs
60
+ end
45
61
  end
46
62
 
@@ -23,7 +23,7 @@ class FtDollarTest < Test::Unit::TestCase
23
23
 
24
24
  #noisy
25
25
 
26
- assert_trace pdef, 'field'
26
+ assert_trace 'field', pdef
27
27
  end
28
28
 
29
29
  def test_v
@@ -40,7 +40,7 @@ class FtDollarTest < Test::Unit::TestCase
40
40
 
41
41
  #noisy
42
42
 
43
- assert_trace(pdef, %w[ a b0 c0 d0 ])
43
+ assert_trace(%w[ a b0 c0 d0 ], pdef)
44
44
  end
45
45
 
46
46
  def test_nested_v
@@ -59,7 +59,7 @@ class FtDollarTest < Test::Unit::TestCase
59
59
 
60
60
  #noisy
61
61
 
62
- assert_trace(pdef, %w[ a:toto b:atlantic_city ])
62
+ assert_trace(%w[ a:toto b:atlantic_city ], pdef)
63
63
  end
64
64
 
65
65
  def test_f
@@ -75,7 +75,7 @@ class FtDollarTest < Test::Unit::TestCase
75
75
 
76
76
  #noisy
77
77
 
78
- assert_trace(pdef, %w[ a btoto cAsia ])
78
+ assert_trace(%w[ a btoto cAsia ], pdef)
79
79
  end
80
80
 
81
81
  def test_no_r
@@ -88,7 +88,7 @@ class FtDollarTest < Test::Unit::TestCase
88
88
 
89
89
  #noisy
90
90
 
91
- assert_trace(pdef, '><')
91
+ assert_trace('><', pdef)
92
92
  end
93
93
 
94
94
  def test_r
@@ -103,7 +103,7 @@ class FtDollarTest < Test::Unit::TestCase
103
103
 
104
104
  @engine.context['ruby_eval_allowed'] = true
105
105
 
106
- assert_trace(pdef, '>3<')
106
+ assert_trace('>3<', pdef)
107
107
  end
108
108
 
109
109
  def test_r_and_wi
@@ -120,7 +120,7 @@ class FtDollarTest < Test::Unit::TestCase
120
120
 
121
121
  @engine.context['ruby_eval_allowed'] = true
122
122
 
123
- assert_trace pdef, "person\nperson"
123
+ assert_trace "person\nperson", pdef
124
124
  end
125
125
 
126
126
  def test_r_and_d
@@ -136,7 +136,7 @@ class FtDollarTest < Test::Unit::TestCase
136
136
 
137
137
  @engine.context['ruby_eval_allowed'] = true
138
138
 
139
- assert_trace pdef, 'person'
139
+ assert_trace 'person', pdef
140
140
  end
141
141
 
142
142
  def test_nested
@@ -151,7 +151,7 @@ class FtDollarTest < Test::Unit::TestCase
151
151
 
152
152
  #noisy
153
153
 
154
- assert_trace pdef, 'AA'
154
+ assert_trace 'AA', pdef
155
155
  end
156
156
 
157
157
  def test_wfid
@@ -56,7 +56,7 @@ class FtRecursionTest < Test::Unit::TestCase
56
56
 
57
57
  #noisy
58
58
 
59
- assert_trace(pdef, %w[ 1 2 3 4 5 6 ])
59
+ assert_trace(%w[ 1 2 3 4 5 6 ], pdef)
60
60
 
61
61
  #p alpha.wfids.uniq
62
62
 
@@ -79,7 +79,7 @@ class FtRecursionTest < Test::Unit::TestCase
79
79
 
80
80
  #noisy
81
81
 
82
- assert_trace pdef, %w[ 1 2 3 4 5 6 ]
82
+ assert_trace %w[ 1 2 3 4 5 6 ], pdef
83
83
 
84
84
  #p alpha.wfids.uniq
85
85
 
@@ -37,7 +37,7 @@ class FtVariablesTest < Test::Unit::TestCase
37
37
 
38
38
  #noisy
39
39
 
40
- assert_trace(pdef, 'done.')
40
+ assert_trace('done.', pdef)
41
41
 
42
42
  #logger.log.each { |e| p e }
43
43
 
@@ -66,7 +66,7 @@ class FtVariablesTest < Test::Unit::TestCase
66
66
 
67
67
  #noisy
68
68
 
69
- assert_trace(pdef, %w[ a0:b0:a0:b0 a1:b1:a0:b1 a0:b1:a0:b1 ])
69
+ assert_trace(%w[ a0:b0:a0:b0 a1:b1:a0:b1 a0:b1:a0:b1 ], pdef)
70
70
  end
71
71
 
72
72
  def test_engine_variables
@@ -84,7 +84,7 @@ class FtVariablesTest < Test::Unit::TestCase
84
84
 
85
85
  @engine.variables['vb'] = 'b0'
86
86
 
87
- assert_trace(pdef, %w[ a0: b0:b0 done. ])
87
+ assert_trace(%w[ a0: b0:b0 done. ], pdef)
88
88
 
89
89
  assert_equal(
90
90
  1, logger.log.select { |e| e['action'] == 'variable_set' }.size)
@@ -119,7 +119,7 @@ class FtVariablesTest < Test::Unit::TestCase
119
119
 
120
120
  #noisy
121
121
 
122
- assert_trace pdef, 'done.'
122
+ assert_trace 'done.', pdef
123
123
 
124
124
  #p results
125
125
 
@@ -29,7 +29,7 @@ class FtConditionalTest < Test::Unit::TestCase
29
29
  end
30
30
  end
31
31
 
32
- assert_trace(pdef, %w[ 2 a b d ])
32
+ assert_trace(%w[ 2 a b d ], pdef)
33
33
  end
34
34
 
35
35
  def test_string_equality_when_space
@@ -49,7 +49,7 @@ class FtConditionalTest < Test::Unit::TestCase
49
49
  end
50
50
  end
51
51
 
52
- assert_trace(pdef, "some dude\na\nb\nd")
52
+ assert_trace("some dude\na\nb\nd", pdef)
53
53
  end
54
54
 
55
55
  def test_unless
@@ -62,15 +62,15 @@ class FtConditionalTest < Test::Unit::TestCase
62
62
  echo '.'
63
63
  end
64
64
 
65
- assert_trace(pdef, { 'f' => 2000 }, %w[ 2000 i . ])
65
+ assert_trace(%w[ 2000 i . ], { 'f' => 2000 }, pdef)
66
66
 
67
67
  @tracer.clear
68
68
 
69
- assert_trace(pdef, { 'f' => '2000' }, %w[ 2000 i . ])
69
+ assert_trace(%w[ 2000 i . ], { 'f' => '2000' }, pdef)
70
70
 
71
71
  @tracer.clear
72
72
 
73
- assert_trace(pdef, { 'f' => 'other' }, %w[ other u . ])
73
+ assert_trace(%w[ other u . ], { 'f' => 'other' }, pdef)
74
74
  end
75
75
  end
76
76
 
@@ -27,7 +27,7 @@ class FtAliasTest < Test::Unit::TestCase
27
27
 
28
28
  #noisy
29
29
 
30
- assert_trace(pdef, %w[ b:alpha b: ])
30
+ assert_trace(%w[ b:alpha b: ], pdef)
31
31
  end
32
32
  end
33
33
 
@@ -353,7 +353,7 @@ class FtProcessStatusTest < Test::Unit::TestCase
353
353
 
354
354
  #noisy
355
355
 
356
- assert_trace pdef, %w[ a c c d ]
356
+ assert_trace %w[ a c c d ], pdef
357
357
 
358
358
  assert_equal(
359
359
  ["define", {"name"=>"test"}, [["sequence", {}, [["alpha", {}, []], ["charly", {}, []], ["participant", {"ref"=>"charly"}, []]]], ["delta", {}, []]]],
@@ -288,6 +288,8 @@ class FtStorageParticipantTest < Test::Unit::TestCase
288
288
  pa = @engine.register_participant 'alpha', Ruote::StorageParticipant
289
289
 
290
290
  assert_equal Ruote::StorageParticipant, pa.class
291
+
292
+ assert_equal [], pa.all
291
293
  end
292
294
  end
293
295
 
@@ -26,7 +26,7 @@ class FtProcessDefinitionTest < Test::Unit::TestCase
26
26
 
27
27
  #noisy
28
28
 
29
- assert_trace(pdef, %w[ a b ])
29
+ assert_trace(%w[ a b ], pdef)
30
30
  end
31
31
 
32
32
  def test_remote_definitions_not_allowed
@@ -63,8 +63,8 @@ class FtProcessDefinitionTest < Test::Unit::TestCase
63
63
  #p pdef.to_json
64
64
 
65
65
  assert_trace(
66
- "[\"define\",{\"name\":\"test\"},[[\"sequence\",{},[[\"echo\",{\"a\":null},[]],[\"echo\",{\"b\":null},[]]]]]]",
67
- %w[ a b ])
66
+ %w[ a b ],
67
+ "[\"define\",{\"name\":\"test\"},[[\"sequence\",{},[[\"echo\",{\"a\":null},[]],[\"echo\",{\"b\":null},[]]]]]]")
68
68
 
69
69
  Rufus::Json.backend = prev
70
70
  # back to initial state
@@ -74,7 +74,14 @@ class FtProcessDefinitionTest < Test::Unit::TestCase
74
74
 
75
75
  path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'pdef.xml'))
76
76
 
77
- assert_trace(path, %w[ a b ])
77
+ assert_trace(%w[ a b ], path)
78
+ end
79
+
80
+ def test_local_unexpanded_definition
81
+
82
+ path = File.join(File.dirname(__FILE__), '..', 'pdef.xml')
83
+
84
+ assert_trace(%w[ a b ], path)
78
85
  end
79
86
  end
80
87
 
@@ -35,7 +35,7 @@ class FtBlockParticipantTest < Test::Unit::TestCase
35
35
 
36
36
  #noisy
37
37
 
38
- assert_trace pdef, "a\nb:f0:f0val\nc:f0:f0val:v0val"
38
+ assert_trace "a\nb:f0:f0val\nc:f0:f0val:v0val", pdef
39
39
  end
40
40
 
41
41
  TEST_BLOCK = Ruote.process_definition do
@@ -47,7 +47,7 @@ class FtBlockParticipantTest < Test::Unit::TestCase
47
47
 
48
48
  def test_block_result
49
49
 
50
- return if Ruote::WIN
50
+ return if Ruote::WIN or Ruote::JAVA
51
51
  # defective 'json' lib on windows render this test useless
52
52
 
53
53
  @engine.register_participant :alpha do |workitem|
@@ -56,7 +56,7 @@ class FtBlockParticipantTest < Test::Unit::TestCase
56
56
 
57
57
  #noisy
58
58
 
59
- assert_trace TEST_BLOCK, 'seen'
59
+ assert_trace 'seen', TEST_BLOCK
60
60
  end
61
61
 
62
62
  def test_non_jsonfiable_result
@@ -73,7 +73,16 @@ class FtBlockParticipantTest < Test::Unit::TestCase
73
73
  #noisy
74
74
 
75
75
  #assert_trace TEST_BLOCK, Ruote.time_to_utc_s(t)
76
- assert_trace TEST_BLOCK, defined?(DataMapper) ? '' : t.to_s
76
+
77
+ expected = if defined?(DataMapper)
78
+ ''
79
+ elsif Ruote::JAVA
80
+ ''
81
+ else
82
+ t.to_s
83
+ end
84
+
85
+ assert_trace expected, TEST_BLOCK
77
86
  end
78
87
  end
79
88
 
@@ -27,7 +27,7 @@ class FtVarIndirectionTest < Test::Unit::TestCase
27
27
 
28
28
  #noisy
29
29
 
30
- assert_trace pdef, 'alpha'
30
+ assert_trace 'alpha', pdef
31
31
  end
32
32
 
33
33
  def test_subprocess_indirection
@@ -45,7 +45,7 @@ class FtVarIndirectionTest < Test::Unit::TestCase
45
45
 
46
46
  #noisy
47
47
 
48
- assert_trace pdef, 'a'
48
+ assert_trace 'a', pdef
49
49
  end
50
50
 
51
51
  def test_subprocess_indirection_uri
@@ -60,7 +60,7 @@ class FtVarIndirectionTest < Test::Unit::TestCase
60
60
 
61
61
  #noisy
62
62
 
63
- assert_trace pdef, %w[ a b ]
63
+ assert_trace %w[ a b ], pdef
64
64
  end
65
65
 
66
66
  def test_subprocess_uri_set_as_engine_variable
@@ -73,7 +73,7 @@ class FtVarIndirectionTest < Test::Unit::TestCase
73
73
 
74
74
  @engine.variables['v'] = File.join(File.dirname(__FILE__), '..', 'pdef.xml')
75
75
 
76
- assert_trace pdef, %w[ a b ]
76
+ assert_trace %w[ a b ], pdef
77
77
  end
78
78
 
79
79
  def test_subprocess_uri_set_as_engine_variable__absolute
@@ -87,7 +87,7 @@ class FtVarIndirectionTest < Test::Unit::TestCase
87
87
  @engine.variables['v'] = File.expand_path(
88
88
  File.join(File.dirname(__FILE__), '..', 'pdef.xml'))
89
89
 
90
- assert_trace pdef, %w[ a b ]
90
+ assert_trace %w[ a b ], pdef
91
91
  end
92
92
  end
93
93