openwferu 0.9.16 → 0.9.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/examples/about_state.rb +81 -0
  2. data/examples/engine_template.rb +7 -0
  3. data/lib/openwfe/contextual.rb +2 -2
  4. data/lib/openwfe/def.rb +2 -3
  5. data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
  6. data/lib/openwfe/engine/engine.rb +202 -251
  7. data/lib/openwfe/engine/process_status.rb +359 -0
  8. data/lib/openwfe/expool/errorjournal.rb +6 -6
  9. data/lib/openwfe/expool/expressionpool.rb +161 -239
  10. data/lib/openwfe/expool/expstorage.rb +185 -55
  11. data/lib/openwfe/expool/journal.rb +1 -2
  12. data/lib/openwfe/expool/parser.rb +233 -0
  13. data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
  14. data/lib/openwfe/expool/wfidgen.rb +25 -7
  15. data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
  16. data/lib/openwfe/expressions/condition.rb +49 -12
  17. data/lib/openwfe/expressions/environment.rb +45 -15
  18. data/lib/openwfe/expressions/expressionmap.rb +39 -19
  19. data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
  20. data/lib/openwfe/expressions/fe_cron.rb +19 -18
  21. data/lib/openwfe/expressions/fe_cursor.rb +69 -28
  22. data/lib/openwfe/expressions/fe_define.rb +4 -1
  23. data/lib/openwfe/expressions/fe_do.rb +1 -3
  24. data/lib/openwfe/expressions/fe_equals.rb +131 -20
  25. data/lib/openwfe/expressions/fe_fqv.rb +27 -3
  26. data/lib/openwfe/expressions/fe_iterator.rb +14 -7
  27. data/lib/openwfe/expressions/fe_listen.rb +7 -2
  28. data/lib/openwfe/expressions/fe_misc.rb +187 -20
  29. data/lib/openwfe/expressions/fe_participant.rb +8 -7
  30. data/lib/openwfe/expressions/fe_reserve.rb +105 -33
  31. data/lib/openwfe/expressions/fe_save.rb +55 -5
  32. data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
  33. data/lib/openwfe/expressions/fe_sleep.rb +25 -15
  34. data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
  35. data/lib/openwfe/expressions/fe_wait.rb +3 -2
  36. data/lib/openwfe/expressions/fe_when.rb +7 -15
  37. data/lib/openwfe/expressions/flowexpression.rb +90 -49
  38. data/lib/openwfe/expressions/merge.rb +7 -1
  39. data/lib/openwfe/expressions/raw.rb +261 -63
  40. data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
  41. data/lib/openwfe/expressions/time.rb +36 -12
  42. data/lib/openwfe/expressions/timeout.rb +9 -7
  43. data/lib/openwfe/expressions/value.rb +126 -0
  44. data/lib/openwfe/flowexpressionid.rb +52 -22
  45. data/lib/openwfe/listeners/listeners.rb +3 -3
  46. data/lib/openwfe/listeners/socketlisteners.rb +8 -5
  47. data/lib/openwfe/logging.rb +6 -3
  48. data/lib/openwfe/omixins.rb +8 -6
  49. data/lib/openwfe/orest/xmlcodec.rb +16 -12
  50. data/lib/openwfe/participants.rb +38 -0
  51. data/lib/openwfe/participants/participant.rb +1 -1
  52. data/lib/openwfe/participants/participantmap.rb +24 -10
  53. data/lib/openwfe/participants/participants.rb +4 -3
  54. data/lib/openwfe/participants/soapparticipants.rb +1 -1
  55. data/lib/openwfe/participants/socketparticipants.rb +1 -1
  56. data/lib/openwfe/rudefinitions.rb +7 -5
  57. data/lib/openwfe/storage/yamlcustom.rb +10 -10
  58. data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
  59. data/lib/openwfe/tools/flowtracer.rb +6 -5
  60. data/lib/openwfe/util/dollar.rb +42 -85
  61. data/lib/openwfe/util/ometa.rb +1 -3
  62. data/lib/openwfe/util/workqueue.rb +1 -1
  63. data/lib/openwfe/utils.rb +33 -11
  64. data/lib/openwfe/version.rb +2 -2
  65. data/lib/openwfe/workitem.rb +76 -14
  66. data/lib/openwfe/worklist/storelocks.rb +9 -4
  67. data/lib/openwfe/worklist/storeparticipant.rb +1 -1
  68. data/test/back_0916_test.rb +101 -0
  69. data/test/bm/ft_26_load.rb +1 -1
  70. data/test/bm/ft_26b_load.rb +1 -1
  71. data/test/bm/ft_26c_load.rb +3 -2
  72. data/test/bm/ft_26d_load.rb +97 -0
  73. data/test/bm/ft_recu.rb +71 -0
  74. data/test/concurrence_test.rb +1 -1
  75. data/test/condition_test.rb +152 -0
  76. data/test/description_test.rb +12 -7
  77. data/test/eno_test.rb +1 -1
  78. data/test/expool_20031219_0916.tgz +0 -0
  79. data/test/fe_lookup_att_test.rb +1 -1
  80. data/test/fei_test.rb +16 -0
  81. data/test/file_persistence_test.rb +8 -12
  82. data/test/filep_cancel_test.rb +116 -0
  83. data/test/flowtestbase.rb +47 -25
  84. data/test/ft_0.rb +1 -1
  85. data/test/ft_10_loop.rb +29 -14
  86. data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
  87. data/test/ft_11_ppd.rb +6 -17
  88. data/test/ft_11b_ppd.rb +1 -4
  89. data/test/ft_12_blockparticipant.rb +1 -1
  90. data/test/ft_13_eno.rb +1 -1
  91. data/test/ft_15_iterator.rb +1 -1
  92. data/test/ft_15b_iterator.rb +1 -1
  93. data/test/ft_17_condition.rb +6 -6
  94. data/test/ft_18_pname.rb +1 -1
  95. data/test/ft_20_cron.rb +1 -1
  96. data/test/ft_21_cron.rb +6 -4
  97. data/test/ft_22_history.rb +1 -1
  98. data/test/ft_23_when.rb +1 -1
  99. data/test/ft_23b_when.rb +18 -6
  100. data/test/ft_23c_wait.rb +8 -6
  101. data/test/ft_25_cancel.rb +7 -5
  102. data/test/ft_27_getflowpos.rb +22 -17
  103. data/test/ft_28_fileparticipant.rb +1 -2
  104. data/test/ft_2_concurrence.rb +1 -1
  105. data/test/ft_2b_concurrence.rb +25 -20
  106. data/test/ft_30_socketlistener.rb +0 -3
  107. data/test/ft_34_cancelwfid.rb +9 -9
  108. data/test/ft_35_localdefs.rb +0 -1
  109. data/test/ft_36_subprocids.rb +6 -6
  110. data/test/ft_38_tag.rb +3 -2
  111. data/test/ft_38b_tag.rb +229 -0
  112. data/test/ft_39_reserve.rb +3 -18
  113. data/test/ft_39b_reserve.rb +34 -5
  114. data/test/ft_3b_lookup_vf.rb +83 -0
  115. data/test/ft_40_defined.rb +2 -11
  116. data/test/ft_42_environments.rb +4 -6
  117. data/test/ft_44b_restore.rb +88 -22
  118. data/test/ft_45_citerator.rb +57 -11
  119. data/test/ft_49_condition.rb +4 -2
  120. data/test/ft_4_misc.rb +24 -3
  121. data/test/ft_50_xml_attribute.rb +17 -20
  122. data/test/ft_54_listen.rb +1 -1
  123. data/test/ft_54b_listen.rb +2 -2
  124. data/test/ft_56_timeout.rb +8 -1
  125. data/test/ft_57_a.rb +10 -10
  126. data/test/ft_59_ps.rb +49 -16
  127. data/test/ft_60_ecancel.rb +52 -10
  128. data/test/ft_63_pause.rb +8 -8
  129. data/test/ft_65_stringlaunch.rb +4 -6
  130. data/test/ft_67_schedlaunch.rb +4 -4
  131. data/test/ft_69_cancelmissing.rb +4 -2
  132. data/test/ft_70_lookupvar.rb +2 -2
  133. data/test/ft_72_lookup_processes.rb +2 -2
  134. data/test/ft_73_cancel_sub.rb +8 -8
  135. data/test/ft_77_segments.rb +38 -0
  136. data/test/ft_78_eval.rb +154 -0
  137. data/test/ft_79_tticket.rb +185 -0
  138. data/test/ft_80_spname.rb +95 -0
  139. data/test/ft_81_exp.rb +64 -0
  140. data/test/ft_82_trecu.rb +48 -0
  141. data/test/ft_83_badpause.rb +62 -0
  142. data/test/ft_84_updateexp.rb +125 -0
  143. data/test/ft_9b_cursor.rb +105 -0
  144. data/test/ft_tests.rb +14 -1
  145. data/test/hash_test.rb +7 -7
  146. data/test/hparticipant_test.rb +4 -4
  147. data/test/lookup_vf_test.rb +94 -0
  148. data/test/misc_test.rb +5 -3
  149. data/test/orest_test.rb +4 -3
  150. data/test/param_test.rb +12 -16
  151. data/test/participant_test.rb +36 -0
  152. data/test/pending.rb +10 -10
  153. data/test/rake_ltest.rb +1 -10
  154. data/test/rake_qtest.rb +7 -6
  155. data/test/raw_prog_test.rb +89 -121
  156. data/test/restart_cron_test.rb +84 -36
  157. data/test/restart_paused_test.rb +100 -0
  158. data/test/restart_sleep_test.rb +1 -1
  159. data/test/restart_tests.rb +1 -0
  160. data/test/restart_when_test.rb +33 -22
  161. data/test/ruby_procdef_test.rb +19 -18
  162. data/test/sec_test.rb +74 -35
  163. data/test/storage_test.rb +44 -0
  164. data/test/test.rb +3 -0
  165. data/test/timeout_test.rb +7 -18
  166. data/test/wfid_test.rb +2 -1
  167. data/test/wi_test.rb +29 -18
  168. metadata +121 -57
  169. data/lib/openwfe/expressions/raw_xml.rb +0 -176
  170. data/lib/openwfe/expressions/simplerep.rb +0 -266
  171. data/lib/openwfe/util/kotoba.rb +0 -236
  172. data/lib/openwfe/util/lru.rb +0 -171
  173. data/lib/openwfe/util/otime.rb +0 -246
  174. data/lib/openwfe/util/safe.rb +0 -160
  175. data/lib/openwfe/util/scheduler.rb +0 -1158
  176. data/test/cron_test.rb +0 -113
  177. data/test/cronline_test.rb +0 -60
  178. data/test/dollar_test.rb +0 -90
  179. data/test/kotoba_test.rb +0 -72
  180. data/test/lru_test.rb +0 -79
  181. data/test/safely_test.rb +0 -84
  182. data/test/scheduler_1_test.rb +0 -88
  183. data/test/scheduler_test.rb +0 -363
  184. 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
