openwferu 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/bin/validate-workflow.rb +1 -0
  2. data/examples/openwferu.rb +57 -0
  3. data/lib/openwfe/contextual.rb +2 -0
  4. data/lib/openwfe/engine/engine.rb +109 -17
  5. data/lib/openwfe/engine/file_persisted_engine.rb +11 -1
  6. data/lib/openwfe/exceptions.rb +53 -0
  7. data/lib/openwfe/expool/expressionpool.rb +195 -137
  8. data/lib/openwfe/expool/journal.rb +175 -0
  9. data/lib/openwfe/expool/journal_replay.rb +121 -0
  10. data/lib/openwfe/expool/wfidgen.rb +318 -0
  11. data/lib/openwfe/expool/yamlexpstorage.rb +23 -54
  12. data/lib/openwfe/expressions/condition.rb +14 -2
  13. data/lib/openwfe/expressions/environment.rb +47 -37
  14. data/lib/openwfe/expressions/expressionmap.rb +73 -67
  15. data/lib/openwfe/expressions/fe_cancel.rb +2 -0
  16. data/lib/openwfe/expressions/fe_concurrence.rb +14 -1
  17. data/lib/openwfe/expressions/fe_cron.rb +186 -0
  18. data/lib/openwfe/expressions/fe_cursor.rb +6 -0
  19. data/lib/openwfe/expressions/fe_define.rb +2 -0
  20. data/lib/openwfe/expressions/fe_fqv.rb +2 -0
  21. data/lib/openwfe/expressions/fe_iterator.rb +2 -0
  22. data/lib/openwfe/expressions/fe_losfor.rb +4 -0
  23. data/lib/openwfe/expressions/fe_misc.rb +16 -1
  24. data/lib/openwfe/expressions/fe_participant.rb +7 -0
  25. data/lib/openwfe/expressions/fe_raw.rb +125 -8
  26. data/lib/openwfe/expressions/fe_sequence.rb +2 -0
  27. data/lib/openwfe/expressions/fe_sleep.rb +213 -0
  28. data/lib/openwfe/expressions/fe_subprocess.rb +2 -0
  29. data/lib/openwfe/expressions/fe_value.rb +8 -0
  30. data/lib/openwfe/expressions/fe_when.rb +205 -0
  31. data/lib/openwfe/expressions/flowexpression.rb +62 -9
  32. data/lib/openwfe/expressions/raw_prog.rb +147 -45
  33. data/lib/openwfe/expressions/raw_xml.rb +50 -5
  34. data/lib/openwfe/expressions/timeout.rb +32 -5
  35. data/lib/openwfe/flowexpressionid.rb +6 -4
  36. data/lib/openwfe/listeners/listeners.rb +4 -3
  37. data/lib/openwfe/listeners/socketlisteners.rb +30 -4
  38. data/lib/openwfe/logging.rb +9 -1
  39. data/lib/openwfe/participants/participants.rb +9 -9
  40. data/lib/openwfe/participants/socketparticipants.rb +41 -8
  41. data/lib/openwfe/rudefinitions.rb +21 -0
  42. data/lib/openwfe/storage/yamlextras.rb +115 -0
  43. data/lib/openwfe/storage/yamlfilestorage.rb +23 -4
  44. data/lib/openwfe/util/csvtable.rb +76 -6
  45. data/lib/openwfe/util/dollar.rb +5 -0
  46. data/lib/openwfe/util/kotoba.rb +236 -0
  47. data/lib/openwfe/util/ometa.rb +64 -0
  48. data/lib/openwfe/util/safe.rb +2 -0
  49. data/lib/openwfe/util/scheduler.rb +58 -11
  50. data/lib/openwfe/utils.rb +27 -0
  51. data/lib/openwfe/version.rb +1 -1
  52. data/lib/openwfe/worklist/storeparticipant.rb +2 -3
  53. data/test/csv_test.rb +57 -0
  54. data/test/expmap_test.rb +54 -0
  55. data/test/file_persistence_test.rb +9 -9
  56. data/test/flowtestbase.rb +19 -1
  57. data/test/ft_11_ppd.rb +18 -0
  58. data/test/ft_15_iterator.rb +27 -0
  59. data/test/ft_23b_when.rb +2 -2
  60. data/test/ft_27_getflowpos.rb +19 -9
  61. data/test/ft_29_httprb.rb +31 -2
  62. data/test/ft_30_socketlistener.rb +3 -5
  63. data/test/ft_31_flowname.rb +40 -0
  64. data/test/ft_32_journal.rb +60 -0
  65. data/test/ft_33_description.rb +100 -0
  66. data/test/ft_34_cancelwfid.rb +69 -0
  67. data/test/ft_35_localdefs.rb +63 -0
  68. data/test/ft_7_lose.rb +0 -61
  69. data/test/ft_7b_lose.rb +85 -0
  70. data/test/ft_tests.rb +49 -0
  71. data/test/kotoba_test.rb +72 -0
  72. data/test/misc_test.rb +4 -12
  73. data/test/param_test.rb +284 -0
  74. data/test/rake_qtest.rb +13 -35
  75. data/test/rake_test.rb +2 -3
  76. data/test/raw_prog_test.rb +9 -7
  77. data/test/restart_cron_test.rb +9 -5
  78. data/test/restart_sleep_test.rb +104 -0
  79. data/test/restart_tests.rb +15 -0
  80. data/test/restart_when_test.rb +105 -0
  81. data/test/scheduler_test.rb +2 -2
  82. data/test/sec_test.rb +163 -0
  83. data/test/wfid_test.rb +69 -13
  84. metadata +31 -16
  85. data/lib/openwfe/expressions/fe_time.rb +0 -454
  86. data/test/restart_test.rb +0 -79
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: openwferu
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.6
7
- date: 2007-03-12 00:00:00 +09:00
6
+ version: 0.9.7
7
+ date: 2007-03-23 00:00:00 +09:00
8
8
  summary: an open source ruby workflow and bpm engine
