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
@@ -19,7 +19,7 @@ class FilePersistenceTest < Test::Unit::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def ac
|
22
|
-
|
22
|
+
@engine.application_context
|
23
23
|
end
|
24
24
|
|
25
25
|
#
|
@@ -33,8 +33,8 @@ class FilePersistenceTest < Test::Unit::TestCase
|
|
33
33
|
# flow expression check
|
34
34
|
def test_flow_expression
|
35
35
|
fei = new_fei()
|
36
|
-
fes = YamlFileExpressionStorage.new
|
37
|
-
fe = SequenceExpression.
|
36
|
+
fes = YamlFileExpressionStorage.new "yaml", ac
|
37
|
+
fe = SequenceExpression.new_exp fei, nil, nil, nil, nil
|
38
38
|
test_persistence(fes,fe)
|
39
39
|
end
|
40
40
|
|
@@ -74,9 +74,9 @@ class FilePersistenceTest < Test::Unit::TestCase
|
|
74
74
|
def test_utf8_with_file
|
75
75
|
|
76
76
|
workflow_definition_name = "みんなにARIGATOU★☆に関する最新の情報公開"
|
77
|
-
fei = new_fei
|
78
|
-
fes = YamlFileExpressionStorage.new
|
79
|
-
fe = SequenceExpression.
|
77
|
+
fei = new_fei workflow_definition_name
|
78
|
+
fes = YamlFileExpressionStorage.new "yaml", ac
|
79
|
+
fe = SequenceExpression.new_exp fei, nil, nil, nil, nil
|
80
80
|
|
81
81
|
loaded = test_persistence(fes, fe)
|
82
82
|
|
@@ -95,12 +95,8 @@ class FilePersistenceTest < Test::Unit::TestCase
|
|
95
95
|
fei = new_fei()
|
96
96
|
fes.delete(fei) if (fes.has_key?(fei))
|
97
97
|
|
98
|
-
raw =
|
99
|
-
|
100
|
-
RawExpression.new(fei, 'parent', 'env', nil, nil)
|
101
|
-
else
|
102
|
-
fe
|
103
|
-
end
|
98
|
+
raw = fe ? \
|
99
|
+
fe : RawExpression.new_raw(fei, 'parent', 'env', nil, nil)
|
104
100
|
|
105
101
|
assert \
|
106
102
|
(not fes.has_key?(fei)),
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Sun Nov 25 14:41:32 JST 2007
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'test/unit'
|
11
|
+
require 'fileutils'
|
12
|
+
require 'openwfe/def'
|
13
|
+
require 'openwfe/engine/file_persisted_engine'
|
14
|
+
#require 'openwfe/expool/yamlexpstorage'
|
15
|
+
|
16
|
+
include OpenWFE
|
17
|
+
|
18
|
+
|
19
|
+
class FilePersistenceAndCancel < Test::Unit::TestCase
|
20
|
+
|
21
|
+
#def setup
|
22
|
+
#end
|
23
|
+
|
24
|
+
def teardown
|
25
|
+
|
26
|
+
$OWFE_LOG.level = Logger::INFO
|
27
|
+
|
28
|
+
FileUtils.rm_rf "work_filep"
|
29
|
+
end
|
30
|
+
|
31
|
+
class OpenWFE::YamlFileExpressionStorage
|
32
|
+
public :compute_file_path
|
33
|
+
end
|
34
|
+
|
35
|
+
XMLDEF = <<XML
|
36
|
+
<process-definition name="simple_sequence" revision="1">
|
37
|
+
<description>
|
38
|
+
a tiny 'hello world' sequence
|
39
|
+
</description>
|
40
|
+
<sequence>
|
41
|
+
<set field="message" value="hello world !" />
|
42
|
+
<participant ref="bravo" />
|
43
|
+
<participant ref="alpha" />
|
44
|
+
</sequence>
|
45
|
+
</process-definition>
|
46
|
+
XML
|
47
|
+
|
48
|
+
class TestDef0 < ProcessDefinition
|
49
|
+
sequence do
|
50
|
+
alpha
|
51
|
+
bravo
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_0
|
56
|
+
|
57
|
+
ac = { :work_directory => "work_filep" }
|
58
|
+
|
59
|
+
@engine = FilePersistedEngine.new ac
|
60
|
+
|
61
|
+
#fei = @engine.launch TestDef0
|
62
|
+
fei = @engine.launch XMLDEF
|
63
|
+
|
64
|
+
sleep 0.300
|
65
|
+
|
66
|
+
assert File.exist?(path0(fei))
|
67
|
+
|
68
|
+
@engine.cancel_process fei.wfid
|
69
|
+
|
70
|
+
sleep 0.300
|
71
|
+
|
72
|
+
assert ( ! File.exist?(path0(fei)))
|
73
|
+
#assert ( ! File.exist?("./work/ejournal/#{fei.wfid}.ejournal"))
|
74
|
+
|
75
|
+
@engine.stop
|
76
|
+
|
77
|
+
FileUtils.rm_rf "work_filep"
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_1
|
81
|
+
|
82
|
+
ac = { :work_directory => "work_filep" }
|
83
|
+
|
84
|
+
@engine = CachedFilePersistedEngine.new ac
|
85
|
+
|
86
|
+
#$OWFE_LOG.level = Logger::DEBUG
|
87
|
+
|
88
|
+
#fei = @engine.launch TestDef0
|
89
|
+
fei = @engine.launch XMLDEF
|
90
|
+
|
91
|
+
sleep 0.900
|
92
|
+
# it's a bit longish...
|
93
|
+
|
94
|
+
#puts path1(fei)
|
95
|
+
assert File.exist?(path1(fei))
|
96
|
+
|
97
|
+
@engine.cancel_process fei.wfid
|
98
|
+
|
99
|
+
sleep 0.900
|
100
|
+
|
101
|
+
assert ( ! File.exist?(path1(fei)))
|
102
|
+
#assert ( ! File.exist?("./work/ejournal/#{fei.wfid}.ejournal"))
|
103
|
+
|
104
|
+
@engine.stop
|
105
|
+
end
|
106
|
+
|
107
|
+
protected
|
108
|
+
|
109
|
+
def path0 (fei)
|
110
|
+
@engine.get_expression_storage.compute_file_path(fei)
|
111
|
+
end
|
112
|
+
|
113
|
+
def path1 (fei)
|
114
|
+
@engine.ac[S_EXPRESSION_STORAGE + ".1"].compute_file_path(fei)
|
115
|
+
end
|
116
|
+
end
|
data/test/flowtestbase.rb
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
# somewhere between Philippina and the Japan
|
9
9
|
#
|
10
10
|
|
11
|
+
require 'rubygems'
|
11
12
|
require 'test/unit'
|
12
13
|
|
13
14
|
require 'openwfe/workitem'
|
@@ -17,10 +18,10 @@ require 'openwfe/participants/participants'
|
|
17
18
|
|
18
19
|
require 'rutest_utils'
|
19
20
|
|
20
|
-
include OpenWFE
|
21
|
+
#include OpenWFE
|
21
22
|
|
22
23
|
|
23
|
-
$WORKFLOW_ENGINE_CLASS = Engine
|
24
|
+
$WORKFLOW_ENGINE_CLASS = OpenWFE::Engine
|
24
25
|
|
25
26
|
persistence = ENV["__persistence__"]
|
26
27
|
|
@@ -28,12 +29,12 @@ persistence = ENV["__persistence__"]
|
|
28
29
|
if persistence == "pure-persistence"
|
29
30
|
|
30
31
|
require "openwfe/engine/file_persisted_engine"
|
31
|
-
$WORKFLOW_ENGINE_CLASS = FilePersistedEngine
|
32
|
+
$WORKFLOW_ENGINE_CLASS = OpenWFE::FilePersistedEngine
|
32
33
|
|
33
34
|
elsif persistence == "cached-persistence"
|
34
35
|
|
35
36
|
require "openwfe/engine/file_persisted_engine"
|
36
|
-
$WORKFLOW_ENGINE_CLASS = CachedFilePersistedEngine
|
37
|
+
$WORKFLOW_ENGINE_CLASS = OpenWFE::CachedFilePersistedEngine
|
37
38
|
|
38
39
|
elsif persistence == "db-persistence"
|
39
40
|
|
@@ -65,6 +66,11 @@ module FlowTestBase
|
|
65
66
|
|
66
67
|
@engine = $WORKFLOW_ENGINE_CLASS.new
|
67
68
|
|
69
|
+
#@terminated_processes = []
|
70
|
+
#@engine.get_expression_pool.add_observer(:terminate) do |c, fe, wi|
|
71
|
+
# @terminated_processes << fe.fei.wfid
|
72
|
+
#end
|
73
|
+
|
68
74
|
@engine.application_context[:ruby_eval_allowed] = true
|
69
75
|
|
70
76
|
@tracer = Tracer.new
|
@@ -87,7 +93,7 @@ module FlowTestBase
|
|
87
93
|
@tracer << "--\n"
|
88
94
|
end
|
89
95
|
|
90
|
-
@engine.register_participant
|
96
|
+
@engine.register_participant 'test-.*', OpenWFE::PrintParticipant.new
|
91
97
|
|
92
98
|
@engine.register_participant('block-participant') do |workitem|
|
93
99
|
@tracer << "the block participant received a workitem"
|
@@ -103,6 +109,7 @@ module FlowTestBase
|
|
103
109
|
# TEARDOWN
|
104
110
|
#
|
105
111
|
def teardown
|
112
|
+
|
106
113
|
if @engine
|
107
114
|
$OWFE_LOG.level = Logger::INFO
|
108
115
|
@engine.stop
|
@@ -131,6 +138,17 @@ module FlowTestBase
|
|
131
138
|
s
|
132
139
|
end
|
133
140
|
|
141
|
+
#
|
142
|
+
# some tests return quickly, leverage the @terminated_processes
|
143
|
+
# of the test engine to determine those processes that are
|
144
|
+
# already over...
|
145
|
+
#
|
146
|
+
def wait_for (fei)
|
147
|
+
|
148
|
+
#return if @terminated_processes.include?(fei.wfid)
|
149
|
+
@engine.wait_for(fei)
|
150
|
+
end
|
151
|
+
|
134
152
|
#
|
135
153
|
# dotest()
|
136
154
|
#
|
@@ -145,14 +163,15 @@ module FlowTestBase
|
|
145
163
|
OpenWFE::LaunchItem.new(flowDef)
|
146
164
|
end
|
147
165
|
|
148
|
-
fei = @engine.launch
|
166
|
+
fei = @engine.launch li
|
149
167
|
|
150
168
|
$OWFE_LOG.info { "dotest() launched #{fei.to_s}" }
|
151
169
|
|
152
170
|
if join.is_a?(Numeric)
|
153
171
|
sleep join
|
154
172
|
else
|
155
|
-
|
173
|
+
#@engine.wait_for fei
|
174
|
+
wait_for fei
|
156
175
|
end
|
157
176
|
|
158
177
|
trace = @tracer.to_s
|
@@ -161,34 +180,37 @@ module FlowTestBase
|
|
161
180
|
|
162
181
|
if expectedTrace.kind_of?(Array)
|
163
182
|
|
164
|
-
result =
|
165
|
-
|
166
|
-
result = (result or (trace == etrace))
|
183
|
+
result = expectedTrace.find do |etrace|
|
184
|
+
trace == etrace
|
167
185
|
end
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
assert \
|
174
|
-
result,
|
175
|
-
"flow failed : trace doesn't correspond to any expected traces"
|
176
|
-
elsif expectedTrace.kind_of? Regexp
|
186
|
+
assert(
|
187
|
+
(result != nil),
|
188
|
+
"""flow failed :
|
189
|
+
|
190
|
+
trace doesn't correspond to any of the expected traces...
|
177
191
|
|
178
|
-
|
179
|
-
|
192
|
+
traced :
|
193
|
+
|
194
|
+
'#{trace}'
|
195
|
+
|
196
|
+
""")
|
197
|
+
elsif expectedTrace.kind_of?(Regexp)
|
198
|
+
|
199
|
+
assert trace.match(expectedTrace)
|
180
200
|
else
|
181
201
|
|
182
|
-
assert
|
202
|
+
assert(
|
183
203
|
trace == expectedTrace,
|
184
204
|
"""flow failed :
|
205
|
+
|
206
|
+
traced :
|
185
207
|
|
186
208
|
'#{trace}'
|
187
209
|
|
188
|
-
|
210
|
+
but was expecting :
|
189
211
|
|
190
212
|
'#{expectedTrace}'
|
191
|
-
"""
|
213
|
+
""")
|
192
214
|
end
|
193
215
|
|
194
216
|
if allowRemainingExpressions
|
@@ -203,7 +225,7 @@ module FlowTestBase
|
|
203
225
|
|
204
226
|
if size != 1
|
205
227
|
puts
|
206
|
-
puts " remaining expressions : #{
|
228
|
+
puts " remaining expressions : #{size}"
|
207
229
|
puts
|
208
230
|
puts exp_storage.to_s
|
209
231
|
puts
|
data/test/ft_0.rb
CHANGED
data/test/ft_10_loop.rb
CHANGED
@@ -40,11 +40,9 @@ class FlowTest10 < Test::Unit::TestCase
|
|
40
40
|
</loop>
|
41
41
|
</sequence>
|
42
42
|
</process-definition>''',
|
43
|
-
$s
|
44
|
-
true)
|
43
|
+
$s)
|
45
44
|
end
|
46
45
|
|
47
|
-
#def xxxx_loop_1
|
48
46
|
def test_loop_1
|
49
47
|
dotest(
|
50
48
|
'<process-definition name="'+name_of_test+'''" revision="0">
|
@@ -59,11 +57,9 @@ class FlowTest10 < Test::Unit::TestCase
|
|
59
57
|
</loop>
|
60
58
|
</sequence>
|
61
59
|
</process-definition>''',
|
62
|
-
$s
|
63
|
-
true)
|
60
|
+
$s)
|
64
61
|
end
|
65
62
|
|
66
|
-
#def xxxx_loop_2
|
67
63
|
def test_loop_2
|
68
64
|
dotest(
|
69
65
|
'<process-definition name="'+name_of_test+'''" revision="0">
|
@@ -76,11 +72,9 @@ class FlowTest10 < Test::Unit::TestCase
|
|
76
72
|
</loop>
|
77
73
|
</sequence>
|
78
74
|
</process-definition>''',
|
79
|
-
$s
|
80
|
-
true)
|
75
|
+
$s)
|
81
76
|
end
|
82
77
|
|
83
|
-
#def xxxx_loop_3
|
84
78
|
def test_loop_3
|
85
79
|
dotest(
|
86
80
|
'<process-definition name="'+name_of_test+'''" revision="0">
|
@@ -93,11 +87,9 @@ class FlowTest10 < Test::Unit::TestCase
|
|
93
87
|
</loop>
|
94
88
|
</sequence>
|
95
89
|
</process-definition>''',
|
96
|
-
$s
|
97
|
-
true)
|
90
|
+
$s)
|
98
91
|
end
|
99
92
|
|
100
|
-
#def xxxx_loop_4
|
101
93
|
def test_loop_4
|
102
94
|
dotest(
|
103
95
|
'<process-definition name="'+name_of_test+'''" revision="0">
|
@@ -110,8 +102,31 @@ class FlowTest10 < Test::Unit::TestCase
|
|
110
102
|
</loop>
|
111
103
|
</sequence>
|
112
104
|
</process-definition>''',
|
113
|
-
$s
|
114
|
-
|
105
|
+
$s)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_loop_5
|
109
|
+
|
110
|
+
#log_level_to_debug
|
111
|
+
|
112
|
+
dotest(
|
113
|
+
'<process-definition name="'+name_of_test+'''" revision="0">
|
114
|
+
<sequence>
|
115
|
+
<reval>$i = 0</reval>
|
116
|
+
<loop>
|
117
|
+
<!--
|
118
|
+
<reval>$i = $i + 1</reval>
|
119
|
+
<set field="f" value="${r:$i}" />
|
120
|
+
-->
|
121
|
+
<set field="f">
|
122
|
+
<reval>$i = $i + 1</reval>
|
123
|
+
</set>
|
124
|
+
<print>${r:$i}</print>
|
125
|
+
<break if="${f:f}" />
|
126
|
+
</loop>
|
127
|
+
</sequence>
|
128
|
+
</process-definition>''',
|
129
|
+
'1')
|
115
130
|
end
|
116
131
|
|
117
132
|
end
|
@@ -8,7 +8,7 @@
|
|
8
8
|
#
|
9
9
|
|
10
10
|
require 'flowtestbase'
|
11
|
-
require 'openwfe/
|
11
|
+
require 'openwfe/def'
|
12
12
|
|
13
13
|
|
14
14
|
class FlowTest10b < Test::Unit::TestCase
|
@@ -50,16 +50,7 @@ class FlowTest10b < Test::Unit::TestCase
|
|
50
50
|
workitem.__cursor_command__ = "break" if last_digit > "4"
|
51
51
|
end
|
52
52
|
|
53
|
-
dotest(
|
54
|
-
TestDefinition0,
|
55
|
-
"""
|
56
|
-
0
|
57
|
-
1
|
58
|
-
2
|
59
|
-
3
|
60
|
-
4
|
61
|
-
""".strip,
|
62
|
-
true)
|
53
|
+
dotest TestDefinition0, (0..4).to_a.join("\n")
|
63
54
|
end
|
64
55
|
|
65
56
|
end
|
data/test/ft_11_ppd.rb
CHANGED
@@ -179,7 +179,7 @@ end
|
|
179
179
|
|
180
180
|
def test_ppd_4
|
181
181
|
|
182
|
-
s = TestDefinition4.do_make
|
182
|
+
s = OpenWFE::ExpressionTree.to_code_s TestDefinition4.do_make
|
183
183
|
|
184
184
|
dotest(
|
185
185
|
TestDefinition4,
|
@@ -209,7 +209,7 @@ end
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
-
CODE5 =
|
212
|
+
CODE5 = <<-EOS
|
213
213
|
process_definition :name => 'test5', :revision => '0' do
|
214
214
|
sequence do
|
215
215
|
sequence do
|
@@ -224,26 +224,15 @@ process_definition :name => 'test5', :revision => '0' do
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
|
-
|
227
|
+
EOS
|
228
228
|
|
229
229
|
def test_ppd_5
|
230
|
-
#def xxxx_ppd_5
|
231
|
-
|
232
|
-
s = TestDefinition5.do_make.to_code_s
|
233
230
|
|
234
|
-
|
235
|
-
#puts s
|
236
|
-
#puts
|
237
|
-
#puts TestDefinition5.do_make(ExpressionMap.new(nil, nil)).to_s
|
231
|
+
s = OpenWFE::ExpressionTree.to_code_s(TestDefinition5.do_make)
|
238
232
|
|
239
|
-
dotest
|
240
|
-
TestDefinition5,
|
241
|
-
"""a
|
242
|
-
b""")
|
233
|
+
dotest TestDefinition5, "a\nb"
|
243
234
|
|
244
|
-
assert
|
245
|
-
s == CODE5,
|
246
|
-
"nested sequences test failed (5)"
|
235
|
+
assert CODE5, s
|
247
236
|
end
|
248
237
|
|
249
238
|
|