openwferu 0.9.16 → 0.9.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/examples/about_state.rb +81 -0
  2. data/examples/engine_template.rb +7 -0
  3. data/lib/openwfe/contextual.rb +2 -2
  4. data/lib/openwfe/def.rb +2 -3
  5. data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
  6. data/lib/openwfe/engine/engine.rb +202 -251
  7. data/lib/openwfe/engine/process_status.rb +359 -0
  8. data/lib/openwfe/expool/errorjournal.rb +6 -6
  9. data/lib/openwfe/expool/expressionpool.rb +161 -239
  10. data/lib/openwfe/expool/expstorage.rb +185 -55
  11. data/lib/openwfe/expool/journal.rb +1 -2
  12. data/lib/openwfe/expool/parser.rb +233 -0
  13. data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
  14. data/lib/openwfe/expool/wfidgen.rb +25 -7
  15. data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
  16. data/lib/openwfe/expressions/condition.rb +49 -12
  17. data/lib/openwfe/expressions/environment.rb +45 -15
  18. data/lib/openwfe/expressions/expressionmap.rb +39 -19
  19. data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
  20. data/lib/openwfe/expressions/fe_cron.rb +19 -18
  21. data/lib/openwfe/expressions/fe_cursor.rb +69 -28
  22. data/lib/openwfe/expressions/fe_define.rb +4 -1
  23. data/lib/openwfe/expressions/fe_do.rb +1 -3
  24. data/lib/openwfe/expressions/fe_equals.rb +131 -20
  25. data/lib/openwfe/expressions/fe_fqv.rb +27 -3
  26. data/lib/openwfe/expressions/fe_iterator.rb +14 -7
  27. data/lib/openwfe/expressions/fe_listen.rb +7 -2
  28. data/lib/openwfe/expressions/fe_misc.rb +187 -20
  29. data/lib/openwfe/expressions/fe_participant.rb +8 -7
  30. data/lib/openwfe/expressions/fe_reserve.rb +105 -33
  31. data/lib/openwfe/expressions/fe_save.rb +55 -5
  32. data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
  33. data/lib/openwfe/expressions/fe_sleep.rb +25 -15
  34. data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
  35. data/lib/openwfe/expressions/fe_wait.rb +3 -2
  36. data/lib/openwfe/expressions/fe_when.rb +7 -15
  37. data/lib/openwfe/expressions/flowexpression.rb +90 -49
  38. data/lib/openwfe/expressions/merge.rb +7 -1
  39. data/lib/openwfe/expressions/raw.rb +261 -63
  40. data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
  41. data/lib/openwfe/expressions/time.rb +36 -12
  42. data/lib/openwfe/expressions/timeout.rb +9 -7
  43. data/lib/openwfe/expressions/value.rb +126 -0
  44. data/lib/openwfe/flowexpressionid.rb +52 -22
  45. data/lib/openwfe/listeners/listeners.rb +3 -3
  46. data/lib/openwfe/listeners/socketlisteners.rb +8 -5
  47. data/lib/openwfe/logging.rb +6 -3
  48. data/lib/openwfe/omixins.rb +8 -6
  49. data/lib/openwfe/orest/xmlcodec.rb +16 -12
  50. data/lib/openwfe/participants.rb +38 -0
  51. data/lib/openwfe/participants/participant.rb +1 -1
  52. data/lib/openwfe/participants/participantmap.rb +24 -10
  53. data/lib/openwfe/participants/participants.rb +4 -3
  54. data/lib/openwfe/participants/soapparticipants.rb +1 -1
  55. data/lib/openwfe/participants/socketparticipants.rb +1 -1
  56. data/lib/openwfe/rudefinitions.rb +7 -5
  57. data/lib/openwfe/storage/yamlcustom.rb +10 -10
  58. data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
  59. data/lib/openwfe/tools/flowtracer.rb +6 -5
  60. data/lib/openwfe/util/dollar.rb +42 -85
  61. data/lib/openwfe/util/ometa.rb +1 -3
  62. data/lib/openwfe/util/workqueue.rb +1 -1
  63. data/lib/openwfe/utils.rb +33 -11
  64. data/lib/openwfe/version.rb +2 -2
  65. data/lib/openwfe/workitem.rb +76 -14
  66. data/lib/openwfe/worklist/storelocks.rb +9 -4
  67. data/lib/openwfe/worklist/storeparticipant.rb +1 -1
  68. data/test/back_0916_test.rb +101 -0
  69. data/test/bm/ft_26_load.rb +1 -1
  70. data/test/bm/ft_26b_load.rb +1 -1
  71. data/test/bm/ft_26c_load.rb +3 -2
  72. data/test/bm/ft_26d_load.rb +97 -0
  73. data/test/bm/ft_recu.rb +71 -0
  74. data/test/concurrence_test.rb +1 -1
  75. data/test/condition_test.rb +152 -0
  76. data/test/description_test.rb +12 -7
  77. data/test/eno_test.rb +1 -1
  78. data/test/expool_20031219_0916.tgz +0 -0
  79. data/test/fe_lookup_att_test.rb +1 -1
  80. data/test/fei_test.rb +16 -0
  81. data/test/file_persistence_test.rb +8 -12
  82. data/test/filep_cancel_test.rb +116 -0
  83. data/test/flowtestbase.rb +47 -25
  84. data/test/ft_0.rb +1 -1
  85. data/test/ft_10_loop.rb +29 -14
  86. data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
  87. data/test/ft_11_ppd.rb +6 -17
  88. data/test/ft_11b_ppd.rb +1 -4
  89. data/test/ft_12_blockparticipant.rb +1 -1
  90. data/test/ft_13_eno.rb +1 -1
  91. data/test/ft_15_iterator.rb +1 -1
  92. data/test/ft_15b_iterator.rb +1 -1
  93. data/test/ft_17_condition.rb +6 -6
  94. data/test/ft_18_pname.rb +1 -1
  95. data/test/ft_20_cron.rb +1 -1
  96. data/test/ft_21_cron.rb +6 -4
  97. data/test/ft_22_history.rb +1 -1
  98. data/test/ft_23_when.rb +1 -1
  99. data/test/ft_23b_when.rb +18 -6
  100. data/test/ft_23c_wait.rb +8 -6
  101. data/test/ft_25_cancel.rb +7 -5
  102. data/test/ft_27_getflowpos.rb +22 -17
  103. data/test/ft_28_fileparticipant.rb +1 -2
  104. data/test/ft_2_concurrence.rb +1 -1
  105. data/test/ft_2b_concurrence.rb +25 -20
  106. data/test/ft_30_socketlistener.rb +0 -3
  107. data/test/ft_34_cancelwfid.rb +9 -9
  108. data/test/ft_35_localdefs.rb +0 -1
  109. data/test/ft_36_subprocids.rb +6 -6
  110. data/test/ft_38_tag.rb +3 -2
  111. data/test/ft_38b_tag.rb +229 -0
  112. data/test/ft_39_reserve.rb +3 -18
  113. data/test/ft_39b_reserve.rb +34 -5
  114. data/test/ft_3b_lookup_vf.rb +83 -0
  115. data/test/ft_40_defined.rb +2 -11
  116. data/test/ft_42_environments.rb +4 -6
  117. data/test/ft_44b_restore.rb +88 -22
  118. data/test/ft_45_citerator.rb +57 -11
  119. data/test/ft_49_condition.rb +4 -2
  120. data/test/ft_4_misc.rb +24 -3
  121. data/test/ft_50_xml_attribute.rb +17 -20
  122. data/test/ft_54_listen.rb +1 -1
  123. data/test/ft_54b_listen.rb +2 -2
  124. data/test/ft_56_timeout.rb +8 -1
  125. data/test/ft_57_a.rb +10 -10
  126. data/test/ft_59_ps.rb +49 -16
  127. data/test/ft_60_ecancel.rb +52 -10
  128. data/test/ft_63_pause.rb +8 -8
  129. data/test/ft_65_stringlaunch.rb +4 -6
  130. data/test/ft_67_schedlaunch.rb +4 -4
  131. data/test/ft_69_cancelmissing.rb +4 -2
  132. data/test/ft_70_lookupvar.rb +2 -2
  133. data/test/ft_72_lookup_processes.rb +2 -2
  134. data/test/ft_73_cancel_sub.rb +8 -8
  135. data/test/ft_77_segments.rb +38 -0
  136. data/test/ft_78_eval.rb +154 -0
  137. data/test/ft_79_tticket.rb +185 -0
  138. data/test/ft_80_spname.rb +95 -0
  139. data/test/ft_81_exp.rb +64 -0
  140. data/test/ft_82_trecu.rb +48 -0
  141. data/test/ft_83_badpause.rb +62 -0
  142. data/test/ft_84_updateexp.rb +125 -0
  143. data/test/ft_9b_cursor.rb +105 -0
  144. data/test/ft_tests.rb +14 -1
  145. data/test/hash_test.rb +7 -7
  146. data/test/hparticipant_test.rb +4 -4
  147. data/test/lookup_vf_test.rb +94 -0
  148. data/test/misc_test.rb +5 -3
  149. data/test/orest_test.rb +4 -3
  150. data/test/param_test.rb +12 -16
  151. data/test/participant_test.rb +36 -0
  152. data/test/pending.rb +10 -10
  153. data/test/rake_ltest.rb +1 -10
  154. data/test/rake_qtest.rb +7 -6
  155. data/test/raw_prog_test.rb +89 -121
  156. data/test/restart_cron_test.rb +84 -36
  157. data/test/restart_paused_test.rb +100 -0
  158. data/test/restart_sleep_test.rb +1 -1
  159. data/test/restart_tests.rb +1 -0
  160. data/test/restart_when_test.rb +33 -22
  161. data/test/ruby_procdef_test.rb +19 -18
  162. data/test/sec_test.rb +74 -35
  163. data/test/storage_test.rb +44 -0
  164. data/test/test.rb +3 -0
  165. data/test/timeout_test.rb +7 -18
  166. data/test/wfid_test.rb +2 -1
  167. data/test/wi_test.rb +29 -18
  168. metadata +121 -57
  169. data/lib/openwfe/expressions/raw_xml.rb +0 -176
  170. data/lib/openwfe/expressions/simplerep.rb +0 -266
  171. data/lib/openwfe/util/kotoba.rb +0 -236
  172. data/lib/openwfe/util/lru.rb +0 -171
  173. data/lib/openwfe/util/otime.rb +0 -246
  174. data/lib/openwfe/util/safe.rb +0 -160
  175. data/lib/openwfe/util/scheduler.rb +0 -1158
  176. data/test/cron_test.rb +0 -113
  177. data/test/cronline_test.rb +0 -60
  178. data/test/dollar_test.rb +0 -90
  179. data/test/kotoba_test.rb +0 -72
  180. data/test/lru_test.rb +0 -79
  181. data/test/safely_test.rb +0 -84
  182. data/test/scheduler_1_test.rb +0 -88
  183. data/test/scheduler_test.rb +0 -363
  184. data/test/time_test.rb +0 -84