9
9
  require_paths:
10
10
  - lib
@@ -37,6 +37,7 @@ files:
37
37
  - lib/openwfe/contextual.rb
38
38
  - lib/openwfe/def.rb
39
39
  - lib/openwfe/engine
40
+ - lib/openwfe/exceptions.rb
40
41
  - lib/openwfe/expool
41
42
  - lib/openwfe/expressions
42
43
  - lib/openwfe/flowexpressionid.rb
@@ -58,12 +59,16 @@ files:
58
59
  - lib/openwfe/expool/expressionpool.rb
59
60
  - lib/openwfe/expool/expstorage.rb
60
61
  - lib/openwfe/expool/history.rb
62
+ - lib/openwfe/expool/journal.rb
63
+ - lib/openwfe/expool/journal_replay.rb
64
+ - lib/openwfe/expool/wfidgen.rb
61
65
  - lib/openwfe/expool/yamlexpstorage.rb
62
66
  - lib/openwfe/expressions/condition.rb
63
67
  - lib/openwfe/expressions/environment.rb
64
68
  - lib/openwfe/expressions/expressionmap.rb
65
69
  - lib/openwfe/expressions/fe_cancel.rb
66
70
  - lib/openwfe/expressions/fe_concurrence.rb
71
+ - lib/openwfe/expressions/fe_cron.rb
67
72
  - lib/openwfe/expressions/fe_cursor.rb
68
73
  - lib/openwfe/expressions/fe_define.rb
69
74
  - lib/openwfe/expressions/fe_do.rb
@@ -74,10 +79,11 @@ files:
74
79
  - lib/openwfe/expressions/fe_participant.rb
75
80
  - lib/openwfe/expressions/fe_raw.rb
