openwferu 0.9.12 → 0.9.12.863

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/examples/engine_template.rb +30 -0
  2. data/lib/openwfe/contextual.rb +21 -0
  3. data/lib/openwfe/engine/engine.rb +24 -24
  4. data/lib/openwfe/expool/errorjournal.rb +1 -3
  5. data/lib/openwfe/expool/expressionpool.rb +29 -24
  6. data/lib/openwfe/expool/history.rb +1 -3
  7. data/lib/openwfe/expool/journal.rb +1 -3
  8. data/lib/openwfe/expool/wfidgen.rb +1 -3
  9. data/lib/openwfe/expool/yamlexpstorage.rb +7 -7
  10. data/lib/openwfe/expressions/environment.rb +17 -6
  11. data/lib/openwfe/expressions/expressionmap.rb +1 -2
  12. data/lib/openwfe/expressions/fe_command.rb +227 -0
  13. data/lib/openwfe/expressions/fe_concurrence.rb +8 -6
  14. data/lib/openwfe/expressions/fe_cursor.rb +3 -157
  15. data/lib/openwfe/expressions/fe_define.rb +6 -5
  16. data/lib/openwfe/expressions/fe_if.rb +8 -2
  17. data/lib/openwfe/expressions/fe_iterator.rb +141 -35
  18. data/lib/openwfe/expressions/fe_subprocess.rb +3 -29
  19. data/lib/openwfe/expressions/fe_value.rb +1 -4
  20. data/lib/openwfe/expressions/flowexpression.rb +0 -5
  21. data/lib/openwfe/expressions/raw.rb +0 -2
  22. data/lib/openwfe/expressions/raw_prog.rb +15 -15
  23. data/lib/openwfe/flowexpressionid.rb +3 -3
  24. data/lib/openwfe/listeners/listeners.rb +2 -6
  25. data/lib/openwfe/participants/enoparticipants.rb +1 -2
  26. data/lib/openwfe/participants/participantmap.rb +0 -2
  27. data/lib/openwfe/participants/participants.rb +95 -4
  28. data/lib/openwfe/participants/soapparticipants.rb +15 -8
  29. data/lib/openwfe/rest/osocket.rb +2 -3
  30. data/lib/openwfe/rest/xmlcodec.rb +0 -2
  31. data/lib/openwfe/rudefinitions.rb +0 -17
  32. data/lib/openwfe/storage/yamlfilestorage.rb +3 -8
  33. data/lib/openwfe/util/observable.rb +4 -2
  34. data/lib/openwfe/util/otime.rb +10 -9
  35. data/lib/openwfe/util/safe.rb +9 -6
  36. data/lib/openwfe/util/scheduler.rb +60 -9
  37. data/lib/openwfe/util/schedulers.rb +1 -1
  38. data/lib/openwfe/util/workqueue.rb +0 -3
  39. data/lib/openwfe/utils.rb +27 -11
  40. data/lib/openwfe/version.rb +1 -1
  41. data/lib/openwfe/workitem.rb +29 -3
  42. data/lib/openwfe/worklist/storeparticipant.rb +1 -5
  43. data/test/console_test.rb +1 -4
  44. data/test/file_persisted_engine_test.rb +64 -0
  45. data/test/file_persistence_test.rb +22 -1
  46. data/test/ft_15_iterator.rb +55 -1
  47. data/test/ft_20_cron.rb +0 -1
  48. data/test/ft_21_cron.rb +0 -1
  49. data/test/ft_26c_load.rb +4 -10
  50. data/test/ft_32_journal.rb +2 -2
  51. data/test/ft_61_elsub.rb +51 -0
  52. data/test/ft_62_procparticipant.rb +65 -0
  53. data/test/ft_tests.rb +3 -1
  54. data/test/hparticipant_test.rb +3 -3
  55. data/test/misc_test.rb +1 -1
  56. data/test/obs_test.rb +27 -0
  57. data/test/rake_qtest.rb +4 -3
  58. data/test/safely_test.rb +6 -1
  59. data/test/scheduler_test.rb +85 -2
  60. data/test/sec_test.rb +9 -7
  61. metadata +6 -14
  62. data/lib/openwfe/listeners/sqslisteners.rb +0 -145
  63. data/lib/openwfe/participants/atomparticipants.rb +0 -181
  64. data/lib/openwfe/participants/csvparticipants.rb +0 -127
  65. data/lib/openwfe/participants/sqsparticipants.rb +0 -121
  66. data/lib/openwfe/storage/yamlextras.rb +0 -115
  67. data/lib/openwfe/util/csvtable.rb +0 -448
  68. data/lib/openwfe/util/sqs.rb +0 -581
  69. data/test/atom_test.rb +0 -100
  70. data/test/csv_test.rb +0 -342
  71. data/test/ft_19_csv.rb +0 -65
  72. data/test/rest_test.rb +0 -189
  73. data/test/sqs_test.rb +0 -103
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: codec.rb 2515 2006-04-26 18:38:39Z jmettraux $
34
- #
35
33
 
