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.
- data/examples/engine_template.rb +30 -0
- data/lib/openwfe/contextual.rb +21 -0
- data/lib/openwfe/engine/engine.rb +24 -24
- data/lib/openwfe/expool/errorjournal.rb +1 -3
- data/lib/openwfe/expool/expressionpool.rb +29 -24
- data/lib/openwfe/expool/history.rb +1 -3
- data/lib/openwfe/expool/journal.rb +1 -3
- data/lib/openwfe/expool/wfidgen.rb +1 -3
- data/lib/openwfe/expool/yamlexpstorage.rb +7 -7
- data/lib/openwfe/expressions/environment.rb +17 -6
- data/lib/openwfe/expressions/expressionmap.rb +1 -2
- data/lib/openwfe/expressions/fe_command.rb +227 -0
- data/lib/openwfe/expressions/fe_concurrence.rb +8 -6
- data/lib/openwfe/expressions/fe_cursor.rb +3 -157
- data/lib/openwfe/expressions/fe_define.rb +6 -5
- data/lib/openwfe/expressions/fe_if.rb +8 -2
- data/lib/openwfe/expressions/fe_iterator.rb +141 -35
- data/lib/openwfe/expressions/fe_subprocess.rb +3 -29
- data/lib/openwfe/expressions/fe_value.rb +1 -4
- data/lib/openwfe/expressions/flowexpression.rb +0 -5
- data/lib/openwfe/expressions/raw.rb +0 -2
- data/lib/openwfe/expressions/raw_prog.rb +15 -15
- data/lib/openwfe/flowexpressionid.rb +3 -3
- data/lib/openwfe/listeners/listeners.rb +2 -6
- data/lib/openwfe/participants/enoparticipants.rb +1 -2
- data/lib/openwfe/participants/participantmap.rb +0 -2
- data/lib/openwfe/participants/participants.rb +95 -4
- data/lib/openwfe/participants/soapparticipants.rb +15 -8
- data/lib/openwfe/rest/osocket.rb +2 -3
- data/lib/openwfe/rest/xmlcodec.rb +0 -2
- data/lib/openwfe/rudefinitions.rb +0 -17
- data/lib/openwfe/storage/yamlfilestorage.rb +3 -8
- data/lib/openwfe/util/observable.rb +4 -2
- data/lib/openwfe/util/otime.rb +10 -9
- data/lib/openwfe/util/safe.rb +9 -6
- data/lib/openwfe/util/scheduler.rb +60 -9
- data/lib/openwfe/util/schedulers.rb +1 -1
- data/lib/openwfe/util/workqueue.rb +0 -3
- data/lib/openwfe/utils.rb +27 -11
- data/lib/openwfe/version.rb +1 -1
- data/lib/openwfe/workitem.rb +29 -3
- data/lib/openwfe/worklist/storeparticipant.rb +1 -5
- data/test/console_test.rb +1 -4
- data/test/file_persisted_engine_test.rb +64 -0
- data/test/file_persistence_test.rb +22 -1
- data/test/ft_15_iterator.rb +55 -1
- data/test/ft_20_cron.rb +0 -1
- data/test/ft_21_cron.rb +0 -1
- data/test/ft_26c_load.rb +4 -10
- data/test/ft_32_journal.rb +2 -2
- data/test/ft_61_elsub.rb +51 -0
- data/test/ft_62_procparticipant.rb +65 -0
- data/test/ft_tests.rb +3 -1
- data/test/hparticipant_test.rb +3 -3
- data/test/misc_test.rb +1 -1
- data/test/obs_test.rb +27 -0
- data/test/rake_qtest.rb +4 -3
- data/test/safely_test.rb +6 -1
- data/test/scheduler_test.rb +85 -2
- data/test/sec_test.rb +9 -7
- metadata +6 -14
- data/lib/openwfe/listeners/sqslisteners.rb +0 -145
- data/lib/openwfe/participants/atomparticipants.rb +0 -181
- data/lib/openwfe/participants/csvparticipants.rb +0 -127
- data/lib/openwfe/participants/sqsparticipants.rb +0 -121
- data/lib/openwfe/storage/yamlextras.rb +0 -115
- data/lib/openwfe/util/csvtable.rb +0 -448
- data/lib/openwfe/util/sqs.rb +0 -581
- data/test/atom_test.rb +0 -100
- data/test/csv_test.rb +0 -342
- data/test/ft_19_csv.rb +0 -65
- data/test/rest_test.rb +0 -189
- data/test/sqs_test.rb +0 -103
data/test/csv_test.rb
DELETED
@@ -1,342 +0,0 @@
|
|
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/csvparticipants'
|
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
|
-
#
|
243
|
-
# TEST 6
|
244
|
-
|
245
|
-
CSV6 = \
|
246
|
-
"""
|
247
|
-
,
|
248
|
-
in:fx, out:fy
|
249
|
-
,
|
250
|
-
<10,a
|
251
|
-
<=100,b
|
252
|
-
,c
|
253
|
-
"""
|
254
|
-
|
255
|
-
def test_csv_6
|
256
|
-
|
257
|
-
wi = InFlowWorkItem.new()
|
258
|
-
|
259
|
-
wi.fx = "5"
|
260
|
-
do_test(CSV6, wi, { "fy" => "a" }, false)
|
261
|
-
|
262
|
-
wi.attributes.clear()
|
263
|
-
|
264
|
-
wi.fx = "100.0001"
|
265
|
-
do_test(CSV6, wi, { "fy" => "c" }, false)
|
266
|
-
end
|
267
|
-
|
268
|
-
#
|
269
|
-
# TEST 7
|
270
|
-
|
271
|
-
CSV7 = \
|
272
|
-
"""
|
273
|
-
,
|
274
|
-
in:fx, out:fy
|
275
|
-
,
|
276
|
-
>100,a
|
277
|
-
>=10,b
|
278
|
-
,c
|
279
|
-
"""
|
280
|
-
|
281
|
-
def test_csv_7
|
282
|
-
|
283
|
-
wi = InFlowWorkItem.new()
|
284
|
-
|
285
|
-
wi.fx = "5"
|
286
|
-
do_test(CSV7, wi, { "fy" => "c" }, false)
|
287
|
-
|
288
|
-
wi.attributes.clear()
|
289
|
-
|
290
|
-
wi.fx = "10"
|
291
|
-
do_test(CSV7, wi, { "fy" => "b" }, false)
|
292
|
-
|
293
|
-
wi.attributes.clear()
|
294
|
-
|
295
|
-
wi.fx = "10a"
|
296
|
-
do_test(CSV7, wi, { "fy" => "a" }, false)
|
297
|
-
end
|
298
|
-
|
299
|
-
protected
|
300
|
-
|
301
|
-
def do_test (table_data, wi, expected_result, verbose=false)
|
302
|
-
|
303
|
-
table = CsvTable.new(table_data)
|
304
|
-
|
305
|
-
if verbose
|
306
|
-
puts
|
307
|
-
puts "before :"
|
308
|
-
puts wi
|
309
|
-
end
|
310
|
-
|
311
|
-
wi = if wi.kind_of? Hash
|
312
|
-
table.transform(wi)
|
313
|
-
else
|
314
|
-
table.transform_wi(nil, wi)
|
315
|
-
end
|
316
|
-
|
317
|
-
if verbose
|
318
|
-
puts
|
319
|
-
puts "after :"
|
320
|
-
puts wi
|
321
|
-
end
|
322
|
-
|
323
|
-
expected_result.each do |k, v|
|
324
|
-
|
325
|
-
#if wi.attributes[k] != v
|
326
|
-
#end
|
327
|
-
|
328
|
-
value = if wi.kind_of? Hash
|
329
|
-
wi[k]
|
330
|
-
else
|
331
|
-
wi.attributes[k]
|
332
|
-
end
|
333
|
-
|
334
|
-
assert \
|
335
|
-
value == v,
|
336
|
-
"attribute '#{k}' should be set to '#{v}' "+
|
337
|
-
"but is set to '#{value}'"
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
end
|
342
|
-
|
data/test/ft_19_csv.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Testing OpenWFEru
|
4
|
-
#
|
5
|
-
# John Mettraux at openwfe.org
|
6
|
-
#
|
7
|
-
|
8
|
-
require 'flowtestbase'
|
9
|
-
require 'openwfe/expressions/raw_prog'
|
10
|
-
require 'openwfe/participants/csvparticipants'
|
11
|
-
|
12
|
-
include OpenWFE
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
class FlowTest19 < Test::Unit::TestCase
|
17
|
-
include FlowTestBase
|
18
|
-
|
19
|
-
CSV0 = \
|
20
|
-
"""
|
21
|
-
in:weather, in:month, out:take_umbrella?
|
22
|
-
,,
|
23
|
-
raining, , yes
|
24
|
-
sunny, , no
|
25
|
-
cloudy, june, yes
|
26
|
-
cloudy, may, yes
|
27
|
-
cloudy, , no
|
28
|
-
"""
|
29
|
-
|
30
|
-
#def setup
|
31
|
-
#end
|
32
|
-
|
33
|
-
#def teardown
|
34
|
-
#end
|
35
|
-
|
36
|
-
#
|
37
|
-
# Test 0
|
38
|
-
#
|
39
|
-
|
40
|
-
class TestDefinition0 < ProcessDefinition
|
41
|
-
def make
|
42
|
-
process_definition :name => "test0", :revision => "0" do
|
43
|
-
sequence do
|
44
|
-
set :field => "weather", :value => "cloudy"
|
45
|
-
set :field => "month", :value => "may"
|
46
|
-
decision
|
47
|
-
_print "${f:take_umbrella?}"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_0
|
54
|
-
|
55
|
-
csvParticipant = CsvParticipant.new(CSV0)
|
56
|
-
|
57
|
-
@engine.register_participant("decision", csvParticipant)
|
58
|
-
|
59
|
-
dotest(
|
60
|
-
TestDefinition0,
|
61
|
-
"yes")
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
data/test/rest_test.rb
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
#
|
2
|
-
#--
|
3
|
-
# Copyright (c) 2005-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: test.rb 3454 2006-10-08 16:51:00Z jmettraux $
|
34
|
-
#
|
35
|
-
|
36
|
-
#
|
37
|
-
# "hecho en Costa Rica"
|
38
|
-
# "Rewritten as a unit test in Japan"
|
39
|
-
#
|
40
|
-
|
41
|
-
require 'test/unit'
|
42
|
-
|
43
|
-
require 'worklistclient'
|
44
|
-
require 'controlclient'
|
45
|
-
|
46
|
-
|
47
|
-
#
|
48
|
-
# TESTING THE WORKLIST AND THE CONTROL INTERFACES
|
49
|
-
#
|
50
|
-
|
51
|
-
OWFE_HOST = ENV['OWFE_HOST']
|
52
|
-
OWFE_HOST = "127.0.0.1" if not OWFE_HOST
|
53
|
-
|
54
|
-
|
55
|
-
class RestTest < Test::Unit::TestCase
|
56
|
-
|
57
|
-
#def setup
|
58
|
-
#end
|
59
|
-
|
60
|
-
#def teardown
|
61
|
-
#end
|
62
|
-
|
63
|
-
def test_worklist_0
|
64
|
-
#def xxxx_worklist_0
|
65
|
-
|
66
|
-
client = OpenWFE::WorklistClient\
|
67
|
-
.new("http://#{OWFE_HOST}:5080/worklist", "alice", "alice")
|
68
|
-
|
69
|
-
puts "session_id : #{client.session_id}"
|
70
|
-
|
71
|
-
#puts client.get('getstorenames', nil, nil)
|
72
|
-
|
73
|
-
puts "Stores :"
|
74
|
-
l = client.list_stores()
|
75
|
-
l.each do |s|
|
76
|
-
puts " - store name : '#{s.name}' wi count : #{s.workitem_count} permissions : #{s.permissions}"
|
77
|
-
end
|
78
|
-
|
79
|
-
puts
|
80
|
-
|
81
|
-
puts "launching a flow"
|
82
|
-
li = OpenWFE::LaunchItem.new()
|
83
|
-
li.workflow_definition_url = "http://localhost:7079/flow__1.0.xml"
|
84
|
-
li.attributes["__subject__"] = "openwfe-ruby"
|
85
|
-
|
86
|
-
fei = client.launch_flow("mainEngine", li)
|
87
|
-
puts fei
|
88
|
-
|
89
|
-
puts
|
90
|
-
|
91
|
-
feiToFetch = nil
|
92
|
-
|
93
|
-
puts "Store.alpha's headers :"
|
94
|
-
l = client.get_headers("Store.alpha")
|
95
|
-
l.each do |h|
|
96
|
-
puts " - header lastModified : #{h.last_modified} locked : #{h.locked} ac : #{h.attributes.length}"
|
97
|
-
puts " fei : #{h.flow_expression_id}"
|
98
|
-
|
99
|
-
feiToFetch = h.flow_expression_id
|
100
|
-
end
|
101
|
-
|
102
|
-
puts "Fetching the first workitem :"
|
103
|
-
wi = client.get_workitem("Store.alpha", feiToFetch)
|
104
|
-
|
105
|
-
#puts wi.inspect()
|
106
|
-
puts
|
107
|
-
|
108
|
-
puts "Fetching (and locking) the first workitem :"
|
109
|
-
wi = client.get_and_lock_workitem("Store.alpha", feiToFetch)
|
110
|
-
|
111
|
-
puts wi.inspect()
|
112
|
-
|
113
|
-
puts
|
114
|
-
|
115
|
-
puts "Releasing the workitem :"
|
116
|
-
puts "ok" if client.release_workitem(wi)
|
117
|
-
|
118
|
-
puts
|
119
|
-
|
120
|
-
puts "Listing launchables :"
|
121
|
-
client.list_launchables().each do |l|
|
122
|
-
puts " - launchable #{l.engine_id} :: #{l.url}"
|
123
|
-
end
|
124
|
-
|
125
|
-
puts
|
126
|
-
|
127
|
-
puts "Closing worklist worksession"
|
128
|
-
client.close()
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_control_0
|
132
|
-
#def xxxx_control_0
|
133
|
-
|
134
|
-
puts "Testing the control interface..."
|
135
|
-
|
136
|
-
#
|
137
|
-
# launching a test flow
|
138
|
-
|
139
|
-
#TEST_NAME = '-- testing ruby control (0) --'
|
140
|
-
|
141
|
-
#client = OpenWFE::WorklistClient\
|
142
|
-
# .new("http://127.0.0.1:5080/worklist", "alice", "alice")
|
143
|
-
|
144
|
-
#li = OpenWFE::LaunchItem.new()
|
145
|
-
#li.workflowDefinitionUrl = "http://localhost:7079/flow__1.0.xml"
|
146
|
-
#li.attributes["__subject__"] = TEST_NAME
|
147
|
-
|
148
|
-
#fei = client.launchFlow("mainEngine", li)
|
149
|
-
#puts "launched : #{fei}"
|
150
|
-
|
151
|
-
#client.close()
|
152
|
-
|
153
|
-
#
|
154
|
-
# controlling the test flow
|
155
|
-
|
156
|
-
client = OpenWFE::ControlClient\
|
157
|
-
.new("http://#{OWFE_HOST}:6080/engine", "admin", "admin")
|
158
|
-
|
159
|
-
puts "sessionId : #{client.session_id}"
|
160
|
-
|
161
|
-
puts
|
162
|
-
|
163
|
-
puts "listing expressions :"
|
164
|
-
exps = client.list_expressions()
|
165
|
-
display_expressions(exps)
|
166
|
-
|
167
|
-
puts
|
168
|
-
|
169
|
-
wfid = exps[-1].id.workflow_instance_id
|
170
|
-
puts "get_flow_stack() for flow #{wfid}"
|
171
|
-
exps = client.get_flow_stack(wfid)
|
172
|
-
display_expressions(exps)
|
173
|
-
|
174
|
-
client.close()
|
175
|
-
end
|
176
|
-
|
177
|
-
protected
|
178
|
-
|
179
|
-
def display_expressions (exps)
|
180
|
-
i = 0
|
181
|
-
exps.each do |exp|
|
182
|
-
print " - exp #{i} : #{exp.id}"
|
183
|
-
print " / #{exp.apply_time}" if exp.apply_time
|
184
|
-
print "\n"
|
185
|
-
i = i+1
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
data/test/sqs_test.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# testing the sqs with yaml messages
|
4
|
-
#
|
5
|
-
|
6
|
-
require 'test/unit'
|
7
|
-
|
8
|
-
require 'yaml'
|
9
|
-
require 'base64'
|
10
|
-
require 'openwfe/def'
|
11
|
-
require 'openwfe/util/sqs'
|
12
|
-
require 'openwfe/engine/engine'
|
13
|
-
require 'openwfe/listeners/sqslisteners'
|
14
|
-
require 'openwfe/participants/sqsparticipants'
|
15
|
-
|
16
|
-
|
17
|
-
class SqsTest < Test::Unit::TestCase
|
18
|
-
|
19
|
-
#def setup
|
20
|
-
#end
|
21
|
-
|
22
|
-
#def teardown
|
23
|
-
#end
|
24
|
-
|
25
|
-
#def xxxx_0
|
26
|
-
def test_0
|
27
|
-
|
28
|
-
hash = {
|
29
|
-
:red => :color,
|
30
|
-
:count => "twelve",
|
31
|
-
"fish" => "sakana",
|
32
|
-
:llen => 4,
|
33
|
-
:list => [ 0, 1, 2, 3, 4, :fizz ]
|
34
|
-
}
|
35
|
-
|
36
|
-
qs = SQS::QueueService.new
|
37
|
-
|
38
|
-
qs.create_queue(:yamltest)
|
39
|
-
|
40
|
-
puts "created queue 'yamltest'"
|
41
|
-
|
42
|
-
msg = YAML.dump(hash)
|
43
|
-
msg = Base64.encode64(msg)
|
44
|
-
|
45
|
-
puts "message size is #{msg.size.to_f / 1024.0} K"
|
46
|
-
|
47
|
-
msg_id = qs.put_message(:yamltest, msg)
|
48
|
-
|
49
|
-
puts "sent hash as message, msg_id is #{msg_id}"
|
50
|
-
|
51
|
-
sleep(1)
|
52
|
-
|
53
|
-
msg = qs.get_message(:yamltest, msg_id)
|
54
|
-
|
55
|
-
puts "got message back"
|
56
|
-
|
57
|
-
msg = Base64.decode64(msg.message_body)
|
58
|
-
msg = YAML.load(msg)
|
59
|
-
|
60
|
-
pp msg
|
61
|
-
|
62
|
-
assert msg == hash
|
63
|
-
|
64
|
-
count = qs.flush_queue(:yamltest)
|
65
|
-
|
66
|
-
puts "flushed #{count} messages from queue 'yamltest'"
|
67
|
-
|
68
|
-
qs.delete_queue(:yamltest)
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
class SqsDefinition0 < OpenWFE::ProcessDefinition
|
73
|
-
def make
|
74
|
-
participant :sqs
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
#def xxxx_participant_0
|
79
|
-
def test_participant_0
|
80
|
-
|
81
|
-
engine = OpenWFE::Engine.new
|
82
|
-
|
83
|
-
sqsp = SqsParticipant.new("wiqueue")
|
84
|
-
#class << sqsp
|
85
|
-
# def encode_workitem (wi)
|
86
|
-
# "hello from #{@queue.name} #{wi.fei.workflow_instance_id}"
|
87
|
-
# end
|
88
|
-
#end
|
89
|
-
|
90
|
-
engine.register_participant(:sqs, sqsp)
|
91
|
-
|
92
|
-
engine.add_workitem_listener(
|
93
|
-
OpenWFE::SqsListener.new(:wiqueue, engine.application_context),
|
94
|
-
"2s")
|
95
|
-
|
96
|
-
engine.launch(SqsDefinition0)
|
97
|
-
|
98
|
-
sleep(5)
|
99
|
-
|
100
|
-
qs = sqsp.queue_service
|
101
|
-
qs.delete_queue("wiqueue")
|
102
|
-
end
|
103
|
-
end
|