ruote 0.9.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. data/README.txt +24 -0
  2. data/bin/validate-workflow.rb +89 -0
  3. data/examples/about_state.rb +81 -0
  4. data/examples/bigflow.rb +19 -0
  5. data/examples/csv_weather.rb +23 -0
  6. data/examples/engine_template.rb +247 -0
  7. data/examples/flowtracing.rb +24 -0
  8. data/examples/homeworkreview.rb +68 -0
  9. data/examples/kotoba.rb +22 -0
  10. data/examples/mano_tracker.rb +172 -0
  11. data/examples/openwferu.rb +58 -0
  12. data/examples/quotereporter.rb +157 -0
  13. data/examples/scheduler_cron_usage.rb +48 -0
  14. data/examples/scheduler_usage.rb +56 -0
  15. data/lib/openwfe.rb +41 -0
  16. data/lib/openwfe/contextual.rb +111 -0
  17. data/lib/openwfe/def.rb +46 -0
  18. data/lib/openwfe/engine.rb +37 -0
  19. data/lib/openwfe/engine/engine.rb +756 -0
  20. data/lib/openwfe/engine/expool_methods.rb +172 -0
  21. data/lib/openwfe/engine/file_persisted_engine.rb +105 -0
  22. data/lib/openwfe/engine/participant_methods.rb +133 -0
  23. data/lib/openwfe/engine/status_methods.rb +353 -0
  24. data/lib/openwfe/engine/update_exp_methods.rb +112 -0
  25. data/lib/openwfe/exceptions.rb +51 -0
  26. data/lib/openwfe/expool/errorjournal.rb +476 -0
  27. data/lib/openwfe/expool/expressionpool.rb +1144 -0
  28. data/lib/openwfe/expool/expstorage.rb +403 -0
  29. data/lib/openwfe/expool/history.rb +174 -0
  30. data/lib/openwfe/expool/journal.rb +224 -0
  31. data/lib/openwfe/expool/journal_replay.rb +321 -0
  32. data/lib/openwfe/expool/parser.rb +242 -0
  33. data/lib/openwfe/expool/representation.rb +121 -0
  34. data/lib/openwfe/expool/threadedexpstorage.rb +188 -0
  35. data/lib/openwfe/expool/wfidgen.rb +388 -0
  36. data/lib/openwfe/expool/yamlexpstorage.rb +224 -0
  37. data/lib/openwfe/expressions/condition.rb +244 -0
  38. data/lib/openwfe/expressions/environment.rb +246 -0
  39. data/lib/openwfe/expressions/expressionmap.rb +258 -0
  40. data/lib/openwfe/expressions/fe_cancel.rb +109 -0
  41. data/lib/openwfe/expressions/fe_command.rb +241 -0
  42. data/lib/openwfe/expressions/fe_concurrence.rb +662 -0
  43. data/lib/openwfe/expressions/fe_cron.rb +259 -0
  44. data/lib/openwfe/expressions/fe_cursor.rb +259 -0
  45. data/lib/openwfe/expressions/fe_define.rb +192 -0
  46. data/lib/openwfe/expressions/fe_do.rb +168 -0
  47. data/lib/openwfe/expressions/fe_equals.rb +291 -0
  48. data/lib/openwfe/expressions/fe_filter.rb +129 -0
  49. data/lib/openwfe/expressions/fe_filter_definition.rb +168 -0
  50. data/lib/openwfe/expressions/fe_fqv.rb +250 -0
  51. data/lib/openwfe/expressions/fe_if.rb +303 -0
  52. data/lib/openwfe/expressions/fe_iterator.rb +145 -0
  53. data/lib/openwfe/expressions/fe_listen.rb +371 -0
  54. data/lib/openwfe/expressions/fe_losfor.rb +111 -0
  55. data/lib/openwfe/expressions/fe_misc.rb +421 -0
  56. data/lib/openwfe/expressions/fe_participant.rb +269 -0
  57. data/lib/openwfe/expressions/fe_reserve.rb +212 -0
  58. data/lib/openwfe/expressions/fe_save.rb +274 -0
  59. data/lib/openwfe/expressions/fe_sequence.rb +117 -0
  60. data/lib/openwfe/expressions/fe_set.rb +139 -0
  61. data/lib/openwfe/expressions/fe_sleep.rb +166 -0
  62. data/lib/openwfe/expressions/fe_step.rb +159 -0
  63. data/lib/openwfe/expressions/fe_subprocess.rb +168 -0
  64. data/lib/openwfe/expressions/fe_timeout.rb +127 -0
  65. data/lib/openwfe/expressions/fe_wait.rb +78 -0
  66. data/lib/openwfe/expressions/fe_when.rb +142 -0
  67. data/lib/openwfe/expressions/filter.rb +104 -0
  68. data/lib/openwfe/expressions/flowexpression.rb +847 -0
  69. data/lib/openwfe/expressions/iterator.rb +221 -0
  70. data/lib/openwfe/expressions/merge.rb +84 -0
  71. data/lib/openwfe/expressions/raw.rb +547 -0
  72. data/lib/openwfe/expressions/rprocdef.rb +375 -0
  73. data/lib/openwfe/expressions/time.rb +333 -0
  74. data/lib/openwfe/expressions/timeout.rb +178 -0
  75. data/lib/openwfe/expressions/value.rb +126 -0
  76. data/lib/openwfe/filterdef.rb +259 -0
  77. data/lib/openwfe/flowexpressionid.rb +357 -0
  78. data/lib/openwfe/listeners/listener.rb +97 -0
  79. data/lib/openwfe/listeners/listeners.rb +139 -0
  80. data/lib/openwfe/listeners/socketlisteners.rb +272 -0
  81. data/lib/openwfe/logging.rb +122 -0
  82. data/lib/openwfe/omixins.rb +95 -0
  83. data/lib/openwfe/orest/controlclient.rb +119 -0
  84. data/lib/openwfe/orest/definitions.rb +113 -0
  85. data/lib/openwfe/orest/exception.rb +60 -0
  86. data/lib/openwfe/orest/oldrestservlet.rb +279 -0
  87. data/lib/openwfe/orest/osocket.rb +148 -0
  88. data/lib/openwfe/orest/restclient.rb +176 -0
  89. data/lib/openwfe/orest/workitem.rb +206 -0
  90. data/lib/openwfe/orest/worklistclient.rb +272 -0
  91. data/lib/openwfe/orest/xmlcodec.rb +670 -0
  92. data/lib/openwfe/participants.rb +38 -0
  93. data/lib/openwfe/participants/enoparticipants.rb +230 -0
  94. data/lib/openwfe/participants/participant.rb +141 -0
  95. data/lib/openwfe/participants/participantmap.rb +249 -0
  96. data/lib/openwfe/participants/participants.rb +407 -0
  97. data/lib/openwfe/participants/soapparticipants.rb +135 -0
  98. data/lib/openwfe/participants/socketparticipants.rb +202 -0
  99. data/lib/openwfe/participants/storeparticipants.rb +254 -0
  100. data/lib/openwfe/rudefinitions.rb +130 -0
  101. data/lib/openwfe/service.rb +103 -0
  102. data/lib/openwfe/storage/yamlcustom.rb +106 -0
  103. data/lib/openwfe/storage/yamlfilestorage.rb +245 -0
  104. data/lib/openwfe/tools/flowtracer.rb +81 -0
  105. data/lib/openwfe/util/dollar.rb +217 -0
  106. data/lib/openwfe/util/irb.rb +86 -0
  107. data/lib/openwfe/util/observable.rb +144 -0
  108. data/lib/openwfe/util/ometa.rb +62 -0
  109. data/lib/openwfe/util/workqueue.rb +124 -0
  110. data/lib/openwfe/util/xml.rb +418 -0
  111. data/lib/openwfe/utils.rb +554 -0
  112. data/lib/openwfe/version.rb +37 -0
  113. data/lib/openwfe/workitem.rb +499 -0
  114. data/lib/openwfe/worklist/oldrest.rb +244 -0
  115. data/lib/openwfe/worklist/storelocks.rb +293 -0
  116. data/lib/openwfe/worklist/storeparticipant.rb +44 -0
  117. data/lib/openwfe/worklist/worklist.rb +297 -0
  118. data/test/README.txt +27 -0
  119. data/test/back_0916_test.rb +111 -0
  120. data/test/bm/bm_1_xml_vs_prog.rb +56 -0
  121. data/test/bm/bm_2_step.rb +109 -0
  122. data/test/bm/ft_0f_5ms.rb +35 -0
  123. data/test/bm/ft_26_load.rb +210 -0
  124. data/test/bm/ft_26b_load.rb +86 -0
  125. data/test/bm/ft_26c_load.rb +97 -0
  126. data/test/bm/ft_26d_load.rb +97 -0
  127. data/test/bm/ft_recu.rb +71 -0
  128. data/test/clone_test.rb +122 -0
  129. data/test/concurrence_test.rb +77 -0
  130. data/test/condition_test.rb +155 -0
  131. data/test/console_test.rb +12 -0
  132. data/test/cron_ltest.rb +15 -0
  133. data/test/description_test.rb +87 -0
  134. data/test/eno_test.rb +76 -0
  135. data/test/expmap_test.rb +54 -0
  136. data/test/expool_20031219_0916.tgz +0 -0
  137. data/test/fe_lookup_att_test.rb +62 -0
  138. data/test/fei_test.rb +181 -0
  139. data/test/file_persisted_engine_test.rb +64 -0
  140. data/test/file_persistence_test.rb +134 -0
  141. data/test/filep_cancel_test.rb +123 -0
  142. data/test/filter_test.rb +109 -0
  143. data/test/flowtestbase.rb +351 -0
  144. data/test/ft_0.rb +68 -0
  145. data/test/ft_0b_sequence.rb +36 -0
  146. data/test/ft_0c_testname.rb +33 -0
  147. data/test/ft_0d_participant.rb +30 -0
  148. data/test/ft_0e_multibody.rb +34 -0
  149. data/test/ft_10_loop.rb +134 -0
  150. data/test/ft_11_ppd.rb +415 -0
  151. data/test/ft_11b_ppd.rb +54 -0
  152. data/test/ft_12_blockparticipant.rb +97 -0
  153. data/test/ft_13_eno.rb +52 -0
  154. data/test/ft_14_subprocess.rb +88 -0
  155. data/test/ft_14b_subprocess.rb +192 -0
  156. data/test/ft_14c_subprocess.rb +68 -0
  157. data/test/ft_15_iterator.rb +216 -0
  158. data/test/ft_15b_iterator.rb +74 -0
  159. data/test/ft_16_fqv.rb +73 -0
  160. data/test/ft_17_condition.rb +84 -0
  161. data/test/ft_18_pname.rb +56 -0
  162. data/test/ft_1_unset.rb +175 -0
  163. data/test/ft_1b_unset.rb +39 -0
  164. data/test/ft_20_cron.rb +53 -0
  165. data/test/ft_21_cron.rb +87 -0
  166. data/test/ft_21b_cron_pause.rb +82 -0
  167. data/test/ft_22_history.rb +74 -0
  168. data/test/ft_23_when.rb +77 -0
  169. data/test/ft_23b_when.rb +70 -0
  170. data/test/ft_23c_wait.rb +80 -0
  171. data/test/ft_23d_cww.rb +58 -0
  172. data/test/ft_24_def.rb +44 -0
  173. data/test/ft_25_cancel.rb +89 -0
  174. data/test/ft_27_getflowpos.rb +147 -0
  175. data/test/ft_28_fileparticipant.rb +63 -0
  176. data/test/ft_29_httprb.rb +106 -0
  177. data/test/ft_2_concurrence.rb +135 -0
  178. data/test/ft_2b_concurrence.rb +188 -0
  179. data/test/ft_2c_concurrence.rb +64 -0
  180. data/test/ft_30_socketlistener.rb +203 -0
  181. data/test/ft_31_flowname.rb +40 -0
  182. data/test/ft_32_journal.rb +91 -0
  183. data/test/ft_32c_journal.rb +102 -0
  184. data/test/ft_32d_journal.rb +84 -0
  185. data/test/ft_33_description.rb +107 -0
  186. data/test/ft_34_cancelwfid.rb +80 -0
  187. data/test/ft_35_localdefs.rb +75 -0
  188. data/test/ft_36_subprocids.rb +97 -0
  189. data/test/ft_37_pnames.rb +70 -0
  190. data/test/ft_38_tag.rb +127 -0
  191. data/test/ft_38b_tag.rb +161 -0
  192. data/test/ft_38c_tag.rb +100 -0
  193. data/test/ft_39_reserve.rb +63 -0
  194. data/test/ft_39b_reserve.rb +84 -0
  195. data/test/ft_3_equals.rb +170 -0
  196. data/test/ft_3b_lookup_vf.rb +83 -0
  197. data/test/ft_40_defined.rb +61 -0
  198. data/test/ft_41_case.rb +110 -0
  199. data/test/ft_42_environments.rb +75 -0
  200. data/test/ft_43_pat10.rb +85 -0
  201. data/test/ft_44_save.rb +70 -0
  202. data/test/ft_44b_restore.rb +212 -0
  203. data/test/ft_45_citerator.rb +214 -0
  204. data/test/ft_46_pparams.rb +62 -0
  205. data/test/ft_47_filter.rb +160 -0
  206. data/test/ft_48_fe_filter.rb +88 -0
  207. data/test/ft_49_condition.rb +126 -0
  208. data/test/ft_4_misc.rb +237 -0
  209. data/test/ft_50_xml_attribute.rb +155 -0
  210. data/test/ft_51_stack.rb +55 -0
  211. data/test/ft_52_obs_participant.rb +123 -0
  212. data/test/ft_53_null_noop_participant.rb +62 -0
  213. data/test/ft_54_listen.rb +288 -0
  214. data/test/ft_54b_listen.rb +66 -0
  215. data/test/ft_54c_listen.rb +99 -0
  216. data/test/ft_55_ptimeout.rb +59 -0
  217. data/test/ft_56_timeout.rb +59 -0
  218. data/test/ft_57_a.rb +145 -0
  219. data/test/ft_58_ejournal.rb +151 -0
  220. data/test/ft_59_ps.rb +150 -0
  221. data/test/ft_59b_ps_for_pat.rb +58 -0
  222. data/test/ft_5_time.rb +118 -0
  223. data/test/ft_60_ecancel.rb +161 -0
  224. data/test/ft_61_elsub.rb +51 -0
  225. data/test/ft_62_procparticipant.rb +71 -0
  226. data/test/ft_63_pause.rb +124 -0
  227. data/test/ft_64_alias.rb +102 -0
  228. data/test/ft_64_clone.rb +69 -0
  229. data/test/ft_65_stringlaunch.rb +59 -0
  230. data/test/ft_66_subforget.rb +70 -0
  231. data/test/ft_67_schedlaunch.rb +116 -0
  232. data/test/ft_68_ifparticipant.rb +70 -0
  233. data/test/ft_69_cancelmissing.rb +51 -0
  234. data/test/ft_6_lambda.rb +64 -0
  235. data/test/ft_70_lookupvar.rb +55 -0
  236. data/test/ft_71_log.rb +60 -0
  237. data/test/ft_72_lookup_processes.rb +76 -0
  238. data/test/ft_73_cancel_sub.rb +139 -0
  239. data/test/ft_74_block_and_workitem_dup.rb +63 -0
  240. data/test/ft_75_ruby_attributes.rb +87 -0
  241. data/test/ft_76_merge_isolate.rb +88 -0
  242. data/test/ft_77_segments.rb +35 -0
  243. data/test/ft_78_eval.rb +150 -0
  244. data/test/ft_79_tticket.rb +187 -0
  245. data/test/ft_79b_tticket.rb +172 -0
  246. data/test/ft_79c_outcome.rb +56 -0
  247. data/test/ft_7_lose.rb +104 -0
  248. data/test/ft_7b_lose.rb +78 -0
  249. data/test/ft_80_spname.rb +91 -0
  250. data/test/ft_81_exp.rb +60 -0
  251. data/test/ft_82_trecu.rb +46 -0
  252. data/test/ft_83_badpause.rb +58 -0
  253. data/test/ft_84_updateexp.rb +198 -0
  254. data/test/ft_85_dolhash.rb +43 -0
  255. data/test/ft_86_dollar_fv.rb +68 -0
  256. data/test/ft_87_define.rb +74 -0
  257. data/test/ft_8_forget.rb +44 -0
  258. data/test/ft_9_cursor.rb +145 -0
  259. data/test/ft_9b_cursor.rb +105 -0
  260. data/test/ft_tests.rb +124 -0
  261. data/test/hash_test.rb +75 -0
  262. data/test/hparticipant_test.rb +164 -0
  263. data/test/lookup_att_test.rb +90 -0
  264. data/test/lookup_vf_test.rb +94 -0
  265. data/test/misc_test.rb +90 -0
  266. data/test/nut_0_irb.rb +20 -0
  267. data/test/obs_test.rb +142 -0
  268. data/test/orest_test.rb +251 -0
  269. data/test/param_test.rb +290 -0
  270. data/test/participant_test.rb +101 -0
  271. data/test/pending.rb +23 -0
  272. data/test/ps_representation.rb +133 -0
  273. data/test/rake_ltest.rb +38 -0
  274. data/test/rake_qtest.rb +68 -0
  275. data/test/raw_prog_test.rb +412 -0
  276. data/test/restart_cron_test.rb +136 -0
  277. data/test/restart_paused_test.rb +98 -0
  278. data/test/restart_sleep_test.rb +140 -0
  279. data/test/restart_tests.rb +18 -0
  280. data/test/restart_when_test.rb +112 -0
  281. data/test/ruby_procdef_test.rb +132 -0
  282. data/test/rutest_utils.rb +63 -0
  283. data/test/sec_test.rb +205 -0
  284. data/test/slock_test.rb +80 -0
  285. data/test/storage_test.rb +44 -0
  286. data/test/test.rb +3 -0
  287. data/test/timeout_test.rb +105 -0
  288. data/test/util_xml_test.rb +112 -0
  289. data/test/wfid_test.rb +175 -0
  290. data/test/wi_test.rb +75 -0
  291. metadata +433 -0