36
34
  require 'socket'
37
35
 
@@ -94,7 +92,8 @@ module OpenWFE
94
92
  #
95
93
  def OpenWFE.dispatch_workitem (host, port, workitem)
96
94
 
97
- sXml = OpenWFE.xml_encode(workitem)
95
+ #sXml = OpenWFE.xml_encode(workitem)
96
+ sXml = OpenWFE::XmlCodec::encode workitem
98
97
 
99
98
  socket = TCPSocket.new(host, port)
100
99
  socket.puts "xmlCoder #{sXml.length}"
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: codec.rb 2865 2006-06-23 14:54:07Z jmettraux $
34
- #
35
33
 
36
34
  #
37
35
  # "hecho en Costa Rica"
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
34
- #
35
33
 
36
34
  #
37
35
  # "made in Japan"
@@ -69,21 +67,6 @@ module OpenWFE
69
67
 
70
68
  DEFAULT_WORK_DIRECTORY = 'work'
71
69
 
72
- #
73
- # Returns the work directory for the OpenWFE[ru] application context
74
- # (if any).
75
- #
76
- def OpenWFE.get_work_directory (dir=nil)
77
-
78
- dir = DEFAULT_WORK_DIRECTORY unless @application_context
79
- dir = @application_context[:work_directory] unless dir
80
- dir = DEFAULT_WORK_DIRECTORY unless dir
81
-
82
- FileUtils.makedirs(dir) unless File.exist?(dir)
83
-
84
- dir
85
- end
86
-
87
70
  #
88
71
  # A mixin for easy OpenWFE service lookup
89
72
  # (assumes the presence of an application context instance var)
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
34
- #
35
33
 
36
34
  #
37
35
  # "made in Japan"
@@ -50,17 +48,15 @@ require 'openwfe/service'
50
48
 
51
49
  require 'openwfe/expressions/flowexpression'
52
50
  require 'openwfe/expressions/raw_xml'
53
-
54
- #
51
+ #--
55
52
  # making sure classes in those files are loaded
56
53
  # before their yaml persistence is tuned
57
54
  # (else the reopening of the class is interpreted as
58
55
  # a definition of the class...)
56
+ #++
59
57
 
60
58
  module OpenWFE
61
59
 
62
-
63
-
64
60
  #
65
61
  # Stores OpenWFEru related objects into yaml encoded files.
66
62
  # This storage is meant to look and feel like a Hash.
@@ -76,8 +72,7 @@ module OpenWFE
76
72
 
77
73
  service_init(service_name, application_context)
78
74
 
79
- @basepath = path
80
- #@basepath = OpenWFE::clean_path(@basepath)
75
+ @basepath = get_work_directory + path
81
76
  @basepath += "/" unless @basepath[-1, 1] == "/"
82
77
 
83
78
  FileUtils.makedirs @basepath
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
34
- #
35
33
 
36
34
  #
37
35
  # "made in Japan"
@@ -55,9 +53,13 @@ module OpenWFE
55
53
  #
56
54
  # An observer is an instance which responds to call(channel, *args)
57
55
  #
56
+ # Returns the observer object (or the block's Proc object), could
57
+ # be useful when removing the observer.
58
+ #
58
59
  def add_observer (channel, observer=nil, &callback)
59
60
  observer = callback unless observer
60
61
  (@observers[channel] ||= []) << observer
62
+ observer
61
63
  end
62
64
 
63
65
  #
@@ -51,7 +51,8 @@ module OpenWFE
51
51
  # Returns the current time as an ISO date string
52
52
  #
53
53
  def OpenWFE.now ()
54
- return to_iso8601_date(Time.new())
54
+
55
+ to_iso8601_date(Time.new())
55
56
  end
56
57
 
57
58
  def OpenWFE.to_iso8601_date (date)
@@ -67,7 +68,7 @@ module OpenWFE
67
68
  s = date.to_s # this is costly
68
69
  s[10] = " "
69
70
 