76
81
  - lib/openwfe/expressions/fe_sequence.rb
82
+ - lib/openwfe/expressions/fe_sleep.rb
77
83
  - lib/openwfe/expressions/fe_subprocess.rb
78
- - lib/openwfe/expressions/fe_time.rb
79
84
  - lib/openwfe/expressions/fe_utils.rb
80
85
  - lib/openwfe/expressions/fe_value.rb
86
+ - lib/openwfe/expressions/fe_when.rb
81
87
  - lib/openwfe/expressions/flowexpression.rb
82
88
  - lib/openwfe/expressions/raw_prog.rb
83
89
  - lib/openwfe/expressions/raw_xml.rb
@@ -103,12 +109,15 @@ files:
103
109
  - lib/openwfe/rest/restclient.rb
104
110
  - lib/openwfe/rest/worklistclient.rb
105
111
  - lib/openwfe/rest/xmlcodec.rb
112
+ - lib/openwfe/storage/yamlextras.rb
106
113
  - lib/openwfe/storage/yamlfilestorage.rb
107
114
  - lib/openwfe/tools/flowtracer.rb
108
115
  - lib/openwfe/util/csvtable.rb
109
116
  - lib/openwfe/util/dollar.rb
117
+ - lib/openwfe/util/kotoba.rb
110
118
  - lib/openwfe/util/lru.rb
111
119
  - lib/openwfe/util/observable.rb
120
+ - lib/openwfe/util/ometa.rb
112
121
  - lib/openwfe/util/otime.rb
113
122
  - lib/openwfe/util/safe.rb
114
123
  - lib/openwfe/util/scheduler.rb
@@ -121,6 +130,7 @@ files:
121
130
  - test/csv_test.rb
122
131
  - test/dollar_test.rb
123
132
  - test/eno_test.rb
133
+ - test/expmap_test.rb
124
134
  - test/fei_test.rb
125
135
  - test/file_persistence_test.rb
126
136
  - test/flowtestbase.rb
@@ -157,27 +167,39 @@ files:
157
167
  - test/ft_2b_concurrence.rb
158
168
  - test/ft_2c_concurrence.rb
159
169
  - test/ft_30_socketlistener.rb
170
+ - test/ft_31_flowname.rb
171
+ - test/ft_32_journal.rb
172
+ - test/ft_33_description.rb
173
+ - test/ft_34_cancelwfid.rb
174
+ - test/ft_35_localdefs.rb
160
175
  - test/ft_3_equals.rb
161
176
  - test/ft_4_misc.rb
162
177
  - test/ft_5_time.rb
163
178
  - test/ft_6_lambda.rb
164
179
  - test/ft_7_lose.rb
180
+ - test/ft_7b_lose.rb
165
181
  - test/ft_8_forget.rb
166
182
  - test/ft_9_cursor.rb
183
+ - test/ft_tests.rb
167
184
  - test/hash_test.rb
168
185
  - test/hparticipant_test.rb
186
+ - test/kotoba_test.rb
169
187
  - test/lru_test.rb
170
188
  - test/misc_test.rb
189
+ - test/param_test.rb
171
190
  - test/rake_qtest.rb
172
191
  - test/rake_test.rb
173
192
  - test/raw_prog_test.rb
174
193
  - test/README.txt
175
194
  - test/rest_test.rb
176
195
  - test/restart_cron_test.rb
177
- - test/restart_test.rb
196
+ - test/restart_sleep_test.rb
197
+ - test/restart_tests.rb
198
+ - test/restart_when_test.rb
178
199
  - test/rutest_utils.rb
179
200
  - test/safely_test.rb
180
201
  - test/scheduler_test.rb
202
+ - test/sec_test.rb
181
203
  - test/sqs_test.rb
182
204
  - test/time_test.rb
183
205
  - test/timeout_test.rb
@@ -186,6 +208,7 @@ files:
186
208
  - examples/flowtracing.rb