@@ -0,0 +1,198 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Sun Mar 9 20:43:02 JST 2008
8
+ #
9
+
10
+ require 'flowtestbase'
11
+
12
+ require 'openwfe/def'
13
+ require 'openwfe/participants/storeparticipants'
14
+ require 'openwfe/storage/yamlcustom'
15
+
16
+
17
+ class FlowTest84 < Test::Unit::TestCase
18
+ include FlowTestBase
19
+
20
+ #def teardown
21
+ #end
22
+
23
+ #def setup
24
+ #end
25
+
26
+ #
27
+ # TEST 0
28
+
29
+ class TestDefinition0 < OpenWFE::ProcessDefinition
30
+ sequence do
31
+ set :var => "v0", :val => "val0"
32
+ store_p
33
+ end
34
+ end
35
+
36
+ def test_0
37
+
38
+ #sp = @engine.register_participant("store_p", OpenWFE::YamlParticipant)
39
+ sp = @engine.register_participant("store_p", OpenWFE::HashParticipant)
40
+
41
+ fei = launch TestDefinition0
42
+
43
+ sleep 0.350
44
+
45
+ s = @engine.process_stack fei, true
46
+
47
+ env = s.find { |fexp| fexp.is_a?(OpenWFE::Environment) }
48
+ par = s.find { |fexp| fexp.is_a?(OpenWFE::ParticipantExpression) }
49
+
50
+ #
51
+ # testing update on env
52
+
53
+ assert_equal "val0", @engine.lookup_variable("v0", fei)
54
+
55
+ @engine.update_expression_data(
56
+ env.fei, { "v0" => "val0b", "v1" => "val1" })
57
+
58
+ assert_equal "val0b", @engine.lookup_variable("v0", fei)
59
+ assert_equal "val1", @engine.lookup_variable("v1", fei)
60
+
61
+ #
62
+ # testing update on participant expression
63
+
64
+ assert [ 1, 2 ], par.applied_workitem.attributes
65
+
66
+ @engine.update_expression_data par.fei, { 'f0' => 'val0' }
67
+
68
+ s = @engine.process_stack fei
69
+ par = s.find { |fexp| fexp.is_a?(OpenWFE::ParticipantExpression) }
70
+
71
+ assert_equal 'val0', par.applied_workitem.attributes['f0']
72
+
73
+ @engine.cancel_process fei.wfid
74
+
75
+ sleep 0.350
76
+ end
77
+
78
+ #
79
+ # TEST 1
80
+
81
+ class TestDefinition1 < OpenWFE::ProcessDefinition
82
+ sequence do
83
+ participant "alpha"
84
+ participant "bravo"
85
+ end
86
+ end
87
+
88
+ def test_1
89
+
90
+ %w{ alpha bravo charly }.each do |pname|
91
+ @engine.register_participant pname, OpenWFE::HashParticipant
92
+ end
93
+
94
+ fei = launch TestDefinition1
95
+
96
+ sleep 0.350
97
+
98
+ assert 1, @engine.get_participant("alpha").size
99
+ assert 0, @engine.get_participant("bravo").size
100
+ assert 0, @engine.get_participant("charly").size
101
+
102
+ ps = @engine.process_stack fei.wfid, true
103
+ #puts ps.collect { |fexp| fexp.to_yaml }.join("\n")
104
+
105
+ ebravo = ps.find { |fexp| fexp.fei.expid == '0.0.1' }
106
+ scharly = ebravo.to_yaml.gsub /bravo/, "charly"
107
+
108
+ @engine.update_expression(YAML.load(scharly))
109
+
110
+ wi = @engine.get_participant("alpha").first_workitem
111
+ @engine.get_participant("alpha").forward(wi)
112
+
113
+ sleep 0.350
114
+
115
+ assert 0, @engine.get_participant("alpha").size
116
+ assert 0, @engine.get_participant("bravo").size
117
+ assert 1, @engine.get_participant("charly").size
118
+
119
+ @engine.cancel_process fei.wfid
120
+
121
+ sleep 0.350
122
+ end
123
+
124
+ #
125
+ # TEST 2
126
+
127
+ class TestDefinition2 < OpenWFE::ProcessDefinition
128
+ sequence do
129
+ participant "alpha"
130
+ participant "alpha"
131
+ participant "charly"
132
+ end
133
+ end
134
+
135
+ def test_2
136
+
137
+ #log_level_to_debug
138
+
139
+ %w{ alpha bravo charly }.each do |pname|
140
+ @engine.register_participant pname, OpenWFE::HashParticipant
141
+ end
142
+
143
+ fei = launch TestDefinition2
144
+
145
+ sleep 0.350
146
+
147
+ ps = @engine.process_stack fei.wfid, true
148
+
149
+ s3fei = ps.find { |fexp| fexp.fei.expid == "0.0.1" }.fei
150
+
151
+ # update happens here
152
+
153
+ @engine.update_raw_expression s3fei, ["bravo", {}, []]
154
+
155
+ ps = @engine.process_stack fei.wfid, true
156
+
157
+ #p ps.representation
158
+
159
+ assert_equal(
160
+ ["process-definition", {"name"=>"Test", "revision"=>"2"}, [["sequence", {}, [["participant", {}, ["alpha"]], ["bravo", {}, []], ["participant", {}, ["charly"]]]]]],
161
+ ps.representation)
162
+
163
+ wi = @engine.get_participant("alpha").first_workitem
164
+ @engine.get_participant("alpha").forward(wi)
165
+
166
+ sleep 0.350
167
+
168
+ wi = @engine.get_participant("bravo").first_workitem
169
+ @engine.get_participant("bravo").forward(wi)
170
+
171
+ sleep 0.350
172
+
173
+ ps = @engine.process_stack fei.wfid, true
174
+
175
+ #puts
176
+ #ps.each do |fexp|
177
+ # puts "== #{fexp.fei.to_short_s}"
178
+ # p [ fexp.raw_representation, fexp.raw_rep_updated ]
179
+ #end
180
+ #puts
181
+
182
+ assert_equal(
183
+ ["process-definition", {"name"=>"Test", "revision"=>"2"}, [["sequence", {}, [["participant", {}, ["alpha"]], ["bravo", {"ref"=>"bravo"}, []], ["participant", {}, ["charly"]]]]]],
184
+ ps.representation)
185
+
186
+ # just to be sure
187
+
188
+ assert_equal 0, ps.find_all { |fexp| fexp.fei.expid == '0.0.1' }.size
189
+ # making sure the 2nd participant is over
190
+
191
+ #@engine.cancel_process fei
192
+ #sleep 0.350
193
+
194
+ purge_engine
195
+ end
196
+
197
+ end
198
+
@@ -0,0 +1,43 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Thu Mar 20 09:23:03 JST 2008
8
+ #
9
+
10
+ require 'flowtestbase'
11
+
12
+ require 'openwfe/def'
13
+
14
+
15
+ class FlowTest85 < Test::Unit::TestCase
16
+ include FlowTestBase
17
+
18
+ #def teardown
19
+ #end
20
+
21
+ #def setup
22
+ #end
23
+
24
+ #
25
+ # TEST 0
26
+
27
+ class TestDefinition0 < OpenWFE::ProcessDefinition
28
+ participant "toto", :arg0 => "0", :arg1 => [ 1, 2 ]
29
+ end
30
+
31
+ def test_0
32
+
33
+ @engine.register_participant "toto" do |fexp, workitem|
34
+ #p fexp.raw_representation
35
+ #p workitem.attributes
36
+ @tracer << workitem.params["arg1"].inspect
37
+ end
38
+
39
+ dotest TestDefinition0, "[1, 2]"
40
+ end
41
+
42
+ end
43
+
@@ -0,0 +1,68 @@
1
+ #
2
+ # Testing OpenWFE
3
+ #
4
+ # John Mettraux at openwfe.org
5
+ #
6
+ # Mon May 5 09:28:28 JST 2008
7
+ #
8
+
9
+ require 'rubygems'
10
+
11
+ require 'flowtestbase'
12
+
13
+ require 'openwfe/def'
14
+
15
+
16
+ class FlowTest86 < Test::Unit::TestCase
17
+ include FlowTestBase
18
+
19
+ #def setup
20
+ #end
21
+
22
+ #def teardown
23
+ #end
24
+
25
+ #
26
+ # TEST 0
27
+
28
+ class Test0 < OpenWFE::ProcessDefinition
29
+
30
+ set_fields :value => {
31
+ "a" => "f:a",
32
+ "b" => "f:b",
33
+ }
34
+
35
+ sequence do
36
+
37
+ set :var => "a", :val => "v:a"
38
+ set :var => "c", :val => "v:c"
39
+
40
+ _print "${f:a}"
41
+ _print "${v:a}"
42
+
43
+ _print "${field:a}"
44
+ _print "${variable:a}"
45
+
46
+ _print "${vf:a}"
47
+ _print "${fv:a}"
48
+
49
+ _print "${vf:b}"
50
+ _print "${fv:b}"
51
+ _print "${vf:c}"
52
+ _print "${fv:c}"
53
+
54
+ _print "${r:1+2}"
55
+ _print "${ru:4+3}"
56
+ end
57
+ end
58
+
59
+ def test_0
60
+
61
+ dotest(
62
+ Test0,
63
+ %w{ f:a v:a f:a v:a v:a f:a f:b f:b v:c v:c 3 7 }.join("\n"))
64
+ end
65
+
66
+
67
+ end
68
+
@@ -0,0 +1,74 @@
1
+ #
2
+ # Testing OpenWFE
3
+ #
4
+ # John Mettraux at openwfe.org
5
+ #
6
+ # Mon May 5 09:28:28 JST 2008
7
+ #
8
+
9
+ require 'rubygems'
10
+
11
+ require 'flowtestbase'
12
+
13
+ require 'openwfe/def'
14
+
15
+
16
+ class FlowTest87 < Test::Unit::TestCase
17
+ include FlowTestBase
18
+
19
+ #def setup
20
+ #end
21
+
22
+ #def teardown
23
+ #end
24
+
25
+ #
26
+ # TEST 0
27
+
28
+ class Test0 < OpenWFE::ProcessDefinition
29
+
30
+ sequence do
31
+ sub0
32
+ sub1
33
+ sub2
34
+ sub3
35
+ end
36
+
37
+ process_definition :name => "sub0" do
38
+ _print "sub0"
39
+ end
40
+ define :name => "sub1" do
41
+ _print "sub1"
42
+ end
43
+ process_definition "sub2" do
44
+ _print "sub2"
45
+ end
46
+ define "sub3" do
47
+ _print "sub3"
48
+ end
49
+ end
50
+
51
+ def test_0
52
+
53
+ dotest Test0, %w{ sub0 sub1 sub2 sub3 }.join("\n")
54
+ end
55
+
56
+ #
57
+ # TEST 1
58
+
59
+ class Test1 < OpenWFE::ProcessDefinition
60
+ sequence do
61
+ "bad 0"
62
+ _print "ok"
63
+ "bad 1"
64
+ _print "over"
65
+ end
66
+ end
67
+
68
+ def test_1
69
+
70
+ dotest Test1, "ok\nover"
71
+ end
72
+
73
+ end
74
+
@@ -0,0 +1,44 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Mon Dec 25 14:27:48 JST 2006
8
+ #
9
+
10
+ require 'flowtestbase'
11
+
12
+
13
+ class FlowTest8 < Test::Unit::TestCase
14
+ include FlowTestBase
15
+
16
+ #def setup
17
+ #end
18
+
19
+ #def teardown
20
+ #end
21
+
22
+ def test_forget_0
23
+ dotest(
24
+ '<process-definition name="'+name_of_test+'''" revision="0">
25
+ <sequence>
26
+ <concurrence
27
+ count="1"
28
+ >
29
+ <forget>
30
+ <print>a</print>
31
+ </forget>
32
+ <sequence>
33
+ <sleep for="500" />
34
+ <print>b</print>
35
+ </sequence>
36
+ </concurrence>
37
+ <print>c</print>
38
+ </sequence>
39
+ </process-definition>''',
40
+ "a\nc")
41
+ end
42
+
43
+ end
44
+
@@ -0,0 +1,145 @@
1
+
2
+ #
3
+ # Testing OpenWFE
4
+ #
5
+ # John Mettraux at openwfe.org
6
+ #
7
+ # Tue Jan 2 13:14:37 JST 2007
8
+ #
9
+
10
+ require 'openwfe/def'
11
+ require 'flowtestbase'
12
+
13
+
14
+ class FlowTest9 < Test::Unit::TestCase
15
+ include FlowTestBase
16
+
17
+ #def setup
18
+ #end
19
+
20
+ #def teardown
21
+ #end
22
+
23
+ def test_cursor_0
24
+ dotest(
25
+ '<process-definition name="'+name_of_test+'''" revision="0">
26
+ <cursor>
27
+ <print>a</print>
28
+ <print>b</print>
29
+ </cursor>
30
+ </process-definition>''',
31
+ """a
32
+ b""")
33
+ end
34
+
35
+ def test_cursor_1
36
+ dotest(
37
+ '<process-definition name="'+name_of_test+'''" revision="0">
38
+ <cursor>
39
+ <print>a</print>
40
+ <print>b</print>
41
+ <cancel />
42
+ <print>c</print>
43
+ </cursor>
44
+ </process-definition>''',
45
+ """a
46
+ b""")
47
+ end
48
+
49
+ def test_cursor_2
50
+ dotest(
51
+ '<process-definition name="'+name_of_test+'''" revision="0">
52
+ <cursor>
53
+ <print>a</print>
54
+ <print>b</print>
55
+ <skip step="2" />
56
+ <print>c</print>
57
+ </cursor>
58
+ </process-definition>''',
59
+ """a
60
+ b""")
61
+ end
62
+
63
+ def test_cursor_2b
64
+ #
65
+ # ZigZag test
66
+ #
67
+ dotest(
68
+ '<process-definition name="'+name_of_test+'''" revision="0">
69
+ <cursor>
70
+ <print>a</print>
71
+ <skip step="3" />
72
+ <print>b</print>
73
+ <skip step="2" />
74
+ <back step="2"/>
75
+ <print>c</print>
76
+ </cursor>
77
+ </process-definition>''',
78
+ """a
79
+ b
80
+ c""")
81
+ end
82
+
83
+ def test_cursor_3
84
+ dotest(
85
+ '<process-definition name="'+name_of_test+'''" revision="0">
86
+ <cursor>
87
+ <print>a</print>
88
+ <skip step="2" />
89
+ <print>b</print>
90
+ <print>c</print>
91
+ </cursor>
92
+ </process-definition>''',
93
+ """a
94
+ c""")
95
+ end
96
+
97
+ def test_cursor_4
98
+ dotest(
99
+ '<process-definition name="'+name_of_test+'''" revision="0">
100
+ <sequence>
101
+ <cursor>
102
+ <print>a</print>
103
+ <set field="__cursor_command__" value="skip 2" />
104
+ <print>b</print>
105
+ <print>c</print>
106
+ </cursor>
107
+ <print>d</print>
108
+ </sequence>
109
+ </process-definition>''',
110
+ """a
111
+ c
112
+ d""")
113
+ end
114
+
115
+ def test_cursor_5
116
+ dotest(
117
+ '<process-definition name="'+name_of_test+'''" revision="0">
118
+ <cursor>
119
+ <print>a</print>
120
+ <skip>2</skip>
121
+ <print>b</print>
122
+ <print>c</print>
123
+ </cursor>
124
+ </process-definition>''',
125
+ """a
126
+ c""")
127
+ end
128
+
129
+ class TestCursor6 < OpenWFE::ProcessDefinition
130
+ cursor do
131
+ _print "a"
132
+ skip "2"
133
+ _print "b"
134
+ _print "c"
135
+ skip 2
136
+ _print "d"
137
+ end
138
+ end
139
+
140
+ def test_cursor_6
141
+ dotest(TestCursor6, "a\nc")
142
+ end
143
+
144
+ end
145
+