70
- return s
71
+ s
71
72
  end
72
73
 
73
74
  #
@@ -89,7 +90,7 @@ module OpenWFE
89
90
  #
90
91
  def OpenWFE.to_ruby_time (iso_date)
91
92
 
92
- return DateTime.parse(iso_date)
93
+ DateTime.parse(iso_date)
93
94
  end
94
95
 
95
96
  #def OpenWFE.parse_date (date)
@@ -102,7 +103,7 @@ module OpenWFE
102
103
 
103
104
  t = Time.new()
104
105
  t = t.to_f * 1000
105
- return t.to_i
106
+ t.to_i
106
107
  end
107
108
 
108
109
  #
@@ -154,7 +155,7 @@ module OpenWFE
154
155
  result = result + (value * multiplier)
155
156
  end
156
157
 
157
- return result
158
+ result
158
159
  end
159
160
 
160
161
  #
@@ -163,7 +164,7 @@ module OpenWFE
163
164
  def OpenWFE.is_digit? (c)
164
165
  return false if not c.kind_of?(String)
165
166
  return false if c.length > 1
166
- return (c >= "0" and c <= "9")
167
+ (c >= "0" and c <= "9")
167
168
  end
168
169
 
169
170
  #
@@ -185,7 +186,7 @@ module OpenWFE
185
186
 
186
187
  begin
187
188
 