@@ -37,26 +37,11 @@ class FlowTest39 < Test::Unit::TestCase
37
37
  dotest TestReserve39a0, "ok", true
38
38
  end
39
39
 
40
-
41
40
  #
42
41
  # Test 1
43
42
  #
44
-
45
- class TestReserve39a1 < ProcessDefinition
46
- sequence do
47
- reserve :mutex => :toto do
48
- _print "${r:'${toto}' != ''}"
49
- end
50
- _print "${r:'${toto}' == ''}"
51
- _print "over."
52
- end
53
- end
54
-
55
- def test_1
56
-
57
- dotest TestReserve39a1, "true\ntrue\nover.", true
58
- end
59
-
43
+
44
+ # became obsolete
60
45
 
61
46
  #
62
47
  # Test 2
@@ -74,7 +59,7 @@ class FlowTest39 < Test::Unit::TestCase
74
59
  end
75
60
 
76
61
  def test_3
77
- dotest(TestReserve39a3, "", true)
62
+ dotest TestReserve39a3, "", true
78
63
  end
79
64
 
80
65
  end
@@ -30,13 +30,13 @@ class FlowTest39b < Test::Unit::TestCase
30
30
  # doesn't prove it enough though...
31
31
  #
32
32
  concurrence do
33
- reserve :mutex => :toto, :frequency => "500" do
33
+ reserve :mutex => :toto do
34
34
  sequence do