187
209
  - examples/homeworkreview.rb
188
210
  - examples/mano_tracker.rb
211
+ - examples/openwferu.rb
189
212
  - examples/quotereporter.rb
190
213
  - examples/README.txt
191
214
  - examples/scheduler_cron_usage.rb
@@ -201,15 +224,7 @@ executables: []
201
224
 
202
225
  extensions: []
203
226
 
204
- requirements:
205
- - libxml-ruby
206
- dependencies:
207
- - !ruby/object:Gem::Dependency
208
- name: libxml-ruby
209
- version_requirement:
210
- version_requirements: !ruby/object:Gem::Version::Requirement
211
- requirements:
212
- - - ">"
213
- - !ruby/object:Gem::Version
214
- version: 0.0.0
215
- version:
227
+ requirements: []
228
+
229
+ dependencies: []
230
+
@@ -1,454 +0,0 @@
1
- #
2
- #--
3
- # Copyright (c) 2006-2007, John Mettraux, OpenWFE.org
4
- # All rights reserved.
5
- #
6
- # Redistribution and use in source and binary forms, with or without
7
- # modification, are permitted provided that the following conditions are met:
8
- #
9
- # . Redistributions of source code must retain the above copyright notice, this
10
- # list of conditions and the following disclaimer.
11
- #
12
- # . Redistributions in binary form must reproduce the above copyright notice,
13
- # this list of conditions and the following disclaimer in the documentation
14
- # and/or other materials provided with the distribution.
15
- #
16
- # . Neither the name of the "OpenWFE" nor the names of its contributors may be
17
- # used to endorse or promote products derived from this software without
18
- # specific prior written permission.
19
- #
20
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
- # POSSIBILITY OF SUCH DAMAGE.
31
- #++
32
- #
33
- # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
34
- #
35
-
36
- #
37
- # "made in Japan"
38
- #
39
- # John Mettraux at openwfe.org
40
- #
41
-
42
- require 'openwfe/rudefinitions'
43
- require 'openwfe/utils'
44
- require 'openwfe/util/otime'
45
- require 'openwfe/util/scheduler'
46
- require 'openwfe/expressions/timeout'
47
- require 'openwfe/expressions/condition'
48
-
49
-
50
- #
51
- # expressions like 'sleep' and 'cron'
52
- #
53
-
54
- module OpenWFE
55
-
56
- #
57
- # A parent class for CronExpression and SleepExpression, is never
58
- # used directly.
59
- # It contains a simple get_scheduler() method simplifying the scheduler
60
- # localization for <sleep/> and <cron/>.
61
- #
62
- class TimeExpression < FlowExpression
63
- include Schedulable
64
-
65
- attr_accessor \
66
- :applied_workitem,
67
- :scheduler_job_id
68
-
69
- #
70
- # Makes sure to cancel any scheduler job associated with this
71
- # expression
72
- #
73
- def cancel ()
74
- synchronize do
75
-
76
- ldebug { "cancel()..." }
77
-
78
- unschedule()
79
-
80
- return super()
81
- end
82
- end
83
-
84
- def unschedule ()
85
-
86
- ldebug { "unschedule() @scheduler_job_id is #{@scheduler_job_id}" }
87
-
88
- get_scheduler.unschedule(@scheduler_job_id) \
89
- if @scheduler_job_id
90
- end
91
- end
92
-
93
- #
94
- # The 'sleep' expression expects one attribute, either 'for', either
95
- # 'until'.
96
- #
97
- # <sequence>
98
- # <sleep for="10m12s" />
99
- # <participant ref="alpha" />
100
- # </sequence>
101
- #
102
- # will wait for 10 minutes and 12 seconds before sending a workitem
103
- # to participant 'alpha'.
104
- #
105
- class SleepExpression < TimeExpression
106
-
107
- attr_accessor \
108
- :awakening_time
109
-
110
- def apply (workitem)
111
- #synchronize do
112
-
113
- sfor = lookup_attribute(:for, workitem)
114
- suntil = lookup_attribute(:until, workitem)
115
-
116
- tuntil = nil
117
-
118
- if suntil
119
- tuntil = suntil
120
- elsif sfor
121
- tfor = OpenWFE::parse_time_string(sfor)
122
- ldebug { "apply() tfor is '#{tfor}'" }
123
- tuntil = Time.new.to_f + tfor
124
- end
125
-
126
- if not tuntil
127
- reply_to_parent(workitem)
128
- return
129
- end
130
-
131
- @awakening_time = tuntil
132
- @applied_workitem = workitem.dup
133
-
134
- reschedule(get_scheduler)
135
- #end
136
- end
137
-
138
- #def reply (workitem)
139
- #end
140
-
141
- #
142
- # This is the method called by the Scheduler instance attached to
143
- # the workflow engine when the 'sleep' of this expression is
144
- # over
145
- #
146
- def trigger (params)
147
- ldebug do
148
- "trigger() #{@fei.to_debug_s} waking up (#{Time.new.to_f}) "+
149
- "(scheduler #{get_scheduler.object_id})"
150
- end
151
- reply_to_parent(@applied_workitem)
152
- end
153
-
154
- #
155
- # [Re]schedules this expression, effectively registering it within
156
- # the scheduler.
157
- # This method is called when the expression is applied and each
158
- # time the owning engine restarts.
159
- #
160
- def reschedule (scheduler)
161
-
162
- return unless @awakening_time
163
-
164
- ldebug do
165
- "[re]schedule() " +
166
- "will sleep until '#{@awakening_time}' " +
167
- "(#{OpenWFE::to_iso8601_date(@awakening_time)})"
168
- end
169
-
170
- @scheduler_job_id =
171
- scheduler.schedule_at(@awakening_time, self, nil)
172
-
173
- ldebug do
174
- "[re]schedule() @scheduler_job_id is '#{@scheduler_job_id}' "+
175
- " (scheduler #{scheduler.object_id})"
176
- end
177
-
178
- store_itself()
179
- end
180
- end
181
-
182
- #
183
- # Scheduling subprocesses for repeating execution
184
- #
185
- # <cron tab="0 9-17 * * mon-fri" name="//reminder">
186
- # <send-reminder/>
187
- # </cron>
188
- #
189
- # In this short process definition snippet, the subprocess "send-reminder"
190
- # will get triggered once per hour (minute 0) from 0900 to 1700 and
191
- # this, from monday to friday.
192
- #
193
- # The 'name' of the cron indicates also at which level the cron should
194
- # be bound. A double slash means the cron is bound at engine level (and
195
- # will continue until it is unbound, as long as the engine is up, if the
196
- # engine is a persisted one, the cron will continue when the engine
197
- # restarts).
198
- #
199
- class CronExpression < TimeExpression
200
-
201
- attr_accessor \
202
- :raw_child, :tab, :name, :counter
203
-
204
- def apply (workitem)
205
-
206
- @counter = 0
207
-
208
- if @children.size < 1
209
- reply_to_parent(workitem)
210
- return
211
- end
212
-
213
- @applied_workitem = workitem.dup
214
- @applied_workitem.flow_expression_id = nil
215
-
216
- @tab = lookup_attribute(:tab, workitem)
217
- @name = lookup_attribute(:name, workitem)
218
-
219
- @raw_child, _fei = get_expression_pool.fetch(@children[0])
220
- @raw_child.parent_id = nil
221
-
222
- clean_children()
223
-
224
- @children = nil
225
-
226
- #
227
- # schedule self
228
-
229
- reschedule(get_scheduler)
230
-
231
- #
232
- # store self as a variable
233
- # (have to do it after the reschedule, so that the schedule
234
- # info is stored within the variable)
235
-
236
- set_variable(@name, self) if @name
237
-
238
- #
239
- # resume flow
240
-
241
- reply_to_parent(workitem)
242
- end
243
-
244
- def reply (workitem)
245
- # discard silently... should never get called though
246
- end
247
-
248
- #def cancel ()
249
- #end
250
- #
251
- # implemented in parent TimeExpression class
252
-
253
- #
254
- # This is the method called each time, the scheduler triggers
255
- # this cron. The contained segment of process will get
256
- # executed.
257
- #
258
- def trigger (params)
259
- #
260
- # launch raw child
261
-
262
- ldebug { "trigger() cron : #{@fei.to_debug_s}" }
263
-
264
- @raw_child.application_context = @application_context
265
-
266
- begin
267
-
268
- get_expression_pool.launch_template(
269
- @fei.wfid, @counter, @raw_child, @applied_workitem.dup)
270
-
271
- #
272
- # update count and store self
273
-
274
- @counter += 1
275
-
276
- set_variable(@name, self) if @name
277
-
278
- rescue
279
- lerror do
280
- "trigger() cron caught exception\n"+
281
- OpenWFE::exception_to_s($!)
282
- end
283
- end
284
- end
285
-
286
- #
287
- # This method is called at the first schedule of this expression
288
- # or each time the engine is restarted and this expression has
289
- # to be rescheduled.
290
- #
291
- def reschedule (scheduler)
292
-
293
- #return unless @applied_workitem
294
-
295
- @scheduler_job_id = @name.dup
296
-
297
- @scheduler_job_id = "#{@fei.wfid}__#{@scheduler_job_id}" \
298
- if not OpenWFE::starts_with(@name, "//")
299
-
300
- get_scheduler.schedule(@tab, @scheduler_job_id, self, nil)
301
-
302
- ldebug { "reschedule() job id is '#{@scheduler_job_id}'" }
303
-
304
- #store_itself()
305
- #
306
- # done by the containing environment itself
307
- end
308
- end
309
-
310
- #
311
- # The 'when' expression will trigger a consequence when a condition
312
- # is met, like in
313
- #
314
- # <when test="${variable:over} == true">
315
- # <participant ref="toto" />
316
- # </when>
317
- #
318
- # where the participant "toto" will receive a workitem when the (local)
319
- # variable "over" has the value true.
320
- #
321
- class WhenExpression < TimeExpression
322
- include ConditionMixin, TimeoutMixin
323
-
324
- attr_accessor \
325
- :frequency,
326
- :consequence_triggered
327
-
328
- DEFAULT_FREQUENCY = "20s"
329
-
330
- def apply (workitem)
331
-
332
- remove_timedout_flag(workitem)
333
-
334
- if @children.size < 1
335
- reply_to_parent(workitem)
336
- return
337
- end
338
-
339
- @applied_workitem = workitem.dup
340
-
341
- @frequency =
342
- lookup_attribute(:frequency, workitem, DEFAULT_FREQUENCY)
343
- @frequency =
344
- OpenWFE::parse_time_string(@frequency)
345
-
346
- determine_timeout()
347
-
348
- @consequence_triggered = false
349
-
350
- trigger(nil)
351
- end
352
-
353
- def reply (workitem)
354
-
355
- ldebug do
356
- "reply() @consequence_triggered is '#{@consequence_triggered}'"
357
- end
358
-
359
- if @consequence_triggered
360
- reply_to_parent(workitem)
361
- return
362
- end
363
-
364
- result = OpenWFE::get_result(workitem)
365
-
366
- if result
367
- apply_consequence(workitem)
368
- else
369
- reschedule(get_scheduler)
370
- end
371
- end
372
-
373
- def cancel ()
374
- to_unschedule()
375
- super()
376
- end
377
-
378
- def trigger (params)
379
-
380
- ldebug { "trigger() params is #{params}" }
381
-
382
- if params == :do_timeout!
383
- #
384
- # do timeout...
385
- #
386
- set_timedout_flag(@applied_workitem)
387
- reply_to_parent(@applied_workitem)
388
- return
389
- end
390
-
391
- @scheduler_job_id = nil
392
-
393
- evaluate_condition()
394
- end
395
-
396
- def reschedule (scheduler)
397
-
398
- #return unless @applied_workitem
399
-
400
- @scheduler_job_id =
401
- scheduler.schedule_in(@frequency, self, nil)
402
-
403
- ldebug { "reschedule() @scheduler_job_id is #{@scheduler_job_id}" }
404
-
405
- to_reschedule(scheduler)
406
- end
407
-
408
- def reply_to_parent (workitem)
409
-
410
- unschedule()
411
- unschedule_timeout()
412
-
413
- super(workitem)
414
- end
415
-
416
- protected
417
-
418
- def evaluate_condition
419
-
420
- if @children.size > 1
421
- #
422
- # trigger the evaluation of the first (condition) child
423
-
424
- store_itself()
425
-
426
- get_expression_pool.launch_template(
427
- self, @children[0], @applied_workitem)
428
- else
429
- #
430
- # eval the attribute condition immediately
431
-
432
- c = eval_condition(:test, @applied_workitem)
433
-
434
- OpenWFE::set_result(@applied_workitem, c)
435
-
436
- reply(@applied_workitem)
437
- end
438
- end
439
-
440
- def apply_consequence (workitem)
441
-
442
- @consequence_triggered = true
443
-
444
- store_itself()
445
-
446
- i = 1
447
- i = 0 if @children.size == 1
448
-
449
- get_expression_pool.apply(@children[i], workitem)
450
- end
451
- end
452
-
453
- end
454
-
data/test/restart_test.rb DELETED
@@ -1,79 +0,0 @@
1
- #
2
- # Testing OpenWFE
3
- #
4
- # John Mettraux at openwfe.org
5
- #
6
- # Sun Oct 29 15:41:44 JST 2006
7
- #
8
- # somewhere between Philippina and the Japan
9
- #
10
-
11
- require 'test/unit'
12
-
13
- require 'openwfe/workitem'
14
- require 'openwfe/engine/file_persisted_engine'
15
- require 'openwfe/expressions/raw_prog'
16
-
17
- require 'rutest_utils'
18
-
19
- include OpenWFE
20
-
21
-
22
- class RestartTest < Test::Unit::TestCase
23
-
24
- #def setup
25
- # @engine = $WORKFLOW_ENGINE_CLASS.new()
26
- #end
27
-
28
- #def teardown
29
- #end
30
-
31
- class RestartDefinition0 < ProcessDefinition
32
- def make
33
- process_definition :name => "rs0", :revision => "0" do
34
- sequence do
35
- _sleep :for => "10s"
36
- _print "after"
37
- end
38
- end
39
- end
40
- end
41
-
42
- def test_restart_0
43
- engine = new_engine
44
-
45
- li = LaunchItem.new(RestartDefinition0)
46
-
47
- engine.launch(li)
48
-
49
- sleep(1)
50
-
51
- engine.stop()
52
-
53
- $OWFE_LOG.warn "stopped the engine"
54
-
55
- old_engine = engine
56
- engine = new_engine
57
-
58
- $OWFE_LOG.warn "started the new engine"
59
-
60
- sleep(11)
61
- #sleep(21)
62
-
63
- s_old = old_engine.application_context["__tracer"].to_s
64
- s_now = engine.application_context["__tracer"].to_s
65
-
66
- assert (s_old == "" and s_now == "after")
67
- end
68
-
69
- protected
70
-
71
- def new_engine
72
- engine = FilePersistedEngine.new()
73
- tracer = Tracer.new
74
- engine.application_context["__tracer"] = tracer
75
- return engine
76
- end
77
-
78
- end
79
-