- return @engine.application_context
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("yaml", ac)
37
- fe = SequenceExpression.new(fei, nil, nil, nil, nil)
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(workflow_definition_name)
78
- fes = YamlFileExpressionStorage.new("yaml", ac)
79
- fe = SequenceExpression.new(fei, nil, nil, nil, nil)
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
- if fe == nil
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
@@ -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('test-.*', PrintParticipant.new())
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(li)
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
- @engine.wait_for fei
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 = false
165
- expectedTrace.each do |etrace|
166
- result = (result or (trace == etrace))
183
+ result = expectedTrace.find do |etrace|
184
+ trace == etrace
167
185
  end
168
- unless result
169
- puts
170
- puts ">#{trace}<"
171
- puts
172
- end
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
- assert \
179
- trace.match(expectedTrace)
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 : #{exp_storage.length}"
228
+ puts " remaining expressions : #{size}"
207
229
  puts
208
230
  puts exp_storage.to_s
209
231
  puts
@@ -29,7 +29,7 @@ class FlowTest0 < Test::Unit::TestCase
29
29
  def test_empty
30
30
  dotest(
31
31
  '''<process-definition name="n" revision="0">
32
- </process-definition>''', "")
32
+ </process-definition>''', '')
33
33
  end
34
34
 
35
35
  def test_dollar_notation_0
@@ -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
- true)
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/expressions/raw_prog'
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
@@ -179,7 +179,7 @@ end
179
179
 
180
180
  def test_ppd_4
181
181
 
182
- s = TestDefinition4.do_make.to_code_s
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
- """.strip
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
- #puts
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