35
35
  test_alpha
36
36
  test_bravo
37
37
  end
38
38
  end
39
- reserve :mutex => :toto, :frequency => "500" do
39
+ reserve :mutex => :toto do
40
40
  sequence do
41
41
  test_charly
42
42
  test_delta
@@ -45,7 +45,9 @@ class FlowTest39b < Test::Unit::TestCase
45
45
  end
46
46
  end
47
47
 
48
- def test_2
48
+ def test_0
49
+
50
+ #log_level_to_debug
49
51
 
50
52
  dotest(
51
53
  TestReserve39b0,
@@ -62,8 +64,35 @@ test-bravo
62
64
  test-charly
63
65
  test-delta
64
66
  """.strip
65
- ],
66
- 3)
67
+ ])
68
+ end
69
+
70
+ #
71
+ # Test 1
72
+ #
73
+
74
+ class TestReserve39b1 < ProcessDefinition
75
+ concurrence do
76
+ reserve :mutex => :toto do
77
+ test_b
78
+ end
79
+ sequence do
80
+ reserve :mutex => :toto do
81
+ test_c
82
+ end
83
+ reserve :mutex => :toto do
84
+ test_d
85
+ end
86
+ end
87
+ end
88
+ end
89
+
90
+ def test_1
91
+
92
+ dotest TestReserve39b1, "test-b\ntest-c\ntest-d"
93
+ #
94
+ # currently the only combination produced, could change
95
+ # with later versions of Ruby...
67
96
  end
68
97
 
69
98
  end
@@ -0,0 +1,83 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Wed Jan 9 22:52:06 JST 2008
8
+ #
9
+
10
+ require 'flowtestbase'
11
+
12
+
13
+ class FlowTest3b < Test::Unit::TestCase
14
+ include FlowTestBase
15
+
16
+ #def setup
17
+ #end
18
+
19
+ #def teardown
20
+ #end
21
+
22
+ class Def0 < OpenWFE::ProcessDefinition
23
+ sequence do
24
+
25
+ # variable
26
+
27
+ set :v => "v0", :val => "val0"
28
+
29
+ equals :variable => "v0", :other_value => "val0"
30
+ _print "${f:__result__}"
31
+
32
+ equals :variable_value => "v0", :other_value => "val0"
33
+ _print "${f:__result__}"
34
+
35
+ equals :var_value => "v0", :other_value => "val0"
36
+ _print "${f:__result__}"
37
+
38
+ equals :v_value => "v0", :other_value => "val0"
39
+ _print "${f:__result__}"
40
+
41
+ equals :var => "v0", :other_value => "val0"
42
+ _print "${f:__result__}"
43
+
44
+ equals :v => "v0", :other_value => "val0"
45
+ _print "${f:__result__}"
46
+
47
+ equals :v => "v0", :other_val => "val0"
48
+ _print "${f:__result__}"
49
+
50
+ equals :val => "val0", :other_val => "val0"
51
+ _print "${f:__result__}"
52
+
53
+ # field
54
+
55
+ set :f => "f0", :val => "f_val0"
56
+
57
+ equals :field_value => "f0", :other_value => "f_val0"
58
+ _print "${f:__result__}"
59
+
60
+ equals :f_value => "f0", :other_value => "f_val0"
61
+ _print "${f:__result__}"
62
+
63
+ equals :field => "f0", :other_value => "f_val0"
64
+ _print "${f:__result__}"
65
+
66
+ equals :field => "f0", :value => "f_val0"
67
+ _print "${f:__result__}"
68
+
69
+ equals :f => "f0", :other_value => "f_val0"
70
+ _print "${f:__result__}"
71
+
72
+ # damn, I could use a Rufus subprocess... but it's 11pm...
73
+ # copy, paste is just fine for a test...
74
+ end
75
+ end
76
+
77
+ def test_0
78
+
79
+ dotest Def0, ([ "true" ] * 13).join("\n")
80
+ end
81
+
82
+ end
83
+
@@ -54,19 +54,10 @@ class FlowTest40 < Test::Unit::TestCase
54
54
  end
55
55
 
56
56
  def test_0
57
+
57
58
  dotest(
58
59
  TestDefined40a0,
59
- """
60
- false
61
- true
62
- true
63
- true
64
- false
65
- true
66
- false
67
- true
68
- """.strip,
69
- true)
60
+ %w{ false true true true false true false true }.join("\n"))
70
61
  end
71
62
 
72
63
  end
@@ -39,11 +39,9 @@ class FlowTest42 < Test::Unit::TestCase
39
39
  end
40
40
  end
41
41
 
42
- #def xxxx_0
43
42
  def test_0
44
- dotest(
45
- TestCase42a0,
46
- [ "v:b", "v:c" ])
43
+
44
+ dotest TestCase42a0, [ "v:b", "v:c" ]
47
45
  end
48
46
 
49
47
 
@@ -67,8 +65,8 @@ class FlowTest42 < Test::Unit::TestCase
67
65
  end
68
66
  end
69
67
 
70
- def xxxx_1
71
- #def test_1
68
+ def _test_1
69
+
72
70
  dotest(
73
71
  TestCase42a1,
74
72
  "v:d",
@@ -37,7 +37,6 @@ class FlowTest44b < Test::Unit::TestCase
37
37
  end
38
38
  end
39
39
 
40
- #def xxxx_0
41
40
  def test_0
42
41
  dotest(
43
42
  TestCase44b0,
@@ -65,14 +64,9 @@ v
65
64
  end
66
65
  end
67
66
 
68
- #def xxxx_1
69
67
  def test_1
70
- dotest(
71
- TestCase44b1,
72
- """
73
- field_value_x
74
- field_value
75
- """.strip)
68
+
69
+ dotest TestCase44b1, "field_value_x\nfield_value"
76
70
  end
77
71
 
78
72
 
@@ -113,14 +107,9 @@ field_value
113
107
  end
114
108
  end
115
109
 
116
- #def xxxx_3
117
110
  def test_3
118
- dotest(
119
- TestCase44b3,
120
- """
121
- value_aa
122
- value_b
123
- """.strip)
111
+
112
+ dotest TestCase44b3, "value_aa\nvalue_b"
124
113
  end
125
114
 
126
115
 
@@ -141,14 +130,91 @@ value_b
141
130
  end
142
131
  end
143
132
 
144
- #def xxxx_4
145
133
  def test_4
146
- dotest(
147
- TestCase44b4,
148
- """
149
- value_a
150
- value_b
151
- """.strip)
134
+
135
+ dotest TestCase44b4, "value_a\nvalue_b"
136
+ end
137
+
138
+ # tests about set_fields...
139
+
140
+ #
141
+ # Test 5
142
+ #
143
+
144
+ class Test44b5 < ProcessDefinition
145
+ sequence do
146
+ set_fields :value => {
147
+ "customer" => { "name" => "Zigue", "age" => 34 },
148
+ "approved" => false }
149
+ _print "${f:customer.name} (${f:customer.age}) ${f:approved}"
150
+ #pp_fields
151
+ end
152
+ end
153
+
154
+ def test_5
155
+
156
+ dotest Test44b5, "Zigue (34) false"
157
+ end
158
+
159
+ #
160
+ # Test 6
161
+ #
162
+
163
+ class Test44b6 < ProcessDefinition
164
+ set_fields :value => {
165
+ "customer" => { "name" => "Zigue", "age" => 34 },
166
+ "approved" => false }
167
+ sequence do
168
+ _print "${f:customer.name} (${f:customer.age}) ${f:approved}"
169
+ end
170
+ end
171
+
172
+ def test_6
173
+
174
+ dotest Test44b6, "Zigue (34) false"
175
+ end
176
+
177
+ #
178
+ # Test 7
179
+ #
180
+
181
+ # not yet
182
+
183
+ class Test44b7 < ProcessDefinition
184
+ set_fields do
185
+ {
186
+ "customer" => { "name" => "Zigue", "age" => 34 },
187
+ "approved" => false
188
+ }
189
+ end
190
+ sequence do
191
+ _print "${f:customer.name} (${f:customer.age}) ${f:approved}"
192
+ end
193
+ end
194
+
195
+ def _test_7
196
+
197
+ dotest Test44b7, "Zigue (34) false"
198
+ end
199
+
200
+ #
201
+ # Test 8
202
+ #
203
+
204
+ class Test44b8 < ProcessDefinition
205
+ set_fields :value => {
206
+ "customer" => { "name" => "Zigue", "age" => 34 },
207
+ "approved" => false }, :merge_lead => :current
208
+ sequence do
209
+ _print "${f:customer.name} (${f:customer.age}) ${f:approved}"
210
+ end
211
+ end
212
+
213
+ def test_8
214
+
215
+ li = LaunchItem.new Test44b8
216
+ li.approved = true
217
+ dotest li, "Zigue (34) true"
152
218
  end
153
219
 
154
220
  end
@@ -34,7 +34,6 @@ class FlowTest45 < Test::Unit::TestCase
34
34
  end
35
35
  end
36
36
 
37
- #def xxxx_0
38
37
  def test_0
39
38
  dotest(
40
39
  TestCase45a0,
@@ -65,7 +64,6 @@ done.
65
64
  end
66
65
  end
67
66
 
68
- #def xxxx_1
69
67
  def test_1
70
68
  dotest(
71
69
  TestCase45a1,
@@ -101,8 +99,7 @@ done.
101
99
 
102
100
  # test 'parked' for now
103
101
 
104
- def xxxx_2
105
- #def test_2
102
+ def _test_2
106
103
  dotest(
107
104
  TestCase45a2,
108
105
  """
@@ -126,15 +123,64 @@ done.
126
123
  end
127
124
  end
128
125
 
129
- # test 'parked' for now
130
-
131
- #def xxxx_3
132
126
  def test_3
127
+ dotest TestCase45a3, "done."
128
+ end
129
+
130
+
131
+ #
132
+ # Test 4
133
+ #
134
+
135
+ class TestCase45a4 < ProcessDefinition
136
+ sequence do
137
+ concurrent_iterator :on => "a, b, c", :to_field => "f" do
138
+ _print "${f:f}"
139
+ end
140
+ set :var => "v", :value => "1, 2"
141
+ concurrent_iterator :on_variable_value => "v", :to_field => "f" do
142
+ _print "${f:f}"
143
+ end
144
+ concurrent_iterator :on_var_value => "v", :to_field => "f" do
145
+ _print "${f:f}"
146
+ end
147
+ concurrent_iterator :on_var => "v", :to_field => "f" do
148
+ _print "${f:f}"
149
+ end
150
+ _print "done."
151
+ end
152
+ end
153
+
154
+ def test_4
155
+
133
156
  dotest(
134
- TestCase45a3,
135
- """
136
- done.
137
- """.strip)
157
+ TestCase45a4,
158
+ %w{ a b c 1 2 1 2 1 2 }.join("\n") + "\ndone.")
159
+ end
160
+
161
+
162
+ #
163
+ # Test 5
164
+ #
165
+
166
+ class TestCase45a5 < ProcessDefinition
167
+ sequence do
168
+ set :f => "f0", :value => "1, 2"
169
+ concurrent_iterator :on_f => "f0", :to_field => "f" do
170
+ _print "${f:f}"
171
+ end
172
+ concurrent_iterator :on_f => :f0, :to_field => "f" do
173
+ _print "${f:f}"
174
+ end
175
+ _print "done."
176
+ end
177
+ end
178
+
179
+ def test_5
180
+
181
+ dotest(
182
+ TestCase45a5,
183
+ %w{ 1 2 1 2 }.join("\n") + "\ndone.")
138
184
  end
139
185
 
140
186
  end