188
- return DateTime.new(
189
+ DateTime.new(
189
190
  time.year,
190
191
  time.month,
191
192
  time.day,
@@ -204,7 +205,7 @@ module OpenWFE
204
205
  # "\n....y:#{time.year} M:#{time.month} d:#{time.day} "+
205
206
  # "h:#{time.hour} m:#{time.min} s:#{s} o:#{o}"
206
207
 
207
- return DateTime.new(
208
+ DateTime.new(
208
209
  time.year,
209
210
  time.month,
210
211
  time.day,
@@ -223,7 +224,7 @@ module OpenWFE
223
224
  to_ttime(dtime.new_offset(DateTime.now.offset-offset), :local)
224
225
  end
225
226
 
226
- def to_ttime (d, method)
227
+ def OpenWFE.to_ttime (d, method)
227
228
  usec = (d.sec_fraction * 3600 * 24 * (10**6)).to_i
228
229
  Time.send(method, d.year, d.month, d.day, d.hour, d.min, d.sec, usec)
229
230
  end
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: utils.rb 3454 2006-10-08 16:51:00Z jmettraux $
34
- #
35
33
 
36
34
  #
37
35
  # "made in Japan"
@@ -39,13 +37,12 @@
39
37
  # john.mettraux@openwfe.org
40
38
  #
41
39
 
42
- #require 'tmpdir'
43
40
  require 'open-uri'
44
41
 
45
42
 
46
43
  module OpenWFE
47
44
 
48
- #
45
+ #--
49
46
  # Runs some remote code (uri) at a different $SAFE level.
50
47
  #
51
48
  #def OpenWFE.load_safely (uri, safe_level)
@@ -56,7 +53,7 @@ module OpenWFE
56
53
  # source << open(uri).read
57
54
  # load_eval_safely(source, safe_level)
58
55
  #end
59
-
56
+ #
60
57
  #
61
58
  # Makes sure that a piece of Ruby code is run at certain safe level.
62
59
  # Saves in a temp file that is reloaded in its own anonymous namespace.
@@ -80,6 +77,7 @@ module OpenWFE
80
77
  # # ignore
81
78
  # end
82
79
  #end
80
+ #++
83
81
 
84
82
  #
85
83
  # Runs some code within an instance's realm at a certain safety level.
@@ -149,7 +147,12 @@ module OpenWFE
149
147
 
150
148
  protected
151
149
 
152
- def on_jruby?
150
+ #
151
+ # Returns true if the JRUBY_VERSION is defined.
152
+ # (beware : something else than JRuby may have defined it).
153
+ #
154
+ def OpenWFE.on_jruby?
155
+
153
156
  defined?(JRUBY_VERSION) != nil
154
157
  end
155
158
 
@@ -104,14 +104,31 @@ module OpenWFE
104
104
  # This attribute is best used indirectly : the method
105
105
  # join_until_no_more_jobs() wraps it.
106
106
  #
107
+ # Since OpenWFEru 0.9.13, the :scheduler_precision can be set when
108
+ # instantiating the scheduler.
109
+ #
110
+ # scheduler = OpenWFE::Scheduler.new(:scheduler_precision => 0.500)
111
+ # scheduler.start
112
+ # #
113
+ # # instatiates a scheduler that checks its jobs twice per second
114
+ # # (the default is 4 times per second (0.250))
115
+ #
107
116
  class Scheduler
108
117
  include MonitorMixin
109
118
 
110
- attr_accessor \
111
- :precision,
112
- :exit_when_no_more_jobs
119
+ #
120
+ # By default, the precision is 0.250, with means the scheduler
121
+ # will check for jobs to execute 4 times per second.
122
+ #
123
+ attr_accessor :precision
124
+
125
+ #
126
+ # As its name implies.
127
+ #
128
+ attr_accessor :stopped
129
+
113
130
 
114
- def initialize
131
+ def initialize (params={})
115
132
 
116
133
  super()
117
134
 
@@ -121,15 +138,19 @@ module OpenWFE
121
138
  @scheduler_thread = nil
122
139
 
123
140
  @precision = 0.250
124
- #
125
- # every 250ms, the scheduler wakes up
141
+ # every 250ms, the scheduler wakes up (default value)
142
+ begin
143
+ @precision = Float(params[:scheduler_precision])
144
+ rescue Exception => e
145
+ # let precision at its default value
146
+ end
126
147
 
127
148
  @exit_when_no_more_jobs = false
128
149
  @dont_reschedule_every = false
129
150
 
130
151
  @last_cron_minute = -1
131
152
 
132
- @stopped = false
153
+ @stopped = true
133
154
  end
134
155
 
135
156
  #
@@ -137,6 +158,8 @@ module OpenWFE
137
158
  #
138
159
  def sstart
139
160
 
161
+ @stopped = false
162
+
140
163
  @scheduler_thread = Thread.new do
141
164
 
142
165
  if defined?(JRUBY_VERSION)
@@ -189,6 +212,21 @@ module OpenWFE
189
212
  # Schedules a job by specifying at which time it should trigger.
190
213
  # Returns the a job_id that can be used to unschedule the job.
191
214
  #
215
+ # This method returns a job identifier which can be used to unschedule()
216
+ # the job.
217
+ #
218
+ # If the job is specified in the past, it will be triggered immediately
219
+ # but not scheduled.
220
+ # To avoid the triggering, the parameter :discard_past may be set to
221
+ # true :
222
+ #
223
+ # jobid = scheduler.schedule_at(yesterday, :discard_past => true) do
224
+ # puts "you'll never read this message"
225
+ # end
226
+ #
227
+ # And 'jobid' will hold a nil (not scheduled).
228
+ #
229
+ #
192
230
  def schedule_at (at, params={}, &block)
193
231
 
194
232
  params = prepare_params(params)
@@ -201,6 +239,9 @@ module OpenWFE
201
239
  # Schedules a job by stating in how much time it should trigger.
202
240
  # Returns the a job_id that can be used to unschedule the job.
203
241
  #
242
+ # This method returns a job identifier which can be used to unschedule()
243
+ # the job.
244
+ #
204
245
  def schedule_in (duration, params={}, &block)
205
246
 
206
247
  duration = duration_to_f(duration)
@@ -223,6 +264,9 @@ module OpenWFE
223
264
  # end
224
265
  # end
225
266
  #
267
+ # This method returns a job identifier which can be used to unschedule()
268
+ # the job.
269
+ #
226
270
  def schedule_every (freq, params={}, &block)
227
271
 
228
272
  f = duration_to_f freq
@@ -282,7 +326,7 @@ module OpenWFE
282
326
  #
283
327
  # Schedules a cron job, the 'cron_line' is a string
284
328
  # following the Unix cron standard (see "man 5 crontab" in your command
285
- # line).
329
+ # line, or http://www.google.com/search?q=man%205%20crontab).
286
330
  #
287
331
  # For example :
288
332
  #
@@ -301,6 +345,9 @@ module OpenWFE
301
345
  # Returns the job id attributed to this 'cron job', this id can
302
346
  # be used to unschedule the job.
303
347
  #
348
+ # This method returns a job identifier which can be used to unschedule()
349
+ # the job.
350
+ #
304
351
  def schedule (cron_line, params={}, &block)
305
352
  synchronize do
306
353
 
@@ -401,6 +448,10 @@ module OpenWFE
401
448
  params
402
449
  end
403
450
 
451
+ #
452
+ # The core method behind schedule_at and schedule_in (and also
453
+ # schedule_every). It's protected, don't use it directly.
454
+ #
404
455
  def sschedule_at (at, params={}, &block)
405
456
  synchronize do
406
457
 
@@ -431,7 +482,7 @@ module OpenWFE
431
482
  unschedule(job_id) if job_id
432
483
 
433
484
  if at < (Time.new.to_f + @precision)
434
- job.trigger()
485
+ job.trigger() unless params[:discard_past]
435
486
  return nil
436
487
  end
437
488
 
@@ -54,7 +54,7 @@ module OpenWFE
54
54
 
55
55
  def initialize (service_name, application_context)
56
56
 
57
- super()
57
+ super(application_context)
58
58
 
59
59
  service_init(service_name, application_context)
60
60
 
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id$
34
- #
35
33
 
36
34
  #
37
35
  # "made in Japan"
@@ -150,7 +148,6 @@ module OpenWFE
150
148
  # do_process_workelement method
151
149
  end
152
150
 
153
- #
154
151
  # TODO : have a pool of workers handle that
155
152
 
156
153
  #q.size
data/lib/openwfe/utils.rb CHANGED
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: utils.rb 3454 2006-10-08 16:51:00Z jmettraux $
34
- #
35
33
 
36
34
  #
37
35
  # "hecho en Costa Rica" and "made in Japan"
@@ -56,10 +54,6 @@ module OpenWFE
56
54
 
57
55
  return xmlElt.elements[1] if not elementName
58
56
 
59
- #xmlElt.elements.each do |elt|
60
- # return elt if elt.name == elementName
61
- #end
62
- #return nil
63
57
  xmlElt.elements.detect { |elt| elt.name == elementName }
64
58
  end
65
59
 
@@ -199,10 +193,32 @@ module OpenWFE
199
193
  # No exception is thrown by this method.
200
194
  #
201
195
  def OpenWFE.parse_uri (string)
196
+
202
197
  begin
203
198
  return URI::parse(string)
204
199
  rescue Exception => e
205
200
  end
201
+
202
+ nil
203
+ end
204
+
205
+ #
206
+ # Returns a URI instance if the given ref is a http, https, file or ftp
207
+ # URI. Returns nil else.
208
+ # The sister method parse_uri() is OK with things like mailto:, gopher:, ...
209
+ #
210
+ def OpenWFE.parse_known_uri (ref)
211
+
212
+ uri = OpenWFE::parse_uri(ref.to_s)
213
+
214
+ return nil unless uri
215
+
216
+ return uri if uri.scheme == "file"
217
+ return uri if uri.scheme == "http"
218
+ return uri if uri.scheme == "https"
219
+ return uri if uri.scheme == "ftp"
220
+ # what else ...
221
+
206
222
  nil
207
223
  end
208
224
 
@@ -378,7 +394,7 @@ module OpenWFE
378
394
 
379
395
  return nil unless value
380
396
 
381
- return lookup_attribute(value, rest)
397
+ lookup_attribute(value, rest)
382
398
  end
383
399
 
384
400
  #
@@ -388,7 +404,7 @@ module OpenWFE
388
404
 
389
405
  key, rest = pop_key(key)
390
406
 
391
- if not rest
407
+ unless rest
392
408
 
393
409
  return container.has_key?(key) \
394
410
  if container.respond_to?(:has_key?)
@@ -396,7 +412,7 @@ module OpenWFE
396
412
  return false
397
413
  end
398
414
 
399
- return has_attribute?(rest, key)
415
+ has_attribute?(rest, key)
400
416
  end
401
417
 
402
418
  #
@@ -448,14 +464,14 @@ module OpenWFE
448
464
  def pop_key (key)
449
465
  i = key.index(".")
450
466
  return narrow(key), nil unless i
451
- return narrow(key[0..i-1]), key[i+1..-1]
467
+ [ narrow(key[0..i-1]), key[i+1..-1] ]
452
468
  end
453
469
 
454
470
  def narrow (key)
455
471
  return 0 if key == "0"
456
472
  i = key.to_i
457
473
  return i if i != 0
458
- return key
474
+ key
459
475
  end
460
476
 
461
477
  end
@@ -34,5 +34,5 @@
34
34
  #
35
35
 
36
36
  module OpenWFE
37
- OPENWFERU_VERSION = '0.9.12'
37
+ OPENWFERU_VERSION = '0.9.12.863'
38
38
  end
@@ -30,8 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- # $Id: workitem.rb 3556 2006-11-13 04:15:52Z jmettraux $
34
- #
35
33
 
36
34
  #
37
35
  # "hecho en Costa Rica"
@@ -351,11 +349,39 @@ module OpenWFE
351
349
  alias :wfdurl= :workflow_definition_url=
352
350
 
353
351
  #
354
- # This constructor will build an empty launchitem.
352
+ # This constructor will build an empty LaunchItem.
353
+ #
355
354
  # If the optional parameter process_definition is set, the
356
355
  # definition will be embedded in the launchitem attributes
357
356
  # for retrieval by the engine.
358
357
  #
358
+ # There are several ways to specify the process definition.
359
+ # Here are some examples:
360
+ #
361
+ # # Use a Ruby class that extends OpenWFE::ProcessDefinition
362
+ # LaunchItem.new(MyProcessDefinition)
363
+ #
364
+ # # Provide an XML process definition as a string
365
+ # definition = """
366
+ # <process-definition name="x" revision="y">
367
+ # <sequence>
368
+ # <participant ref="alpha" />
369
+ # <participant ref="bravo" />
370
+ # </sequence>
371
+ # </process-definition>
372
+ # """.strip
373
+ # LaunchItem.new(definition)
374
+ #
375
+ # # Load an XML process definition from a local file
376
+ # require 'uri'
377
+ # LaunchItem.new(URI.new("file:///tmp/my_process_definition.xml"))
378
+ #
379
+ # # If you initialized your engine with
380
+ # # {:remote_definitions_allowed => true}, then you can also load an
381
+ # # XML process definition from a remote url
382
+ # require 'uri'
383
+ # LaunchItem.new(URI.new("http://foo.bar/my_process_definition.xml"))
384
+ #
359
385
  def initialize (process_definition=nil)
360
386
 
361
387
  super()
@@ -30,7 +30,6 @@
30
30
  # POSSIBILITY OF SUCH DAMAGE.
31
31
  #++
32
32
  #
33
- #
34
33
 
35
34
  #
36
35
  # "made in Japan"
@@ -40,7 +39,6 @@
40
39
 
41
40
  require 'openwfe/utils'
42
41
  require 'openwfe/omixins'
43
- require 'openwfe/rudefinitions'
44
42
  require 'openwfe/storage/yamlfilestorage'
45
43
  require 'openwfe/participants/participant'
46
44
 
@@ -233,13 +231,11 @@ module OpenWFE
233
231
  #
234
232
  def initialize (dirname, application_context)
235
233
 
236
- workdir = OpenWFE::get_work_directory
237
-
238
234
  @dirname = OpenWFE::ensure_for_filename(dirname.to_s)
239
235
 
240
236
  service_name = self.class.name + "__" + @dirname
241
237
 
242
- path = workdir + "/participants/" + @dirname
238
+ path = "/participants/" + @dirname
243
239
 
244
240
  super(service_name, application_context, path)
245
241
  end
data/test/console_test.rb CHANGED
@@ -4,10 +4,7 @@ b = 2
4
4
 
5
5
  require 'openwfe/util/irb'
6
6
 
7
- #trap 'INT' do
8
- # OpenWFE::start_irb_session binding()
9
- #end
10
- OpenWFE::bind_console(binding())
7
+ OpenWFE::trap_int_irb(binding())
11
8
 
12
9
  sleep(30)
13
10
 
@@ -0,0 +1,64 @@
1
+ #
2
+ #--
3
+ # Copyright (c) 2007, Urbacon Ltd.
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
+ #
34
+
35
+ #
36
+ # "made in Canada"
37
+ #
38
+ # Matt Zukowski at roughest.net
39
+ # John Mettraux at openwfe.org
40
+ #
41
+
42
+ require 'test/unit'
43
+
44
+ require 'fileutils'
45
+
46
+ require 'openwfe/engine/file_persisted_engine'
47
+
48
+ # Tests to assert correct functionality of the FilePersistedEngine.
49
+ class FilePersistedEngineTest < Test::Unit::TestCase
50
+
51
+ # Test to make sure that persistence data is stored in the specified
52
+ # working directory.
53
+ def test_custom_working_directory
54
+ workdir = "test_custom_working_directory-#{Time.now.to_i}-#{rand(99999)}"
55
+ FileUtils.rm_rf(workdir) if File.exists?(workdir)
56
+
57
+ engine = FilePersistedEngine.new(:work_directory => workdir)
58
+
59
+ assert File.exists?(workdir),
60
+ "Custom working directory '#{workdir}' was not created by #{engine.class} during testing!"
61
+
62
+ FileUtils.rm_rf(workdir)
63
+ end
64
+ end