openwferu 0.9.3 → 0.9.4
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.
- data/examples/flowtracing.rb +22 -0
- data/lib/openwfe/contextual.rb +5 -2
- data/lib/openwfe/def.rb +47 -0
- data/lib/openwfe/engine/engine.rb +1 -1
- data/lib/openwfe/engine/file_persisted_engine.rb +3 -5
- data/lib/openwfe/expool/expressionpool.rb +45 -6
- data/lib/openwfe/expool/history.rb +117 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +21 -4
- data/lib/openwfe/expressions/environment.rb +3 -0
- data/lib/openwfe/expressions/expressionmap.rb +1 -0
- data/lib/openwfe/expressions/fe_concurrence.rb +22 -12
- data/lib/openwfe/expressions/fe_iterator.rb +3 -1
- data/lib/openwfe/expressions/fe_participant.rb +1 -4
- data/lib/openwfe/expressions/fe_raw.rb +2 -2
- data/lib/openwfe/expressions/fe_time.rb +184 -10
- data/lib/openwfe/expressions/fe_utils.rb +10 -0
- data/lib/openwfe/expressions/flowexpression.rb +3 -1
- data/lib/openwfe/expressions/raw_prog.rb +1 -1
- data/lib/openwfe/expressions/timeout.rb +47 -13
- data/lib/openwfe/flowexpressionid.rb +9 -1
- data/lib/openwfe/participants/csvparticipant.rb +127 -0
- data/lib/openwfe/participants/participant.rb +1 -0
- data/lib/openwfe/participants/participants.rb +26 -3
- data/lib/openwfe/rest/controlclient.rb +3 -3
- data/lib/openwfe/rest/worklistclient.rb +6 -8
- data/lib/openwfe/rest/xmlcodec.rb +6 -6
- data/lib/openwfe/rudefinitions.rb +6 -13
- data/lib/openwfe/storage/yamlfilestorage.rb +1 -1
- data/lib/openwfe/tools/flowtracer.rb +80 -0
- data/lib/openwfe/util/csvtable.rb +378 -0
- data/lib/openwfe/util/dollar.rb +24 -7
- data/lib/openwfe/util/observable.rb +82 -0
- data/lib/openwfe/util/scheduler.rb +14 -0
- data/lib/openwfe/utils.rb +64 -0
- data/lib/openwfe/version.rb +38 -0
- data/lib/openwfe/workitem.rb +53 -0
- data/lib/openwfe/worklist/storeparticipant.rb +19 -4
- data/test/csv_test.rb +285 -0
- data/test/fei_test.rb +1 -1
- data/test/file_persistence_test.rb +2 -2
- data/test/flowtestbase.rb +10 -3
- data/test/ft_0.rb +0 -7
- data/test/ft_0d_participant.rb +29 -0
- data/test/ft_11_ppd.rb +26 -1
- data/test/ft_12_blockparticipant.rb +28 -1
- data/test/ft_19_csv.rb +64 -0
- data/test/ft_20_cron.rb +60 -0
- data/test/ft_21_cron.rb +48 -0
- data/test/ft_22_history.rb +68 -0
- data/test/ft_23_when.rb +50 -0
- data/test/ft_23b_when.rb +45 -0
- data/test/ft_24_def.rb +47 -0
- data/test/ft_9_cursor.rb +20 -0
- data/test/rake_qtest.rb +7 -0
- data/test/rake_test.rb +3 -0
- data/test/timeout_test.rb +46 -4
- data/test/wi_test.rb +66 -0
- metadata +21 -3
- data/test/rake_ptest.rb +0 -18
data/lib/openwfe/utils.rb
CHANGED
@@ -211,6 +211,70 @@ module OpenWFE
|
|
211
211
|
return (Time.now.to_f - @start) * 1000
|
212
212
|
end
|
213
213
|
end
|
214
|
+
|
215
|
+
#
|
216
|
+
# This method is used within the InFlowWorkItem and the CsvTable classes.
|
217
|
+
#
|
218
|
+
def OpenWFE.lookup_attribute (container, key)
|
219
|
+
|
220
|
+
key, rest = pop_key(key)
|
221
|
+
value = container[key]
|
222
|
+
|
223
|
+
return value unless rest
|
224
|
+
|
225
|
+
return nil unless value
|
226
|
+
|
227
|
+
return lookup_attribute(value, rest)
|
228
|
+
end
|
229
|
+
|
230
|
+
#
|
231
|
+
# This method is used within the InFlowWorkItem and the CsvTable classes.
|
232
|
+
#
|
233
|
+
def OpenWFE.has_attribute? (container, key)
|
234
|
+
|
235
|
+
key, rest = pop_key(key)
|
236
|
+
|
237
|
+
if not rest
|
238
|
+
|
239
|
+
return container.has_key?(key) \
|
240
|
+
if container.respond_to?(:has_key?)
|
241
|
+
|
242
|
+
return false
|
243
|
+
end
|
244
|
+
|
245
|
+
return has_attribute?(rest, key)
|
246
|
+
end
|
247
|
+
|
248
|
+
#
|
249
|
+
# This method is used within the InFlowWorkItem and the CsvTable classes.
|
250
|
+
#
|
251
|
+
def OpenWFE.set_attribute (container, key, value)
|
252
|
+
|
253
|
+
i = key.rindex(".")
|
254
|
+
|
255
|
+
if not i
|
256
|
+
container[key] = value
|
257
|
+
return
|
258
|
+
end
|
259
|
+
|
260
|
+
container = lookup_attribute(container, key[0..i-1])
|
261
|
+
container[key[i+1..-1]] = value
|
262
|
+
end
|
263
|
+
|
264
|
+
protected
|
265
|
+
|
266
|
+
def pop_key (key)
|
267
|
+
i = key.index(".")
|
268
|
+
return narrow(key), nil unless i
|
269
|
+
return narrow(key[0..i-1]), key[i+1..-1]
|
270
|
+
end
|
271
|
+
|
272
|
+
def narrow (key)
|
273
|
+
return 0 if key == "0"
|
274
|
+
i = key.to_i
|
275
|
+
return i if i != 0
|
276
|
+
return key
|
277
|
+
end
|
214
278
|
|
215
279
|
end
|
216
280
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Copyright (c) 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
|
+
module OpenWFE
|
37
|
+
OPENWFERU_VERSION = '0.9.4'
|
38
|
+
end
|
data/lib/openwfe/workitem.rb
CHANGED
@@ -117,9 +117,62 @@ module OpenWFE
|
|
117
117
|
super(m, args)
|
118
118
|
end
|
119
119
|
|
120
|
+
#
|
121
|
+
# Produces a deep copy of the workitem
|
122
|
+
#
|
120
123
|
def dup
|
121
124
|
return OpenWFE::fulldup(self)
|
122
125
|
end
|
126
|
+
|
127
|
+
#
|
128
|
+
# A smarter alternative to
|
129
|
+
#
|
130
|
+
# value = workitem.attributes[x]
|
131
|
+
#
|
132
|
+
# Via this method, nested values can be reached. For example :
|
133
|
+
#
|
134
|
+
# wi = InFlowWorkItem.new()
|
135
|
+
# wi.attributes = {
|
136
|
+
# "field0" => "value0",
|
137
|
+
# "field1" => [ 0, 1, 2, 3, [ "a", "b", "c" ]],
|
138
|
+
# "field2" => {
|
139
|
+
# "a" => "AA",
|
140
|
+
# "b" => "BB",
|
141
|
+
# "c" => [ "C0", "C1", "C3" ]
|
142
|
+
# },
|
143
|
+
# "field3" => 3,
|
144
|
+
# "field99" => nil
|
145
|
+
# }
|
146
|
+
#
|
147
|
+
# will verify the following assertions :
|
148
|
+
#
|
149
|
+
# assert wi.lookup_attribute("field3") == 3
|
150
|
+
# assert wi.lookup_attribute("field1.1") == 1
|
151
|
+
# assert wi.lookup_attribute("field1.4.1") == "b"
|
152
|
+
# assert wi.lookup_attribute("field2.c.1") == "C1"
|
153
|
+
#
|
154
|
+
def lookup_attribute (key)
|
155
|
+
OpenWFE.lookup_attribute(@attributes, key)
|
156
|
+
end
|
157
|
+
|
158
|
+
#
|
159
|
+
# The partner to the lookup_attribute() method. Behaves like it.
|
160
|
+
#
|
161
|
+
def has_attribute? (key)
|
162
|
+
OpenWFE.has_attribute?(@attributes, key)
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# set_attribute() accomodates itself with nested key constructs.
|
167
|
+
#
|
168
|
+
def set_attribute (key, value)
|
169
|
+
OpenWFE.set_attribute(@attributes, key, value)
|
170
|
+
end
|
171
|
+
|
172
|
+
alias :lookup_field :lookup_attribute
|
173
|
+
alias :has_field? :has_attribute?
|
174
|
+
alias :set_field :set_attribute
|
175
|
+
|
123
176
|
end
|
124
177
|
|
125
178
|
#
|
@@ -35,9 +35,10 @@
|
|
35
35
|
#
|
36
36
|
# "made in Japan"
|
37
37
|
#
|
38
|
-
#
|
38
|
+
# John Mettraux at openwfe.org
|
39
39
|
#
|
40
40
|
|
41
|
+
require 'openwfe/storage/yamlfilestorage'
|
41
42
|
require 'openwfe/participants/participant'
|
42
43
|
|
43
44
|
|
@@ -119,14 +120,16 @@ module OpenWFE
|
|
119
120
|
alias :proceed :forward
|
120
121
|
|
121
122
|
#
|
122
|
-
# Returns all the workitems for a given workflow
|
123
|
+
# Returns all the workitems for a given workflow instance id.
|
124
|
+
# If no workflow_instance_id is given, all the workitems will be
|
125
|
+
# returned.
|
123
126
|
#
|
124
|
-
def list_workitems (workflow_instance_id)
|
127
|
+
def list_workitems (workflow_instance_id=nil)
|
125
128
|
|
126
129
|
result = []
|
127
130
|
self.each_value do |workitem|
|
128
131
|
result << workitem \
|
129
|
-
if workitem.fei.parent_wfid == workflow_instance_id
|
132
|
+
if (not workflow_instance_id) or workitem.fei.parent_wfid == workflow_instance_id
|
130
133
|
end
|
131
134
|
|
132
135
|
result
|
@@ -142,4 +145,16 @@ module OpenWFE
|
|
142
145
|
|
143
146
|
# that's all...
|
144
147
|
end
|
148
|
+
|
149
|
+
#
|
150
|
+
# TODO : finish me
|
151
|
+
#
|
152
|
+
class YamlParticipant < YamlFileStorage
|
153
|
+
include StoreParticipantMixin
|
154
|
+
|
155
|
+
def initialize
|
156
|
+
workpath = application_context[:work_directory] + "/participants"
|
157
|
+
super(service_name, application_context, workpath)
|
158
|
+
end
|
159
|
+
end
|
145
160
|
end
|
data/test/csv_test.rb
ADDED
@@ -0,0 +1,285 @@
|
|
1
|
+
#
|
2
|
+
# Testing OpenWFEru
|
3
|
+
#
|
4
|
+
# John Mettraux at openwfe.org
|
5
|
+
#
|
6
|
+
# Sun Oct 29 15:41:44 JST 2006
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
|
11
|
+
#require 'pp'
|
12
|
+
|
13
|
+
require 'openwfe/workitem'
|
14
|
+
require 'openwfe/participants/csvparticipant'
|
15
|
+
|
16
|
+
#require 'rutest_utils'
|
17
|
+
|
18
|
+
include OpenWFE
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
class CsvTest < Test::Unit::TestCase
|
23
|
+
|
24
|
+
#def setup
|
25
|
+
#end
|
26
|
+
|
27
|
+
#def teardown
|
28
|
+
#end
|
29
|
+
|
30
|
+
CSV0 = \
|
31
|
+
"""
|
32
|
+
,,
|
33
|
+
in:fx,in:fy,out:fz
|
34
|
+
,,
|
35
|
+
a,b,0
|
36
|
+
c,d,1
|
37
|
+
e,f,2
|
38
|
+
"""
|
39
|
+
|
40
|
+
def test_csv_0
|
41
|
+
|
42
|
+
wi = InFlowWorkItem.new()
|
43
|
+
|
44
|
+
wi.fx = "c"
|
45
|
+
wi.fy = "d"
|
46
|
+
|
47
|
+
do_test(CSV0, wi, { "fz" => "1" }, false)
|
48
|
+
|
49
|
+
wi.attributes.clear()
|
50
|
+
wi.fx = "a"
|
51
|
+
wi.fy = "d"
|
52
|
+
|
53
|
+
do_test(CSV0, wi, { "fz" => nil }, false)
|
54
|
+
end
|
55
|
+
|
56
|
+
CSV1 = \
|
57
|
+
"""
|
58
|
+
,,
|
59
|
+
in:fx,in:fy,out:fz
|
60
|
+
,,
|
61
|
+
a,${f:fx},0
|
62
|
+
c,d,${f:fx}
|
63
|
+
e,f,${r:3+4}
|
64
|
+
"""
|
65
|
+
|
66
|
+
def test_csv_1
|
67
|
+
|
68
|
+
wi = InFlowWorkItem.new()
|
69
|
+
|
70
|
+
wi.fx = "c"
|
71
|
+
wi.fy = "d"
|
72
|
+
|
73
|
+
do_test(CSV1, wi, { "fz" => "c" }, false)
|
74
|
+
|
75
|
+
wi.attributes.clear()
|
76
|
+
wi.fx = "e"
|
77
|
+
wi.fy = "f"
|
78
|
+
|
79
|
+
do_test(CSV1, wi, { "fz" => "7" }, false)
|
80
|
+
|
81
|
+
wi.attributes.clear()
|
82
|
+
wi.fx = "a"
|
83
|
+
wi.fy = "a"
|
84
|
+
|
85
|
+
do_test(CSV1, wi, { "fz" => "0" }, false)
|
86
|
+
end
|
87
|
+
|
88
|
+
CSV2 = \
|
89
|
+
"""
|
90
|
+
in:fx, in:fy, out:fz
|
91
|
+
,,
|
92
|
+
a, b, 0
|
93
|
+
c, d, 1
|
94
|
+
e, f, 2
|
95
|
+
"""
|
96
|
+
|
97
|
+
def test_csv_2
|
98
|
+
|
99
|
+
wi = InFlowWorkItem.new()
|
100
|
+
|
101
|
+
wi.fx = "c"
|
102
|
+
wi.fy = "d"
|
103
|
+
|
104
|
+
do_test(CSV2, wi, { "fz" => "1" }, false)
|
105
|
+
|
106
|
+
wi.attributes.clear()
|
107
|
+
wi.fx = "a"
|
108
|
+
wi.fy = "d"
|
109
|
+
|
110
|
+
do_test(CSV2, wi, { "fz" => nil }, false)
|
111
|
+
end
|
112
|
+
|
113
|
+
CSV3 = \
|
114
|
+
"""
|
115
|
+
in:weather, in:month, out:take_umbrella?
|
116
|
+
,,
|
117
|
+
raining, , yes
|
118
|
+
sunny, , no
|
119
|
+
cloudy, june, yes
|
120
|
+
cloudy, may, yes
|
121
|
+
cloudy, , no
|
122
|
+
"""
|
123
|
+
|
124
|
+
def test_csv_3
|
125
|
+
|
126
|
+
wi = InFlowWorkItem.new()
|
127
|
+
|
128
|
+
wi.weather = "raining"
|
129
|
+
wi.month = "december"
|
130
|
+
|
131
|
+
do_test(CSV3, wi, { "take_umbrella?" => "yes" }, false)
|
132
|
+
|
133
|
+
wi.attributes.clear()
|
134
|
+
wi.weather = "cloudy"
|
135
|
+
wi.month = "june"
|
136
|
+
|
137
|
+
do_test(CSV3, wi, { "take_umbrella?" => "yes" }, false)
|
138
|
+
|
139
|
+
wi.attributes.clear()
|
140
|
+
wi.weather = "cloudy"
|
141
|
+
wi.month = "march"
|
142
|
+
|
143
|
+
do_test(CSV3, wi, { "take_umbrella?" => "no" }, false)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_csv_3b
|
147
|
+
|
148
|
+
h = {}
|
149
|
+
h["weather"] = "raining"
|
150
|
+
h["month"] = "december"
|
151
|
+
do_test(CSV3, h, { "take_umbrella?" => "yes" }, false)
|
152
|
+
|
153
|
+
h = {}
|
154
|
+
h["weather"] = "cloudy"
|
155
|
+
h["month"] = "june"
|
156
|
+
do_test(CSV3, h, { "take_umbrella?" => "yes" }, false)
|
157
|
+
|
158
|
+
h = {}
|
159
|
+
h["weather"] = "cloudy"
|
160
|
+
h["month"] = "march"
|
161
|
+
do_test(CSV3, h, { "take_umbrella?" => "no" }, false)
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_csv_3c
|
165
|
+
|
166
|
+
table = CsvTable.new("""
|
167
|
+
in:topic,in:region,out:team_member
|
168
|
+
sports,europe,Alice
|
169
|
+
sports,,Bob
|
170
|
+
finance,america,Charly
|
171
|
+
finance,europe,Donald
|
172
|
+
finance,,Ernest
|
173
|
+
politics,asia,Fujio
|
174
|
+
politics,america,Gilbert
|
175
|
+
politics,,Henry
|
176
|
+
,,Zach
|
177
|
+
""")
|
178
|
+
|
179
|
+
h = {}
|
180
|
+
h["topic"] = "politics"
|
181
|
+
table.transform(h)
|
182
|
+
|
183
|
+
assert h["team_member"] == "Henry"
|
184
|
+
end
|
185
|
+
|
186
|
+
# CSV4 = \
|
187
|
+
#'''
|
188
|
+
#"in:weather", "in:month", "out:take_umbrella?"
|
189
|
+
#"","",""
|
190
|
+
#"raining","","yes"
|
191
|
+
#"sunny","","no"
|
192
|
+
#"cloudy","june","yes"
|
193
|
+
#"cloudy","may","yes"
|
194
|
+
#"cloudy","","no"
|
195
|
+
#'''
|
196
|
+
|
197
|
+
#def test_csv_4
|
198
|
+
# h = {}
|
199
|
+
# h["weather"] = "raining"
|
200
|
+
# h["month"] = "december"
|
201
|
+
# do_test(CSV4, h, { "take_umbrella?" => "yes" }, false)
|
202
|
+
# h = {}
|
203
|
+
# h["weather"] = "cloudy"
|
204
|
+
# h["month"] = "june"
|
205
|
+
# do_test(CSV4, h, { "take_umbrella?" => "yes" }, false)
|
206
|
+
# h = {}
|
207
|
+
# h["weather"] = "cloudy"
|
208
|
+
# h["month"] = "march"
|
209
|
+
# do_test(CSV4, h, { "take_umbrella?" => "no" }, false)
|
210
|
+
#end
|
211
|
+
|
212
|
+
CSV5 = \
|
213
|
+
"""
|
214
|
+
through,ignorecase,,
|
215
|
+
,,,
|
216
|
+
in:fx, in:fy, out:fX, out:fY
|
217
|
+
,,,
|
218
|
+
a, , true,
|
219
|
+
, a, , true
|
220
|
+
b, , false,
|
221
|
+
, b, , false
|
222
|
+
"""
|
223
|
+
|
224
|
+
def test_csv_5
|
225
|
+
|
226
|
+
wi = InFlowWorkItem.new()
|
227
|
+
wi.fx = "a"
|
228
|
+
wi.fy = "a"
|
229
|
+
do_test(CSV5, wi, { "fX" => "true", "fY" => "true" }, false)
|
230
|
+
|
231
|
+
wi.attributes.clear
|
232
|
+
wi.fx = "a"
|
233
|
+
wi.fy = "b"
|
234
|
+
do_test(CSV5, wi, { "fX" => "true", "fY" => "false" }, false)
|
235
|
+
|
236
|
+
wi.attributes.clear
|
237
|
+
wi.fx = "A"
|
238
|
+
wi.fy = "b"
|
239
|
+
do_test(CSV5, wi, { "fX" => "true", "fY" => "false" }, false)
|
240
|
+
end
|
241
|
+
|
242
|
+
protected
|
243
|
+
|
244
|
+
def do_test (table_data, wi, expected_result, verbose=false)
|
245
|
+
|
246
|
+
table = CsvTable.new(table_data)
|
247
|
+
|
248
|
+
if verbose
|
249
|
+
puts
|
250
|
+
puts "before :"
|
251
|
+
puts wi
|
252
|
+
end
|
253
|
+
|
254
|
+
wi = if wi.kind_of? Hash
|
255
|
+
table.transform(wi)
|
256
|
+
else
|
257
|
+
table.transform_wi(nil, wi)
|
258
|
+
end
|
259
|
+
|
260
|
+
if verbose
|
261
|
+
puts
|
262
|
+
puts "after :"
|
263
|
+
puts wi
|
264
|
+
end
|
265
|
+
|
266
|
+
expected_result.each do |k, v|
|
267
|
+
|
268
|
+
#if wi.attributes[k] != v
|
269
|
+
#end
|
270
|
+
|
271
|
+
value = if wi.kind_of? Hash
|
272
|
+
wi[k]
|
273
|
+
else
|
274
|
+
wi.attributes[k]
|
275
|
+
end
|
276
|
+
|
277
|
+
assert \
|
278
|
+
value == v,
|
279
|
+
"attribute '#{k}' should be set to '#{v}' "+
|
280
|
+
"but is set to '#{value}'"
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
data/test/fei_test.rb
CHANGED
@@ -134,7 +134,7 @@ class FeiTest < Test::Unit::TestCase
|
|
134
134
|
|
135
135
|
def new_fei ()
|
136
136
|
fei = OpenWFE::FlowExpressionId.new()
|
137
|
-
fei.owfe_version = OpenWFE::
|
137
|
+
fei.owfe_version = OpenWFE::OPENWFERU_VERSION
|
138
138
|
fei.engine_id = 'this'
|
139
139
|
fei.initial_engine_id = 'that'
|
140
140
|
fei.workflow_definition_url = 'http://test/test.xml'
|
@@ -79,8 +79,8 @@ class FilePersistenceTest < Test::Unit::TestCase
|
|
79
79
|
|
80
80
|
def new_fei (definition_name = nil)
|
81
81
|
|
82
|
-
fei =
|
83
|
-
fei.owfe_version =
|
82
|
+
fei = FlowExpressionId.new()
|
83
|
+
fei.owfe_version = OPENWFERU_VERSION
|
84
84
|
fei.engine_id = 'this'
|
85
85
|
fei.initial_engine_id = 'that'
|
86
86
|
fei.workflow_definition_url = 'http://test/test.xml'
|
data/test/flowtestbase.rb
CHANGED
@@ -19,12 +19,19 @@ require 'rutest_utils'
|
|
19
19
|
|
20
20
|
include OpenWFE
|
21
21
|
|
22
|
+
persistence = ENV["__persistence__"]
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
|
25
|
+
$WORKFLOW_ENGINE_CLASS = Engine
|
26
|
+
if persistence == "FilePersistedEngine"
|
27
|
+
require "openwfe/engine/file_persisted_engine"
|
28
|
+
$WORKFLOW_ENGINE_CLASS = FilePersistedEngine
|
29
|
+
end
|
30
|
+
|
25
31
|
|
26
32
|
puts
|
27
33
|
puts "testing with engine of class " + $WORKFLOW_ENGINE_CLASS.to_s
|
34
|
+
#puts "testing with engine of class " + ENV["workflow_engine_class"]
|
28
35
|
puts
|
29
36
|
|
30
37
|
class FlowTestBase < Test::Unit::TestCase
|
@@ -34,7 +41,7 @@ class FlowTestBase < Test::Unit::TestCase
|
|
34
41
|
|
35
42
|
def setup
|
36
43
|
|
37
|
-
@engine = $WORKFLOW_ENGINE_CLASS.new()
|
44
|
+
@engine = eval("#{$WORKFLOW_ENGINE_CLASS}").new()
|
38
45
|
|
39
46
|
@tracer = Tracer.new
|
40
47
|
@engine.application_context["__tracer"] = @tracer
|
data/test/ft_0.rb
CHANGED
@@ -25,13 +25,6 @@ class FlowTest0 < FlowTestBase
|
|
25
25
|
</process-definition>''', "ok")
|
26
26
|
end
|
27
27
|
|
28
|
-
def test_participant
|
29
|
-
dotest(\
|
30
|
-
'''<process-definition name="n" revision="0">
|
31
|
-
<participant ref="test-alpha" />
|
32
|
-
</process-definition>''', "test-alpha")
|
33
|
-
end
|
34
|
-
|
35
28
|
def test_dollar_notation_0
|
36
29
|
dotest(\
|
37
30
|
'''<process-definition name="n" revision="0">
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Mon Oct 9 22:19:44 JST 2006
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'flowtestbase'
|
11
|
+
|
12
|
+
|
13
|
+
class FlowTest0d < FlowTestBase
|
14
|
+
|
15
|
+
#def setup
|
16
|
+
#end
|
17
|
+
|
18
|
+
#def teardown
|
19
|
+
#end
|
20
|
+
|
21
|
+
def test_participant
|
22
|
+
dotest(\
|
23
|
+
'''<process-definition name="n" revision="0">
|
24
|
+
<participant ref="test-alpha" />
|
25
|
+
</process-definition>''', "test-alpha")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
data/test/ft_11_ppd.rb
CHANGED
@@ -8,7 +8,8 @@
|
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'flowtestbase'
|
11
|
-
require 'openwfe/expressions/raw_prog'
|
11
|
+
#require 'openwfe/expressions/raw_prog'
|
12
|
+
require 'openwfe/def'
|
12
13
|
|
13
14
|
include OpenWFE
|
14
15
|
|
@@ -337,5 +338,29 @@ b""")
|
|
337
338
|
"toto")
|
338
339
|
end
|
339
340
|
|
341
|
+
|
342
|
+
#
|
343
|
+
# Test 9
|
344
|
+
#
|
345
|
+
|
346
|
+
class TestDefinition9 < ProcessDefinition
|
347
|
+
def make
|
348
|
+
process_definition :name => "test8", :revision => "0" do
|
349
|
+
_toto
|
350
|
+
process_definition :name => "toto" do
|
351
|
+
_print "toto"
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
def test_ppd_9
|
358
|
+
#def xxxx_ppd_9
|
359
|
+
|
360
|
+
dotest(
|
361
|
+
TestDefinition9,
|
362
|
+
"toto")
|
363
|
+
end
|
364
|
+
|
340
365
|
end
|
341
366
|
|
@@ -19,6 +19,7 @@ class FlowTest12 < FlowTestBase
|
|
19
19
|
#def teardown
|
20
20
|
#end
|
21
21
|
|
22
|
+
|
22
23
|
#
|
23
24
|
# Test 0
|
24
25
|
#
|
@@ -34,12 +35,38 @@ class FlowTest12 < FlowTestBase
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
def
|
38
|
+
def test_bp_0
|
38
39
|
dotest(
|
39
40
|
BpDef0,
|
40
41
|
"""the block participant received a workitem
|
41
42
|
done.""")
|
42
43
|
end
|
43
44
|
|
45
|
+
|
46
|
+
#
|
47
|
+
# Test 1
|
48
|
+
#
|
49
|
+
|
50
|
+
class BpDef1 < OpenWFE::ProcessDefinition
|
51
|
+
def make
|
52
|
+
process_definition :name => "test1", :revision => "0" do
|
53
|
+
bp1a
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_bp_1
|
59
|
+
|
60
|
+
@engine.register_participant("bp1a") do |fexp, wi|
|
61
|
+
@tracer << "bp1a : "
|
62
|
+
@tracer << fexp.class.name
|
63
|
+
@tracer << "\n"
|
64
|
+
end
|
65
|
+
|
66
|
+
dotest(
|
67
|
+
BpDef1,
|
68
|
+
"""bp1a : OpenWFE::ParticipantExpression""")
|
69
|
+
end
|
70
|
+
|
44
71
|
end
|
45
72
|
|