openwferu 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/about_state.rb +81 -0
- data/examples/engine_template.rb +7 -0
- data/lib/openwfe/contextual.rb +2 -2
- data/lib/openwfe/def.rb +2 -3
- data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
- data/lib/openwfe/engine/engine.rb +202 -251
- data/lib/openwfe/engine/process_status.rb +359 -0
- data/lib/openwfe/expool/errorjournal.rb +6 -6
- data/lib/openwfe/expool/expressionpool.rb +161 -239
- data/lib/openwfe/expool/expstorage.rb +185 -55
- data/lib/openwfe/expool/journal.rb +1 -2
- data/lib/openwfe/expool/parser.rb +233 -0
- data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
- data/lib/openwfe/expool/wfidgen.rb +25 -7
- data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
- data/lib/openwfe/expressions/condition.rb +49 -12
- data/lib/openwfe/expressions/environment.rb +45 -15
- data/lib/openwfe/expressions/expressionmap.rb +39 -19
- data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
- data/lib/openwfe/expressions/fe_cron.rb +19 -18
- data/lib/openwfe/expressions/fe_cursor.rb +69 -28
- data/lib/openwfe/expressions/fe_define.rb +4 -1
- data/lib/openwfe/expressions/fe_do.rb +1 -3
- data/lib/openwfe/expressions/fe_equals.rb +131 -20
- data/lib/openwfe/expressions/fe_fqv.rb +27 -3
- data/lib/openwfe/expressions/fe_iterator.rb +14 -7
- data/lib/openwfe/expressions/fe_listen.rb +7 -2
- data/lib/openwfe/expressions/fe_misc.rb +187 -20
- data/lib/openwfe/expressions/fe_participant.rb +8 -7
- data/lib/openwfe/expressions/fe_reserve.rb +105 -33
- data/lib/openwfe/expressions/fe_save.rb +55 -5
- data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
- data/lib/openwfe/expressions/fe_sleep.rb +25 -15
- data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
- data/lib/openwfe/expressions/fe_wait.rb +3 -2
- data/lib/openwfe/expressions/fe_when.rb +7 -15
- data/lib/openwfe/expressions/flowexpression.rb +90 -49
- data/lib/openwfe/expressions/merge.rb +7 -1
- data/lib/openwfe/expressions/raw.rb +261 -63
- data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
- data/lib/openwfe/expressions/time.rb +36 -12
- data/lib/openwfe/expressions/timeout.rb +9 -7
- data/lib/openwfe/expressions/value.rb +126 -0
- data/lib/openwfe/flowexpressionid.rb +52 -22
- data/lib/openwfe/listeners/listeners.rb +3 -3
- data/lib/openwfe/listeners/socketlisteners.rb +8 -5
- data/lib/openwfe/logging.rb +6 -3
- data/lib/openwfe/omixins.rb +8 -6
- data/lib/openwfe/orest/xmlcodec.rb +16 -12
- data/lib/openwfe/participants.rb +38 -0
- data/lib/openwfe/participants/participant.rb +1 -1
- data/lib/openwfe/participants/participantmap.rb +24 -10
- data/lib/openwfe/participants/participants.rb +4 -3
- data/lib/openwfe/participants/soapparticipants.rb +1 -1
- data/lib/openwfe/participants/socketparticipants.rb +1 -1
- data/lib/openwfe/rudefinitions.rb +7 -5
- data/lib/openwfe/storage/yamlcustom.rb +10 -10
- data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
- data/lib/openwfe/tools/flowtracer.rb +6 -5
- data/lib/openwfe/util/dollar.rb +42 -85
- data/lib/openwfe/util/ometa.rb +1 -3
- data/lib/openwfe/util/workqueue.rb +1 -1
- data/lib/openwfe/utils.rb +33 -11
- data/lib/openwfe/version.rb +2 -2
- data/lib/openwfe/workitem.rb +76 -14
- data/lib/openwfe/worklist/storelocks.rb +9 -4
- data/lib/openwfe/worklist/storeparticipant.rb +1 -1
- data/test/back_0916_test.rb +101 -0
- data/test/bm/ft_26_load.rb +1 -1
- data/test/bm/ft_26b_load.rb +1 -1
- data/test/bm/ft_26c_load.rb +3 -2
- data/test/bm/ft_26d_load.rb +97 -0
- data/test/bm/ft_recu.rb +71 -0
- data/test/concurrence_test.rb +1 -1
- data/test/condition_test.rb +152 -0
- data/test/description_test.rb +12 -7
- data/test/eno_test.rb +1 -1
- data/test/expool_20031219_0916.tgz +0 -0
- data/test/fe_lookup_att_test.rb +1 -1
- data/test/fei_test.rb +16 -0
- data/test/file_persistence_test.rb +8 -12
- data/test/filep_cancel_test.rb +116 -0
- data/test/flowtestbase.rb +47 -25
- data/test/ft_0.rb +1 -1
- data/test/ft_10_loop.rb +29 -14
- data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
- data/test/ft_11_ppd.rb +6 -17
- data/test/ft_11b_ppd.rb +1 -4
- data/test/ft_12_blockparticipant.rb +1 -1
- data/test/ft_13_eno.rb +1 -1
- data/test/ft_15_iterator.rb +1 -1
- data/test/ft_15b_iterator.rb +1 -1
- data/test/ft_17_condition.rb +6 -6
- data/test/ft_18_pname.rb +1 -1
- data/test/ft_20_cron.rb +1 -1
- data/test/ft_21_cron.rb +6 -4
- data/test/ft_22_history.rb +1 -1
- data/test/ft_23_when.rb +1 -1
- data/test/ft_23b_when.rb +18 -6
- data/test/ft_23c_wait.rb +8 -6
- data/test/ft_25_cancel.rb +7 -5
- data/test/ft_27_getflowpos.rb +22 -17
- data/test/ft_28_fileparticipant.rb +1 -2
- data/test/ft_2_concurrence.rb +1 -1
- data/test/ft_2b_concurrence.rb +25 -20
- data/test/ft_30_socketlistener.rb +0 -3
- data/test/ft_34_cancelwfid.rb +9 -9
- data/test/ft_35_localdefs.rb +0 -1
- data/test/ft_36_subprocids.rb +6 -6
- data/test/ft_38_tag.rb +3 -2
- data/test/ft_38b_tag.rb +229 -0
- data/test/ft_39_reserve.rb +3 -18
- data/test/ft_39b_reserve.rb +34 -5
- data/test/ft_3b_lookup_vf.rb +83 -0
- data/test/ft_40_defined.rb +2 -11
- data/test/ft_42_environments.rb +4 -6
- data/test/ft_44b_restore.rb +88 -22
- data/test/ft_45_citerator.rb +57 -11
- data/test/ft_49_condition.rb +4 -2
- data/test/ft_4_misc.rb +24 -3
- data/test/ft_50_xml_attribute.rb +17 -20
- data/test/ft_54_listen.rb +1 -1
- data/test/ft_54b_listen.rb +2 -2
- data/test/ft_56_timeout.rb +8 -1
- data/test/ft_57_a.rb +10 -10
- data/test/ft_59_ps.rb +49 -16
- data/test/ft_60_ecancel.rb +52 -10
- data/test/ft_63_pause.rb +8 -8
- data/test/ft_65_stringlaunch.rb +4 -6
- data/test/ft_67_schedlaunch.rb +4 -4
- data/test/ft_69_cancelmissing.rb +4 -2
- data/test/ft_70_lookupvar.rb +2 -2
- data/test/ft_72_lookup_processes.rb +2 -2
- data/test/ft_73_cancel_sub.rb +8 -8
- data/test/ft_77_segments.rb +38 -0
- data/test/ft_78_eval.rb +154 -0
- data/test/ft_79_tticket.rb +185 -0
- data/test/ft_80_spname.rb +95 -0
- data/test/ft_81_exp.rb +64 -0
- data/test/ft_82_trecu.rb +48 -0
- data/test/ft_83_badpause.rb +62 -0
- data/test/ft_84_updateexp.rb +125 -0
- data/test/ft_9b_cursor.rb +105 -0
- data/test/ft_tests.rb +14 -1
- data/test/hash_test.rb +7 -7
- data/test/hparticipant_test.rb +4 -4
- data/test/lookup_vf_test.rb +94 -0
- data/test/misc_test.rb +5 -3
- data/test/orest_test.rb +4 -3
- data/test/param_test.rb +12 -16
- data/test/participant_test.rb +36 -0
- data/test/pending.rb +10 -10
- data/test/rake_ltest.rb +1 -10
- data/test/rake_qtest.rb +7 -6
- data/test/raw_prog_test.rb +89 -121
- data/test/restart_cron_test.rb +84 -36
- data/test/restart_paused_test.rb +100 -0
- data/test/restart_sleep_test.rb +1 -1
- data/test/restart_tests.rb +1 -0
- data/test/restart_when_test.rb +33 -22
- data/test/ruby_procdef_test.rb +19 -18
- data/test/sec_test.rb +74 -35
- data/test/storage_test.rb +44 -0
- data/test/test.rb +3 -0
- data/test/timeout_test.rb +7 -18
- data/test/wfid_test.rb +2 -1
- data/test/wi_test.rb +29 -18
- metadata +121 -57
- data/lib/openwfe/expressions/raw_xml.rb +0 -176
- data/lib/openwfe/expressions/simplerep.rb +0 -266
- data/lib/openwfe/util/kotoba.rb +0 -236
- data/lib/openwfe/util/lru.rb +0 -171
- data/lib/openwfe/util/otime.rb +0 -246
- data/lib/openwfe/util/safe.rb +0 -160
- data/lib/openwfe/util/scheduler.rb +0 -1158
- data/test/cron_test.rb +0 -113
- data/test/cronline_test.rb +0 -60
- data/test/dollar_test.rb +0 -90
- data/test/kotoba_test.rb +0 -72
- data/test/lru_test.rb +0 -79
- data/test/safely_test.rb +0 -84
- data/test/scheduler_1_test.rb +0 -88
- data/test/scheduler_test.rb +0 -363
- data/test/time_test.rb +0 -84
data/test/rake_qtest.rb
CHANGED
@@ -6,30 +6,31 @@
|
|
6
6
|
# Mon Oct 9 22:19:44 JST 2006
|
7
7
|
#
|
8
8
|
|
9
|
+
require 'rubygems'
|
10
|
+
|
11
|
+
|
9
12
|
require 'fei_test'
|
10
13
|
require 'wfid_test'
|
11
14
|
require 'wi_test'
|
12
15
|
require 'lookup_att_test'
|
13
16
|
require 'filter_test'
|
14
|
-
require 'dollar_test'
|
15
17
|
require 'misc_test'
|
18
|
+
require 'condition_test'
|
16
19
|
require 'hash_test'
|
17
|
-
require 'lru_test'
|
18
|
-
require 'time_test'
|
19
20
|
require 'raw_prog_test'
|
20
21
|
require 'file_persistence_test'
|
21
|
-
require 'cronline_test'
|
22
|
-
require 'safely_test'
|
23
|
-
require 'kotoba_test'
|
24
22
|
require 'expmap_test'
|
25
23
|
require 'obs_test'
|
26
24
|
require 'clone_test'
|
25
|
+
require 'lookup_vf_test'
|
27
26
|
require 'fe_lookup_att_test'
|
28
27
|
|
29
28
|
require 'sec_test'
|
30
29
|
require 'param_test'
|
31
30
|
|
31
|
+
require 'storage_test'
|
32
32
|
require 'file_persisted_engine_test'
|
33
|
+
require 'filep_cancel_test'
|
33
34
|
require 'ruby_procdef_test'
|
34
35
|
require 'description_test'
|
35
36
|
|
data/test/raw_prog_test.rb
CHANGED
@@ -8,27 +8,25 @@
|
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'test/unit'
|
11
|
-
require 'openwfe/
|
11
|
+
require 'openwfe/def'
|
12
|
+
require 'openwfe/expool/parser'
|
12
13
|
|
13
14
|
|
14
15
|
class RawProgTest < Test::Unit::TestCase
|
15
16
|
|
16
|
-
DEBUG = false
|
17
|
-
|
18
17
|
#def setup
|
19
18
|
#end
|
20
19
|
|
21
20
|
#def teardown
|
22
21
|
#end
|
23
22
|
|
24
|
-
XML_DEF =
|
25
|
-
<process-definition name='test0' revision='0'>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
</process-definition>"
|
31
|
-
|
23
|
+
XML_DEF =
|
24
|
+
"<process-definition name='test0' revision='0'>"+
|
25
|
+
"<sequence>"+
|
26
|
+
"<participant ref='a'/>"+
|
27
|
+
"<participant ref='b'/>"+
|
28
|
+
"</sequence>"+
|
29
|
+
"</process-definition>"
|
32
30
|
|
33
31
|
#
|
34
32
|
# TEST 0
|
@@ -47,24 +45,17 @@ class RawProgTest < Test::Unit::TestCase
|
|
47
45
|
|
48
46
|
def test_prog_0
|
49
47
|
|
50
|
-
s = TestDefinition.new
|
48
|
+
s = OpenWFE::ExpressionTree.to_s(TestDefinition.new.make)
|
51
49
|
|
52
|
-
|
53
|
-
|
54
|
-
assert \
|
55
|
-
s == XML_DEF,
|
56
|
-
"parsing failed (0)"
|
50
|
+
assert_equal XML_DEF, s
|
57
51
|
end
|
58
52
|
|
59
53
|
def test_prog_0b
|
60
54
|
|
61
|
-
s = TestDefinition.do_make.to_s
|
62
|
-
|
63
|
-
puts s if DEBUG
|
55
|
+
#s = TestDefinition.do_make.to_s
|
56
|
+
s = OpenWFE::ExpressionTree.to_s(TestDefinition.do_make)
|
64
57
|
|
65
|
-
|
66
|
-
s == XML_DEF,
|
67
|
-
"parsing failed (0b)"
|
58
|
+
assert_equal XML_DEF, s
|
68
59
|
end
|
69
60
|
|
70
61
|
|
@@ -74,7 +65,7 @@ class RawProgTest < Test::Unit::TestCase
|
|
74
65
|
|
75
66
|
def test_prog_1
|
76
67
|
|
77
|
-
pg = OpenWFE::ProcessDefinition.new
|
68
|
+
pg = OpenWFE::ProcessDefinition.new
|
78
69
|
|
79
70
|
class << pg
|
80
71
|
def my_proc
|
@@ -89,11 +80,7 @@ class RawProgTest < Test::Unit::TestCase
|
|
89
80
|
pdef = pg.my_proc
|
90
81
|
s = pdef.to_s
|
91
82
|
|
92
|
-
|
93
|
-
|
94
|
-
assert \
|
95
|
-
s == XML_DEF,
|
96
|
-
"parsing failed (1)"
|
83
|
+
assert XML_DEF, s
|
97
84
|
end
|
98
85
|
|
99
86
|
|
@@ -114,23 +101,21 @@ class RawProgTest < Test::Unit::TestCase
|
|
114
101
|
end
|
115
102
|
end
|
116
103
|
|
117
|
-
XML_DEF2 =
|
118
|
-
<process-definition name='test2' revision='0'>
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
104
|
+
XML_DEF2 =
|
105
|
+
"<process-definition name='test2' revision='0'>"+
|
106
|
+
"<sequence>"+
|
107
|
+
"<set field='toto'>"+
|
108
|
+
"nada"+
|
109
|
+
"</set>"+
|
110
|
+
"<participant ref='b'/>"+
|
111
|
+
"</sequence>"+
|
112
|
+
"</process-definition>"
|
124
113
|
|
125
114
|
def test_prog_2
|
126
115
|
|
127
|
-
s = TestDefinition2.do_make
|
128
|
-
|
129
|
-
puts s if DEBUG
|
116
|
+
s = OpenWFE::ExpressionTree.to_s(TestDefinition2.do_make)
|
130
117
|
|
131
|
-
|
132
|
-
s == XML_DEF2,
|
133
|
-
"parsing failed (2)"
|
118
|
+
assert_equal XML_DEF2, s
|
134
119
|
|
135
120
|
#puts
|
136
121
|
#puts TestDefinition2.do_make.to_code_s
|
@@ -152,13 +137,13 @@ class RawProgTest < Test::Unit::TestCase
|
|
152
137
|
end
|
153
138
|
end
|
154
139
|
|
155
|
-
XML_DEF3 =
|
156
|
-
<process-definition name='test3' revision='0'>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
</process-definition>"
|
140
|
+
XML_DEF3 =
|
141
|
+
"<process-definition name='test3' revision='0'>"+
|
142
|
+
"<if>"+
|
143
|
+
"<equals field-value='nada' other-value='surf'/>"+
|
144
|
+
"<participant ref='b'/>"+
|
145
|
+
"</if>"+
|
146
|
+
"</process-definition>"
|
162
147
|
|
163
148
|
CODE_DEF3 = """
|
164
149
|
process_definition :name => 'test3', :revision => '0' do
|
@@ -170,26 +155,18 @@ end""".strip
|
|
170
155
|
|
171
156
|
def test_prog_3
|
172
157
|
|
173
|
-
s = TestDefinition3.do_make
|
174
|
-
|
175
|
-
puts s if DEBUG
|
176
|
-
|
177
|
-
assert \
|
178
|
-
s == XML_DEF3,
|
179
|
-
"parsing failed (3)"
|
158
|
+
s = OpenWFE::ExpressionTree.to_s(TestDefinition3.do_make)
|
180
159
|
|
181
|
-
|
182
|
-
#puts TestDefinition3.do_make.to_code_s
|
160
|
+
assert_equal XML_DEF3, s
|
183
161
|
|
184
|
-
|
185
|
-
|
186
|
-
|
162
|
+
assert_equal(
|
163
|
+
CODE_DEF3,
|
164
|
+
OpenWFE::ExpressionTree.to_code_s(TestDefinition3.do_make))
|
187
165
|
|
188
|
-
r = OpenWFE::SimpleExpRepresentation.from_xml(s)
|
189
|
-
|
190
|
-
#puts r.to_code_s
|
166
|
+
#r = OpenWFE::SimpleExpRepresentation.from_xml(s)
|
167
|
+
r = OpenWFE::DefParser.parse_xml s
|
191
168
|
|
192
|
-
assert_equal
|
169
|
+
assert_equal CODE_DEF3, OpenWFE::ExpressionTree.to_code_s(r)
|
193
170
|
end
|
194
171
|
|
195
172
|
|
@@ -223,9 +200,9 @@ end""".strip
|
|
223
200
|
#puts
|
224
201
|
#puts TestDefinition4.do_make.to_code_s
|
225
202
|
|
226
|
-
|
227
|
-
|
228
|
-
|
203
|
+
assert_equal(
|
204
|
+
CODE_DEF4,
|
205
|
+
OpenWFE::ExpressionTree.to_code_s(TestDefinition4.do_make))
|
229
206
|
end
|
230
207
|
|
231
208
|
|
@@ -244,7 +221,7 @@ end""".strip
|
|
244
221
|
end
|
245
222
|
|
246
223
|
CODE_DEF4b = """
|
247
|
-
process_definition :name => '
|
224
|
+
process_definition :name => 'Test', :revision => '4b' do
|
248
225
|
sequence do
|
249
226
|
participant do
|
250
227
|
'b'
|
@@ -260,14 +237,9 @@ end""".strip
|
|
260
237
|
|
261
238
|
def test_prog_4b
|
262
239
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
#puts TestDefinition4b.do_make.to_code_s
|
267
|
-
|
268
|
-
assert \
|
269
|
-
TestDefinition4b.do_make.to_code_s == CODE_DEF4b,
|
270
|
-
"to_code_s() not working properly (4b)"
|
240
|
+
assert_equal(
|
241
|
+
CODE_DEF4b,
|
242
|
+
OpenWFE::ExpressionTree.to_code_s(TestDefinition4b.do_make))
|
271
243
|
end
|
272
244
|
|
273
245
|
|
@@ -300,14 +272,9 @@ end""".strip
|
|
300
272
|
|
301
273
|
def test_prog_5
|
302
274
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
#puts TestDefinition5.do_make.to_code_s
|
307
|
-
|
308
|
-
assert \
|
309
|
-
TestDefinition5.do_make.to_code_s == CODE_DEF5,
|
310
|
-
"to_code_s() not working properly (5)"
|
275
|
+
assert_equal(
|
276
|
+
CODE_DEF5,
|
277
|
+
OpenWFE::ExpressionTree.to_code_s(TestDefinition5.do_make))
|
311
278
|
end
|
312
279
|
|
313
280
|
|
@@ -334,14 +301,9 @@ end""".strip
|
|
334
301
|
|
335
302
|
def test_prog_6
|
336
303
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
#puts TestDefinition60.do_make.to_code_s
|
341
|
-
|
342
|
-
assert \
|
343
|
-
TestDefinition60.do_make.to_code_s == CODE_DEF6,
|
344
|
-
"to_code_s() not working properly (6)"
|
304
|
+
assert_equal(
|
305
|
+
CODE_DEF6,
|
306
|
+
OpenWFE::ExpressionTree.to_code_s(TestDefinition60.do_make))
|
345
307
|
end
|
346
308
|
|
347
309
|
|
@@ -362,29 +324,29 @@ end""".strip
|
|
362
324
|
|
363
325
|
A_DEF7 = [
|
364
326
|
"process-definition",
|
365
|
-
{"name"=>"TestDefinitionSeven", "revision"=>"0"},
|
366
|
-
[
|
367
|
-
["participant", {"ref"=>:toto}, []]
|
368
|
-
]
|
327
|
+
{ "name"=>"TestDefinitionSeven", "revision"=>"0" },
|
328
|
+
[ [ "participant", { "ref" => :toto }, [] ] ]
|
369
329
|
]
|
370
330
|
|
371
331
|
def test_prog_7
|
372
332
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
#puts TestDefinition7.do_make.to_code_s
|
377
|
-
|
378
|
-
assert_equal TestDefinitionSeven.do_make.to_code_s, CODE_DEF7
|
333
|
+
assert_equal(
|
334
|
+
CODE_DEF7,
|
335
|
+
OpenWFE::ExpressionTree.to_code_s(TestDefinitionSeven.do_make))
|
379
336
|
|
380
|
-
assert_equal
|
337
|
+
assert_equal(
|
338
|
+
A_DEF7,
|
339
|
+
TestDefinitionSeven.do_make)
|
381
340
|
end
|
382
341
|
|
383
342
|
#
|
384
343
|
# TEST 8
|
385
344
|
#
|
386
345
|
|
387
|
-
def do_test(class_name, pdef)
|
346
|
+
def do_test (class_name, pdef)
|
347
|
+
#
|
348
|
+
# losing my time with an eval
|
349
|
+
#
|
388
350
|
result = eval """
|
389
351
|
class #{class_name} < OpenWFE::ProcessDefinition
|
390
352
|
def make
|
@@ -393,15 +355,29 @@ end""".strip
|
|
393
355
|
end
|
394
356
|
#{class_name}.do_make
|
395
357
|
"""
|
396
|
-
assert_equal result
|
397
|
-
assert_equal result
|
358
|
+
assert_equal result[1]['name'], pdef[0]
|
359
|
+
assert_equal result[1]['revision'], pdef[1]
|
398
360
|
end
|
399
361
|
|
400
362
|
def test_process_names
|
401
|
-
|
402
|
-
do_test
|
403
|
-
do_test
|
404
|
-
do_test
|
363
|
+
|
364
|
+
do_test "MyProcessDefinition_10", ["MyProcess", "10"]
|
365
|
+
do_test "MyProcessDefinition10", ["MyProcess", "10"]
|
366
|
+
do_test "MyProcessDefinition1_0", ["MyProcess", "1.0"]
|
367
|
+
do_test "MyProcessThing_1_0", ["MyProcessThing", "1.0"]
|
368
|
+
end
|
369
|
+
|
370
|
+
def do_test_2 (raw_name, expected)
|
371
|
+
|
372
|
+
assert_equal(
|
373
|
+
expected,
|
374
|
+
OpenWFE::ProcessDefinition.extract_name_and_revision(raw_name))
|
375
|
+
end
|
376
|
+
|
377
|
+
def test_process_names_2
|
378
|
+
|
379
|
+
do_test_2 "MyProcessDefinition_10", ["MyProcess", "10"]
|
380
|
+
do_test_2 "MyProcessDefinition5b", ["MyProcess", "5b"]
|
405
381
|
end
|
406
382
|
|
407
383
|
|
@@ -427,17 +403,9 @@ process_definition :name => 'Test', :revision => '60' do
|
|
427
403
|
end
|
428
404
|
end""".strip
|
429
405
|
|
430
|
-
def
|
431
|
-
#def test_prog_9
|
432
|
-
|
433
|
-
#puts
|
434
|
-
#puts TestDefinition60.do_make.to_s
|
435
|
-
puts
|
436
|
-
puts TestDefinition9.do_make.to_code_s
|
406
|
+
def _test_prog_9
|
437
407
|
|
438
|
-
assert
|
439
|
-
TestDefinition9.do_make.to_code_s == CODE_DEF9,
|
440
|
-
"to_code_s() not working properly (9)"
|
408
|
+
assert CODE_DEF9, TestDefinition9.do_make.to_code_s
|
441
409
|
end
|
442
410
|
|
443
411
|
end
|
data/test/restart_cron_test.rb
CHANGED
@@ -6,11 +6,15 @@
|
|
6
6
|
# Sun Oct 29 15:41:44 JST 2006
|
7
7
|
#
|
8
8
|
|
9
|
+
require 'rubygems'
|
10
|
+
|
9
11
|
require 'test/unit'
|
10
12
|
|
13
|
+
require 'fileutils'
|
14
|
+
|
11
15
|
require 'openwfe/workitem'
|
12
16
|
require 'openwfe/engine/file_persisted_engine'
|
13
|
-
require 'openwfe/
|
17
|
+
require 'openwfe/def'
|
14
18
|
|
15
19
|
require 'rutest_utils'
|
16
20
|
|
@@ -23,60 +27,104 @@ class RestartCronTest < Test::Unit::TestCase
|
|
23
27
|
# @engine = $WORKFLOW_ENGINE_CLASS.new()
|
24
28
|
#end
|
25
29
|
|
26
|
-
|
27
|
-
|
30
|
+
def teardown
|
31
|
+
FileUtils.rm_rf 'work'
|
32
|
+
end
|
33
|
+
|
34
|
+
# test 0
|
28
35
|
|
29
36
|
class RestartDefinition0 < ProcessDefinition
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
#participant :cron_event_restart
|
34
|
-
cron_event_restart
|
35
|
-
end
|
36
|
-
# end
|
37
|
-
#end
|
37
|
+
cron :tab => "* * * * *", :name => "//mycron" do
|
38
|
+
cron_event_restart
|
39
|
+
end
|
38
40
|
end
|
39
41
|
|
40
|
-
def
|
42
|
+
def test_0
|
43
|
+
|
44
|
+
dotest RestartDefinition0
|
41
45
|
|
42
|
-
|
46
|
+
assert_equal(
|
47
|
+
1, @engine.get_expression_storage.size,
|
48
|
+
"\n\n" + @engine.get_expression_storage.to_s)
|
49
|
+
end
|
43
50
|
|
44
|
-
|
51
|
+
# test 1
|
45
52
|
|
46
|
-
|
47
|
-
|
48
|
-
|
53
|
+
class RestartDefinition1 < ProcessDefinition
|
54
|
+
concurrence do
|
55
|
+
cron :tab => "* * * * *", :name => "mycron" do
|
56
|
+
cron_event_restart
|
57
|
+
end
|
58
|
+
participant :ref => "nada"
|
49
59
|
end
|
50
|
-
|
60
|
+
end
|
51
61
|
|
52
|
-
|
62
|
+
def test_1
|
53
63
|
|
54
|
-
|
64
|
+
dotest RestartDefinition1
|
55
65
|
|
56
|
-
|
66
|
+
assert_equal(
|
67
|
+
6, @engine.get_expression_storage.size,
|
68
|
+
"\n\n" + @engine.get_expression_storage.to_s)
|
69
|
+
end
|
57
70
|
|
58
|
-
|
71
|
+
protected
|
59
72
|
|
60
|
-
|
61
|
-
engine = FilePersistedEngine.new
|
73
|
+
def dotest (definition)
|
62
74
|
|
63
|
-
|
75
|
+
@engine = new_engine
|
64
76
|
|
65
|
-
|
66
|
-
#
|
67
|
-
# very important
|
77
|
+
feis = []
|
68
78
|
|
69
|
-
|
79
|
+
participant = lambda do |wi|
|
80
|
+
feis << wi.fei.dup
|
81
|
+
end
|
82
|
+
@engine.register_participant :cron_event_restart, &participant
|
83
|
+
@engine.register_participant :nada, NullParticipant
|
70
84
|
|
71
|
-
|
85
|
+
@engine.launch definition
|
72
86
|
|
73
|
-
|
87
|
+
sleep 60
|
74
88
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
89
|
+
@engine.stop
|
90
|
+
|
91
|
+
assert_equal 1, @engine.get_scheduler.cron_job_count
|
92
|
+
assert_equal 1, feis.size
|
93
|
+
|
94
|
+
assert_equal ".0", feis[0].wfid[-2, 2]
|
95
|
+
|
96
|
+
#puts "___restarting to new engine"
|
97
|
+
|
98
|
+
#old_engine = @engine
|
99
|
+
new_engine
|
100
|
+
|
101
|
+
@engine.register_participant :cron_event_restart, &participant
|
102
|
+
@engine.register_participant :nada, NullParticipant
|
103
|
+
|
104
|
+
@engine.reload
|
105
|
+
#
|
106
|
+
# very important
|
107
|
+
|
108
|
+
sleep 60
|
109
|
+
|
110
|
+
assert_equal(
|
111
|
+
1, @engine.get_scheduler.cron_job_count, "wrong cron job count")
|
112
|
+
|
113
|
+
@engine.stop
|
114
|
+
|
115
|
+
assert_equal 2, feis.size
|
116
|
+
assert_not_equal feis[0].wfid, feis[1].wfid
|
117
|
+
|
118
|
+
assert feis[0].wfid[-1, 1].to_i < feis[1].wfid[-1, 1].to_i
|
119
|
+
end
|
120
|
+
|
121
|
+
def new_engine
|
122
|
+
|
123
|
+
@engine = FilePersistedEngine.new
|
124
|
+
#engine = CachedFilePersistedEngine.new
|
125
|
+
|
126
|
+
#$OWFE_LOG.level = Logger::DEBUG
|
127
|
+
end
|
80
128
|
|
81
129
|
end
|
82
130
|
|