ruote 0.9.18 → 0.9.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. data/README.txt +2 -0
  2. data/examples/about_state.rb +29 -29
  3. data/examples/bigflow.rb +9 -9
  4. data/examples/csv_weather.rb +4 -4
  5. data/examples/engine_template.rb +141 -129
  6. data/examples/flowtracing.rb +8 -8
  7. data/examples/homeworkreview.rb +15 -15
  8. data/examples/kotoba.rb +9 -9
  9. data/examples/mano_tracker.rb +63 -63
  10. data/examples/openwferu.rb +22 -20
  11. data/examples/quotereporter.rb +79 -79
  12. data/lib/openwfe/contextual.rb +72 -72
  13. data/lib/openwfe/def.rb +21 -21
  14. data/lib/openwfe/engine.rb +19 -19
  15. data/lib/openwfe/engine/engine.rb +578 -614
  16. data/lib/openwfe/engine/expool_methods.rb +144 -115
  17. data/lib/openwfe/engine/file_persisted_engine.rb +77 -77
  18. data/lib/openwfe/engine/participant_methods.rb +96 -96
  19. data/lib/openwfe/engine/status_methods.rb +271 -247
  20. data/lib/openwfe/engine/update_exp_methods.rb +69 -69
  21. data/lib/openwfe/exceptions.rb +25 -25
  22. data/lib/openwfe/expool/errorjournal.rb +334 -348
  23. data/lib/openwfe/expool/expool_pause_methods.rb +98 -0
  24. data/lib/openwfe/expool/expressionpool.rb +793 -800
  25. data/lib/openwfe/expool/expstorage.rb +284 -313
  26. data/lib/openwfe/expool/history.rb +193 -105
  27. data/lib/openwfe/expool/journal.rb +163 -163
  28. data/lib/openwfe/expool/journal_replay.rb +228 -228
  29. data/lib/openwfe/expool/parser.rb +178 -142
  30. data/lib/openwfe/{orest/exception.rb → expool/paused_error.rb} +49 -32
  31. data/lib/openwfe/expool/representation.rb +59 -59
  32. data/lib/openwfe/expool/threadedexpstorage.rb +137 -134
  33. data/lib/openwfe/expool/wfidgen.rb +289 -287
  34. data/lib/openwfe/expool/yamlexpstorage.rb +154 -154
  35. data/lib/openwfe/expressions/condition.rb +175 -168
  36. data/lib/openwfe/expressions/environment.rb +165 -165
  37. data/lib/openwfe/expressions/expressionmap.rb +135 -131
  38. data/lib/openwfe/expressions/fe_cancel.rb +68 -68
  39. data/lib/openwfe/expressions/fe_command.rb +190 -190
  40. data/lib/openwfe/expressions/fe_concurrence.rb +531 -531
  41. data/lib/openwfe/expressions/fe_cron.rb +152 -197
  42. data/lib/openwfe/expressions/fe_cursor.rb +152 -186
  43. data/lib/openwfe/expressions/fe_define.rb +118 -118
  44. data/lib/openwfe/expressions/fe_do.rb +109 -109
  45. data/lib/openwfe/expressions/fe_equals.rb +219 -219
  46. data/lib/openwfe/expressions/fe_filter.rb +98 -98
  47. data/lib/openwfe/expressions/fe_filter_definition.rb +122 -122
  48. data/lib/openwfe/expressions/fe_fqv.rb +203 -203
  49. data/lib/openwfe/expressions/fe_http.rb +212 -0
  50. data/lib/openwfe/expressions/fe_if.rb +214 -214
  51. data/lib/openwfe/expressions/fe_iterator.rb +91 -91
  52. data/lib/openwfe/expressions/fe_listen.rb +268 -268
  53. data/lib/openwfe/expressions/fe_losfor.rb +73 -73
  54. data/lib/openwfe/expressions/fe_misc.rb +343 -351
  55. data/lib/openwfe/expressions/fe_participant.rb +206 -206
  56. data/lib/openwfe/expressions/fe_reserve.rb +153 -142
  57. data/lib/openwfe/expressions/fe_save.rb +226 -226
  58. data/lib/openwfe/expressions/fe_sequence.rb +66 -56
  59. data/lib/openwfe/expressions/fe_set.rb +80 -80
  60. data/lib/openwfe/expressions/fe_sleep.rb +132 -125
  61. data/lib/openwfe/expressions/fe_step.rb +113 -111
  62. data/lib/openwfe/expressions/fe_subprocess.rb +139 -136
  63. data/lib/openwfe/expressions/fe_timeout.rb +74 -78
  64. data/lib/openwfe/expressions/fe_wait.rb +48 -49
  65. data/lib/openwfe/expressions/fe_when.rb +106 -106
  66. data/lib/openwfe/expressions/filter.rb +60 -60
  67. data/lib/openwfe/expressions/flowexpression.rb +618 -612
  68. data/lib/openwfe/expressions/iterator.rb +158 -158
  69. data/lib/openwfe/expressions/merge.rb +53 -53
  70. data/lib/openwfe/expressions/raw.rb +396 -397
  71. data/lib/openwfe/expressions/rprocdef.rb +261 -266
  72. data/lib/openwfe/expressions/time.rb +238 -243
  73. data/lib/openwfe/expressions/timeout.rb +135 -135
  74. data/lib/openwfe/expressions/value.rb +55 -55
  75. data/lib/openwfe/extras/engine/db_persisted_engine.rb +94 -0
  76. data/lib/openwfe/extras/expool/dberrorjournal.rb +189 -0
  77. data/lib/openwfe/extras/expool/dbexpstorage.rb +355 -0
  78. data/lib/openwfe/extras/expool/dbhistory.rb +135 -0
  79. data/lib/openwfe/extras/listeners/sqslisteners.rb +146 -0
  80. data/lib/openwfe/extras/misc/activityfeed.rb +264 -0
  81. data/lib/openwfe/extras/misc/basecamp.rb +485 -0
  82. data/lib/openwfe/extras/participants/activeparticipants.rb +749 -0
  83. data/lib/openwfe/extras/participants/atomfeed_participants.rb +173 -0
  84. data/lib/openwfe/extras/participants/atompub_participants.rb +267 -0
  85. data/lib/openwfe/extras/participants/basecamp_participants.rb +87 -0
  86. data/lib/openwfe/extras/participants/csvparticipants.rb +127 -0
  87. data/lib/openwfe/extras/participants/sqsparticipants.rb +125 -0
  88. data/lib/openwfe/extras/participants/twitterparticipants.rb +176 -0
  89. data/lib/openwfe/filterdef.rb +191 -191
  90. data/lib/openwfe/flowexpressionid.rb +271 -269
  91. data/lib/openwfe/listeners/listener.rb +61 -61
  92. data/lib/openwfe/listeners/listeners.rb +81 -81
  93. data/lib/openwfe/listeners/socketlisteners.rb +189 -189
  94. data/lib/openwfe/logging.rb +74 -74
  95. data/lib/openwfe/omixins.rb +55 -54
  96. data/lib/openwfe/orest/definitions.rb +90 -90
  97. data/lib/openwfe/orest/osocket.rb +91 -91
  98. data/lib/openwfe/orest/xmlcodec.rb +471 -459
  99. data/lib/openwfe/participants.rb +19 -19
  100. data/lib/openwfe/participants/enoparticipants.rb +187 -187
  101. data/lib/openwfe/participants/participant.rb +100 -100
  102. data/lib/openwfe/participants/participantmap.rb +170 -170
  103. data/lib/openwfe/participants/participants.rb +316 -316
  104. data/lib/openwfe/participants/soapparticipants.rb +90 -90
  105. data/lib/openwfe/participants/socketparticipants.rb +143 -143
  106. data/lib/openwfe/participants/storeparticipants.rb +198 -198
  107. data/lib/openwfe/rexml.rb +44 -0
  108. data/lib/openwfe/rudefinitions.rb +87 -91
  109. data/lib/openwfe/service.rb +65 -65
  110. data/lib/openwfe/storage/yamlcustom.rb +71 -71
  111. data/lib/openwfe/storage/yamlfilestorage.rb +190 -190
  112. data/lib/openwfe/tools/flowtracer.rb +41 -45
  113. data/lib/openwfe/util/dollar.rb +125 -139
  114. data/lib/openwfe/util/irb.rb +42 -42
  115. data/lib/openwfe/util/observable.rb +93 -99
  116. data/lib/openwfe/util/ometa.rb +36 -36
  117. data/lib/openwfe/util/treechecker.rb +122 -0
  118. data/lib/openwfe/util/workqueue.rb +73 -73
  119. data/lib/openwfe/util/xml.rb +285 -279
  120. data/lib/openwfe/utils.rb +415 -442
  121. data/lib/openwfe/version.rb +1 -1
  122. data/lib/openwfe/workitem.rb +444 -437
  123. data/lib/openwfe/worklist/oldrest.rb +161 -161
  124. data/lib/openwfe/worklist/storelocks.rb +218 -218
  125. data/lib/openwfe/worklist/storeparticipant.rb +19 -19
  126. data/lib/openwfe/worklist/worklist.rb +223 -223
  127. data/test/back_0916_test.rb +57 -59
  128. data/test/bm/bm_1_xml_vs_prog.rb +25 -22
  129. data/test/bm/bm_2_step.rb +81 -81
  130. data/test/bm/ft_0f_5ms.rb +13 -13
  131. data/test/bm/ft_26_load.rb +177 -179
  132. data/test/bm/ft_26b_load.rb +57 -59
  133. data/test/bm/ft_26c_load.rb +70 -65
  134. data/test/bm/ft_recu.rb +51 -51
  135. data/test/clone_test.rb +145 -99
  136. data/test/concurrence_test.rb +41 -41
  137. data/test/condition_test.rb +104 -90
  138. data/test/description_test.rb +46 -45
  139. data/test/eno_test.rb +36 -36
  140. data/test/expmap_test.rb +26 -26
  141. data/test/extras/README.txt +5 -0
  142. data/test/extras/active_connection.rb +48 -0
  143. data/test/extras/active_with_engine_test.rb +140 -0
  144. data/test/extras/activityfeed_test.rb +85 -0
  145. data/test/extras/ap_0_test.rb +287 -0
  146. data/test/extras/ap_1_test.rb +53 -0
  147. data/test/extras/ap_test_base.rb +24 -0
  148. data/test/extras/atomfeedp_test.rb +113 -0
  149. data/test/extras/atompubp_test.rb +91 -0
  150. data/test/extras/basecamp_test.rb +53 -0
  151. data/test/extras/db_errorjournal_utest.rb +75 -0
  152. data/test/extras/db_expstorage_utest.rb +171 -0
  153. data/test/extras/db_history_0_test.rb +58 -0
  154. data/test/extras/ft_19_csv.rb +58 -0
  155. data/test/extras/ft_71_b14008.rb +85 -0
  156. data/test/extras/sqs_test.rb +57 -0
  157. data/test/extras/twitter_test.rb +62 -0
  158. data/test/fe_lookup_att_test.rb +41 -41
  159. data/test/fei_test.rb +131 -131
  160. data/test/file_persisted_engine_test.rb +30 -30
  161. data/test/file_persistence_test.rb +112 -111
  162. data/test/filep_cancel_test.rb +58 -58
  163. data/test/filter_test.rb +67 -67
  164. data/test/flowtestbase.rb +207 -219
  165. data/test/ft_0.rb +35 -35
  166. data/test/ft_0b_sequence.rb +15 -15
  167. data/test/ft_0c_testname.rb +12 -12
  168. data/test/ft_0d_participant.rb +9 -9
  169. data/test/ft_0e_multibody.rb +11 -11
  170. data/test/ft_10_loop.rb +103 -104
  171. data/test/ft_11_ppd.rb +285 -289
  172. data/test/ft_11b_ppd.rb +26 -26
  173. data/test/ft_12_blockparticipant.rb +57 -57
  174. data/test/ft_13_eno.rb +31 -31
  175. data/test/ft_14_subprocess.rb +45 -45
  176. data/test/ft_14b_subprocess.rb +107 -107
  177. data/test/ft_14c_subprocess.rb +33 -33
  178. data/test/ft_15_iterator.rb +127 -127
  179. data/test/ft_15b_iterator.rb +41 -41
  180. data/test/ft_16_fqv.rb +44 -44
  181. data/test/ft_17_condition.rb +48 -48
  182. data/test/ft_18_pname.rb +26 -26
  183. data/test/ft_1_unset.rb +140 -140
  184. data/test/ft_1b_unset.rb +17 -17
  185. data/test/ft_20_cron.rb +33 -33
  186. data/test/ft_21_cron.rb +51 -51
  187. data/test/ft_21b_cron_pause.rb +41 -41
  188. data/test/ft_22_history.rb +45 -41
  189. data/test/ft_23_when.rb +51 -51
  190. data/test/ft_23b_when.rb +43 -43
  191. data/test/ft_23c_wait.rb +48 -48
  192. data/test/ft_23d_cww.rb +28 -28
  193. data/test/ft_24_def.rb +15 -15
  194. data/test/ft_25_cancel.rb +57 -54
  195. data/test/ft_27_getflowpos.rb +79 -83
  196. data/test/ft_28_fileparticipant.rb +25 -25
  197. data/test/ft_29_httprb.rb +57 -57
  198. data/test/ft_2_concurrence.rb +99 -97
  199. data/test/ft_2b_concurrence.rb +132 -132
  200. data/test/ft_2c_concurrence.rb +37 -37
  201. data/test/ft_30_socketlistener.rb +133 -133
  202. data/test/ft_31_flowname.rb +15 -16
  203. data/test/ft_32_journal.rb +48 -48
  204. data/test/ft_32c_journal.rb +54 -54
  205. data/test/ft_32d_journal.rb +43 -46
  206. data/test/ft_33_description.rb +62 -62
  207. data/test/ft_34_cancelwfid.rb +37 -37
  208. data/test/ft_35_localdefs.rb +36 -34
  209. data/test/ft_36_subprocids.rb +61 -61
  210. data/test/ft_37_pnames.rb +33 -33
  211. data/test/ft_38_tag.rb +82 -82
  212. data/test/ft_38b_tag.rb +97 -97
  213. data/test/ft_38c_tag.rb +50 -50
  214. data/test/ft_38d_tag.rb +53 -0
  215. data/test/ft_39_reserve.rb +33 -33
  216. data/test/ft_39b_reserve.rb +59 -59
  217. data/test/ft_3_equals.rb +131 -131
  218. data/test/ft_3b_lookup_vf.rb +43 -43
  219. data/test/ft_40_defined.rb +33 -33
  220. data/test/ft_41_case.rb +80 -80
  221. data/test/ft_42_environments.rb +48 -48
  222. data/test/ft_43_pat10.rb +51 -51
  223. data/test/ft_44_save.rb +37 -37
  224. data/test/ft_44b_restore.rb +151 -151
  225. data/test/ft_45_citerator.rb +149 -149
  226. data/test/ft_45b_citerator.rb +77 -0
  227. data/test/ft_46_pparams.rb +27 -27
  228. data/test/ft_47_filter.rb +100 -100
  229. data/test/ft_48_fe_filter.rb +41 -41
  230. data/test/ft_49_condition.rb +101 -94
  231. data/test/ft_4_misc.rb +185 -190
  232. data/test/ft_50_xml_attribute.rb +101 -104
  233. data/test/ft_51_stack.rb +30 -30
  234. data/test/ft_52_obs_participant.rb +73 -73
  235. data/test/ft_53_null_noop_participant.rb +31 -31
  236. data/test/ft_54_listen.rb +183 -183
  237. data/test/ft_54b_listen.rb +32 -32
  238. data/test/ft_54c_listen.rb +60 -60
  239. data/test/ft_55_ptimeout.rb +29 -30
  240. data/test/ft_56_timeout.rb +29 -29
  241. data/test/ft_57_a.rb +105 -102
  242. data/test/ft_58_ejournal.rb +83 -80
  243. data/test/ft_58b_ejournal.rb +82 -0
  244. data/test/ft_59_ps.rb +148 -86
  245. data/test/ft_5_time.rb +77 -77
  246. data/test/ft_60_ecancel.rb +98 -98
  247. data/test/ft_61_elsub.rb +23 -23
  248. data/test/ft_62_procparticipant.rb +46 -46
  249. data/test/ft_63_pause.rb +82 -69
  250. data/test/ft_64_alias.rb +56 -57
  251. data/test/ft_65_stringlaunch.rb +29 -29
  252. data/test/ft_66_subforget.rb +42 -42
  253. data/test/ft_67_schedlaunch.rb +58 -59
  254. data/test/ft_68_ifparticipant.rb +39 -39
  255. data/test/ft_69_cancelmissing.rb +23 -21
  256. data/test/ft_6_lambda.rb +37 -37
  257. data/test/ft_70_lookupvar.rb +25 -25
  258. data/test/ft_71_log.rb +35 -35
  259. data/test/ft_72_lookup_processes.rb +43 -40
  260. data/test/ft_73_cancel_sub.rb +79 -79
  261. data/test/ft_74_block_and_workitem_dup.rb +42 -42
  262. data/test/ft_75_ruby_attributes.rb +53 -51
  263. data/test/ft_76_merge_isolate.rb +57 -57
  264. data/test/ft_77_segments.rb +13 -13
  265. data/test/ft_78_eval.rb +94 -94
  266. data/test/ft_79_tticket.rb +79 -79
  267. data/test/ft_79b_tticket.rb +73 -73
  268. data/test/ft_79c_outcome.rb +36 -36
  269. data/test/ft_7_lose.rb +73 -73
  270. data/test/ft_7b_lose.rb +49 -49
  271. data/test/ft_80_spname.rb +65 -65
  272. data/test/ft_81_exp.rb +30 -30
  273. data/test/ft_82_trecu.rb +30 -24
  274. data/test/ft_83_badpause.rb +35 -35
  275. data/test/ft_84_updateexp.rb +118 -118
  276. data/test/ft_84b_subrepr.rb +72 -0
  277. data/test/ft_85_dolhash.rb +18 -18
  278. data/test/ft_86_dollar_fv.rb +33 -33
  279. data/test/ft_87_define.rb +47 -47
  280. data/test/ft_88_http.rb +100 -0
  281. data/test/ft_8_forget.rb +25 -25
  282. data/test/ft_9_cursor.rb +119 -110
  283. data/test/ft_9b_cursor.rb +70 -70
  284. data/test/ft_tests.rb +6 -0
  285. data/test/hash_test.rb +52 -34
  286. data/test/hparticipant_test.rb +92 -88
  287. data/test/lookup_att_test.rb +70 -70
  288. data/test/lookup_vf_test.rb +52 -52
  289. data/test/misc_test.rb +55 -51
  290. data/test/obs_test.rb +82 -82
  291. data/test/param_test.rb +181 -181
  292. data/test/participant_test.rb +46 -46
  293. data/test/pending.rb +12 -12
  294. data/test/ps_representation.rb +70 -70
  295. data/test/rake_ltest.rb +2 -2
  296. data/test/rake_qtest.rb +11 -11
  297. data/test/raw_prog_test.rb +303 -308
  298. data/test/restart_cron_test.rb +74 -74
  299. data/test/restart_paused_test.rb +52 -47
  300. data/test/restart_sleep_test.rb +80 -80
  301. data/test/restart_when_test.rb +64 -64
  302. data/test/ruby_procdef_test.rb +71 -71
  303. data/test/rutest_utils.rb +32 -32
  304. data/test/sec_test.rb +143 -142
  305. data/test/slock_test.rb +41 -41
  306. data/test/storage_test.rb +15 -15
  307. data/test/timeout_test.rb +53 -53
  308. data/test/treechecker_test.rb +111 -0
  309. data/test/util_xml_test.rb +57 -57
  310. data/test/wfid_test.rb +93 -93
  311. data/test/wi_test.rb +58 -58
  312. metadata +64 -19
  313. data/examples/scheduler_cron_usage.rb +0 -48
  314. data/examples/scheduler_usage.rb +0 -56
  315. data/lib/openwfe/orest/controlclient.rb +0 -119
  316. data/lib/openwfe/orest/oldrestservlet.rb +0 -279
  317. data/lib/openwfe/orest/restclient.rb +0 -176
  318. data/lib/openwfe/orest/workitem.rb +0 -206
  319. data/lib/openwfe/orest/worklistclient.rb +0 -272
  320. data/test/bm/ft_26d_load.rb +0 -97
  321. data/test/ft_59b_ps_for_pat.rb +0 -58
  322. data/test/ft_64_clone.rb +0 -69
  323. data/test/orest_test.rb +0 -251
@@ -20,82 +20,82 @@ require 'openwfe/participants/participants'
20
20
 
21
21
  class ParticipantTest < Test::Unit::TestCase
22
22
 
23
- def setup
24
- @engine = OpenWFE::Engine.new
25
- end
23
+ def setup
24
+ @engine = OpenWFE::Engine.new
25
+ end
26
26
 
27
- def teardown
28
- @engine.stop
29
- end
27
+ def teardown
28
+ @engine.stop
29
+ end
30
30
 
31
- def test_lookup_participant
31
+ def test_lookup_participant
32
32
 
33
- @engine.register_participant :toto, OpenWFE::NullParticipant
33
+ @engine.register_participant :toto, OpenWFE::NullParticipant
34
34
 
35
- p = @engine.get_participant "toto"
36
- assert_kind_of OpenWFE::NullParticipant, p
35
+ p = @engine.get_participant "toto"
36
+ assert_kind_of OpenWFE::NullParticipant, p
37
37
 
38
- p = @engine.get_participant :toto
39
- assert_kind_of OpenWFE::NullParticipant, p
38
+ p = @engine.get_participant :toto
39
+ assert_kind_of OpenWFE::NullParticipant, p
40
40
 
41
- assert_equal 1, @engine.get_participant_map.size
42
- end
41
+ assert_equal 1, @engine.get_participant_map.size
42
+ end
43
43
 
44
- def test_unregister_participant
44
+ def test_unregister_participant
45
45
 
46
- assert ( ! @engine.unregister_participant(:nada))
46
+ assert ( ! @engine.unregister_participant(:nada))
47
47
 
48
- @engine.register_participant :toto, OpenWFE::NullParticipant
48
+ @engine.register_participant :toto, OpenWFE::NullParticipant
49
49
 
50
- assert_equal 1, @engine.get_participant_map.size
50
+ assert_equal 1, @engine.get_participant_map.size
51
51
 
52
- assert @engine.unregister_participant(:toto)
52
+ assert @engine.unregister_participant(:toto)
53
53
 
54
- assert_equal 0, @engine.get_participant_map.size
54
+ assert_equal 0, @engine.get_participant_map.size
55
55
 
56
- @engine.register_participant "user_.*", OpenWFE::NullParticipant
56
+ @engine.register_participant "user_.*", OpenWFE::NullParticipant
57
57
 
58
- assert_equal 1, @engine.get_participant_map.size
58
+ assert_equal 1, @engine.get_participant_map.size
59
59
 
60
- assert @engine.unregister_participant("user_.*")
60
+ assert @engine.unregister_participant("user_.*")
61
61
 
62
- assert_equal 0, @engine.get_participant_map.size
63
- end
62
+ assert_equal 0, @engine.get_participant_map.size
63
+ end
64
64
 
65
- def test_order
65
+ def test_order
66
66
 
67
- s = ""
67
+ s = ""
68
68
 
69
- @engine.register_participant "a.*", :astar
70
- @engine.register_participant "alpha", :alpha
69
+ @engine.register_participant "a.*", :astar
70
+ @engine.register_participant "alpha", :alpha
71
71
 
72
- assert_equal :astar, @engine.get_participant("alpha")
72
+ assert_equal :astar, @engine.get_participant("alpha")
73
73
 
74
- clean_participants
74
+ clean_participants
75
75
 
76
- @engine.register_participant "alpha", :alpha
77
- @engine.register_participant "a.*", :astar
76
+ @engine.register_participant "alpha", :alpha
77
+ @engine.register_participant "a.*", :astar
78
78
 
79
- assert_equal :alpha, @engine.get_participant("alpha")
79
+ assert_equal :alpha, @engine.get_participant("alpha")
80
80
 
81
- clean_participants
81
+ clean_participants
82
82
 
83
- @engine.register_participant "a.*", :astar
83
+ @engine.register_participant "a.*", :astar
84
84
 
85
- assert_equal :astar, @engine.get_participant("alpha")
85
+ assert_equal :astar, @engine.get_participant("alpha")
86
86
 
87
- @engine.register_participant "alpha", { :participant => :alpha, :position => :first }
87
+ @engine.register_participant "alpha", { :participant => :alpha, :position => :first }
88
88
 
89
- assert_equal :alpha, @engine.get_participant("alpha")
90
- assert_equal :astar, @engine.get_participant("abricot")
91
- end
89
+ assert_equal :alpha, @engine.get_participant("alpha")
90
+ assert_equal :astar, @engine.get_participant("abricot")
91
+ end
92
92
 
93
- protected
93
+ protected
94
94
 
95
- def clean_participants
95
+ def clean_participants
96
96
 
97
- @engine.get_participant_map.instance_variable_set(
98
- :@participants, [])
99
- end
97
+ @engine.get_participant_map.instance_variable_set(
98
+ :@participants, [])
99
+ end
100
100
 
101
101
  end
data/test/pending.rb CHANGED
@@ -5,19 +5,19 @@
5
5
 
6
6
  module PendingJobsMixin
7
7
 
8
- def assert_no_jobs_left
8
+ def assert_no_jobs_left
9
9
 
10
- #cname = @engine.class.name
11
- #min_jobs = if cname == 'OpenWFE::CachedFilePersistedEngine'
12
- # 1
13
- #elsif cname == 'OpenWFE::Extras::CachedDbPersistedEngine'
14
- # 1
15
- #else
16
- # 0
17
- #end
18
- #assert_equal min_jobs, @engine.get_scheduler.pending_job_count
10
+ #cname = @engine.class.name
11
+ #min_jobs = if cname == 'OpenWFE::CachedFilePersistedEngine'
12
+ # 1
13
+ #elsif cname == 'OpenWFE::Extras::CachedDbPersistedEngine'
14
+ # 1
15
+ #else
16
+ # 0
17
+ #end
18
+ #assert_equal min_jobs, @engine.get_scheduler.pending_job_count
19
19
 
20
- assert_equal 0, @engine.get_scheduler.at_job_count
21
- end
20
+ assert_equal 0, @engine.get_scheduler.at_job_count
21
+ end
22
22
  end
23
23
 
@@ -16,118 +16,118 @@ require 'openwfe/engine'
16
16
 
17
17
  class PsRepresentationTest < Test::Unit::TestCase
18
18
 
19
- def setup
19
+ def setup
20
20
 
21
- @engine = OpenWFE::Engine.new :definition_in_launchitem_allowed => true
22
- end
21
+ @engine = OpenWFE::Engine.new :definition_in_launchitem_allowed => true
22
+ end
23
23
 
24
- def teardown
24
+ def teardown
25
25
 
26
- @engine.stop if @engine
27
- end
26
+ @engine.stop if @engine
27
+ end
28
28
 
29
- #
30
- # TEST 0
29
+ #
30
+ # TEST 0
31
31
 
32
- class Test0 < OpenWFE::ProcessDefinition
33
- sequence do
34
- alpha
35
- bravo
36
- end
32
+ class Test0 < OpenWFE::ProcessDefinition
33
+ sequence do
34
+ alpha
35
+ bravo
37
36
  end
37
+ end
38
38
 
39
- def test_0
39
+ def test_0
40
40
 
41
- @engine.register_participant "alpha", OpenWFE::NullParticipant
41
+ @engine.register_participant "alpha", OpenWFE::NullParticipant
42
42
 
43
- fei = @engine.launch Test0
43
+ fei = @engine.launch Test0
44
44
 
45
- sleep 0.350
45
+ sleep 0.350
46
46
 
47
- ps = @engine.process_stack fei, true
47
+ ps = @engine.process_stack fei, true
48
48
 
49
- #p ps.representation
49
+ #p ps.representation
50
50
 
51
- assert_equal(
52
- ["process-definition", {"name"=>"Test", "revision"=>"0"}, [["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["bravo", {}, []]]]]],
53
- ps.representation)
51
+ assert_equal(
52
+ ["process-definition", {"name"=>"Test", "revision"=>"0"}, [["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["bravo", {}, []]]]]],
53
+ ps.representation)
54
54
 
55
- #
56
- # change process instance (charly instead of bravo)
55
+ #
56
+ # change process instance (charly instead of bravo)
57
57
 
58
- #puts ps.collect { |fexp| fexp.fei.to_s }.join("\n")
58
+ #puts ps.collect { |fexp| fexp.fei.to_s }.join("\n")
59
59
 
60
- bravo_fei = ps.find { |fexp| fexp.fei.expid == "0.0.1" }.fei
60
+ bravo_fei = ps.find { |fexp| fexp.fei.expid == "0.0.1" }.fei
61
61
 
62
- @engine.update_raw_expression bravo_fei, ["charly", {}, []]
62
+ @engine.update_raw_expression bravo_fei, ["charly", {}, []]
63
63
 
64
- ps = @engine.process_stack fei, true
64
+ ps = @engine.process_stack fei, true
65
65
 
66
- assert_equal(
67
- ["process-definition", {"name"=>"Test", "revision"=>"0"}, [["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["charly", {}, []]]]]],
68
- ps.representation)
69
- end
66
+ assert_equal(
67
+ ["process-definition", {"name"=>"Test", "revision"=>"0"}, [["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["charly", {}, []]]]]],
68
+ ps.representation)
69
+ end
70
70
 
71
- #
72
- # TEST 1
71
+ #
72
+ # TEST 1
73
73
 
74
- class Test1 < OpenWFE::ProcessDefinition
74
+ class Test1 < OpenWFE::ProcessDefinition
75
75
 
76
- description "interference of the description"
76
+ description "interference of the description"
77
77
 
78
- sequence do
79
- alpha
80
- bravo
81
- end
78
+ sequence do
79
+ alpha
80
+ bravo
82
81
  end
82
+ end
83
83
 
84
- def test_1
84
+ def test_1
85
85
 
86
- @engine.register_participant "alpha", OpenWFE::NullParticipant
86
+ @engine.register_participant "alpha", OpenWFE::NullParticipant
87
87
 
88
- fei = @engine.launch Test1
88
+ fei = @engine.launch Test1
89
89
 
90
- sleep 0.350
90
+ sleep 0.350
91
91
 
92
- ps = @engine.process_stack fei, true
92
+ ps = @engine.process_stack fei, true
93
93
 
94
- assert_equal(
95
- ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["bravo", {}, []]]]]],
96
- ps.representation)
94
+ assert_equal(
95
+ ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["bravo", {}, []]]]]],
96
+ ps.representation)
97
97
 
98
- #
99
- # change process instance (charly instead of bravo)
98
+ #
99
+ # change process instance (charly instead of bravo)
100
100
 
101
- bravo_fei = ps.find { |fexp| fexp.fei.expid == "0.1.1" }.fei
101
+ bravo_fei = ps.find { |fexp| fexp.fei.expid == "0.1.1" }.fei
102
102
 
103
- @engine.update_raw_expression bravo_fei, ["charly", {}, []]
103
+ @engine.update_raw_expression bravo_fei, ["charly", {}, []]
104
104
 
105
- ps = @engine.process_stack fei, true
105
+ ps = @engine.process_stack fei, true
106
106
 
107
- assert_equal(
108
- ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["charly", {}, []]]]]],
109
- ps.representation)
107
+ assert_equal(
108
+ ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []], ["charly", {}, []]]]]],
109
+ ps.representation)
110
110
 
111
- #
112
- # nuke participant charly
111
+ #
112
+ # nuke participant charly
113
113
 
114
- @engine.cancel_expression bravo_fei
114
+ @engine.cancel_expression bravo_fei
115
115
 
116
- sleep 0.350
116
+ sleep 0.350
117
117
 
118
- ps = @engine.process_stack fei, true
118
+ ps = @engine.process_stack fei, true
119
119
 
120
- #p ps.representation
120
+ #p ps.representation
121
121
 
122
- assert_equal(
123
- ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []]]]]],
124
- ps.representation)
122
+ assert_equal(
123
+ ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []]]]]],
124
+ ps.representation)
125
125
 
126
- assert_equal(
127
- ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []]]]]],
128
- @engine.process_representation(fei.wfid))
129
- end
126
+ assert_equal(
127
+ ["process-definition", {"name"=>"Test", "revision"=>"1"}, [["description", {}, ["interference of the description"]], ["sequence", {}, [["alpha", {"ref"=>"alpha"}, []]]]]],
128
+ @engine.process_representation(fei.wfid))
129
+ end
130
130
 
131
- # see also test/ft_84_updateexp.rb
131
+ # see also test/ft_84_updateexp.rb
132
132
 
133
133
  end
data/test/rake_ltest.rb CHANGED
@@ -28,8 +28,8 @@ require 'ft_51_stack'
28
28
  require 'ft_29_httprb' # needs net connection
29
29
 
30
30
  #require 'ft_30_socketlistener'
31
- #
32
- # shaky test...
31
+ #
32
+ # shaky test...
33
33
 
34
34
  #
35
35
  # the quick tests
data/test/rake_qtest.rb CHANGED
@@ -26,6 +26,7 @@ require 'obs_test'
26
26
  require 'clone_test'
27
27
  require 'lookup_vf_test'
28
28
  require 'fe_lookup_att_test'
29
+ require 'treechecker_test'
29
30
 
30
31
  require 'sec_test'
31
32
  require 'param_test'
@@ -40,8 +41,8 @@ require 'ps_representation'
40
41
  require 'util_xml_test'
41
42
 
42
43
  require 'ft_tests'
43
- #
44
- # all the 'ft' tests are required in 'ft_tests.rb'
44
+ #
45
+ # all the 'ft' tests are required in 'ft_tests.rb'
45
46
 
46
47
  #require 'ft_30_socketlistener'
47
48
 
@@ -50,19 +51,18 @@ require 'hparticipant_test'
50
51
  require 'timeout_test'
51
52
 
52
53
  require 'slock_test'
53
- require 'orest_test.rb'
54
54
 
55
55
  #require 'extras/atomfeedp_test.rb'
56
56
 
57
57
 
58
58
  #Signal.trap "SIGINT" do |signo|
59
- # puts
60
- # puts "Interrupt"
61
- # puts
62
- # puts caller[1..-1]
63
- # puts
64
- # exit 0
59
+ # puts
60
+ # puts "Interrupt"
61
+ # puts
62
+ # puts caller[1..-1]
63
+ # puts
64
+ # exit 0
65
65
  #end if on_jruby?
66
- #
67
- # useless
66
+ #
67
+ # useless
68
68
 
@@ -7,6 +7,8 @@
7
7
  # Mon Oct 9 22:19:44 JST 2006
8
8
  #
9
9
 
10
+ require 'rubygems'
11
+
10
12
  require 'test/unit'
11
13
  require 'openwfe/def'
12
14
  require 'openwfe/expool/parser'
@@ -14,399 +16,392 @@ require 'openwfe/expool/parser'
14
16
 
15
17
  class RawProgTest < Test::Unit::TestCase
16
18
 
17
- #def setup
18
- #end
19
-
20
- #def teardown
21
- #end
22
-
23
- XML_DEF =
24
- "<process-definition name='test0' revision='0'>"+
25
- "<sequence>"+
26
- "<participant ref='a'/>"+
27
- "<participant ref='b'/>"+
28
- "</sequence>"+
29
- "</process-definition>"
30
-
31
- #
32
- # TEST 0
33
- #
34
-
35
- class TestDefinition < OpenWFE::ProcessDefinition
36
- def make
37
- process_definition :name => "test0", :revision => "0" do
38
- sequence do
39
- participant :ref => "a"
40
- participant :ref => "b"
41
- end
42
- end
19
+ #def setup
20
+ #end
21
+
22
+ #def teardown
23
+ #end
24
+
25
+ XML_DEF =
26
+ "<process-definition name='test0' revision='0'>"+
27
+ "<sequence>"+
28
+ "<participant ref='a'/>"+
29
+ "<participant ref='b'/>"+
30
+ "</sequence>"+
31
+ "</process-definition>"
32
+
33
+ #
34
+ # TEST 0
35
+ #
36
+
37
+ class TestDefinition < OpenWFE::ProcessDefinition
38
+ def make
39
+ process_definition :name => "test0", :revision => "0" do
40
+ sequence do
41
+ participant :ref => "a"
42
+ participant :ref => "b"
43
43
  end
44
+ end
44
45
  end
46
+ end
45
47
 
46
- def test_prog_0
48
+ def test_prog_0
47
49
 
48
- s = OpenWFE::ExpressionTree.to_s(TestDefinition.new.make)
50
+ s = OpenWFE::ExpressionTree.to_s(TestDefinition.new.make)
49
51
 
50
- assert_equal XML_DEF, s
51
- end
52
+ assert_equal XML_DEF, s
53
+ end
52
54
 
53
- def test_prog_0b
55
+ def test_prog_0b
54
56
 
55
- #s = TestDefinition.do_make.to_s
56
- s = OpenWFE::ExpressionTree.to_s(TestDefinition.do_make)
57
+ #s = TestDefinition.do_make.to_s
58
+ s = OpenWFE::ExpressionTree.to_s(TestDefinition.do_make)
57
59
 
58
- assert_equal XML_DEF, s
59
- end
60
+ assert_equal XML_DEF, s
61
+ end
60
62
 
61
63
 
62
- #
63
- # TEST 1
64
- #
64
+ #
65
+ # TEST 1
66
+ #
65
67
 
66
- def test_prog_1
68
+ def test_prog_1
67
69
 
68
- pg = OpenWFE::ProcessDefinition.new
70
+ pg = OpenWFE::ProcessDefinition.new
69
71
 
70
- class << pg
71
- def my_proc
72
- process_definition :name => "test0", :revision => "0" do
73
- sequence do
74
- participant :ref => "a"
75
- participant :ref => "b"
76
- end
77
- end
78
- end
72
+ class << pg
73
+ def my_proc
74
+ process_definition :name => "test0", :revision => "0" do
75
+ sequence do
76
+ participant :ref => "a"
77
+ participant :ref => "b"
78
+ end
79
79
  end
80
- pdef = pg.my_proc
81
- s = pdef.to_s
82
-
83
- assert XML_DEF, s
80
+ end
84
81
  end
82
+ pdef = pg.my_proc
83
+ s = pdef.to_s
85
84
 
85
+ assert XML_DEF, s
86
+ end
86
87
 
87
- #
88
- # TEST 2
89
- #
90
88
 
91
- class TestDefinition2 < OpenWFE::ProcessDefinition
92
- def make
93
- process_definition :name => "test2", :revision => "0" do
94
- sequence do
95
- set :field => "toto" do
96
- "nada"
97
- end
98
- participant :ref => "b"
99
- end
100
- end
89
+ #
90
+ # TEST 2
91
+ #
92
+
93
+ class TestDefinition2 < OpenWFE::ProcessDefinition
94
+ def make
95
+ process_definition :name => "test2", :revision => "0" do
96
+ sequence do
97
+ set :field => "toto" do
98
+ "nada"
99
+ end
100
+ participant :ref => "b"
101
101
  end
102
+ end
102
103
  end
104
+ end
103
105
 
104
- XML_DEF2 =
105
- "<process-definition name='test2' revision='0'>"+
106
- "<sequence>"+
107
- "<set field='toto'>"+
108
- "nada"+
109
- "</set>"+
110
- "<participant ref='b'/>"+
111
- "</sequence>"+
112
- "</process-definition>"
106
+ XML_DEF2 =
107
+ "<process-definition name='test2' revision='0'>"+
108
+ "<sequence>"+
109
+ "<set field='toto'>"+
110
+ "nada"+
111
+ "</set>"+
112
+ "<participant ref='b'/>"+
113
+ "</sequence>"+
114
+ "</process-definition>"
113
115
 
114
- def test_prog_2
116
+ def test_prog_2
115
117
 
116
- s = OpenWFE::ExpressionTree.to_s(TestDefinition2.do_make)
118
+ s = OpenWFE::ExpressionTree.to_s(TestDefinition2.do_make)
117
119
 
118
- assert_equal XML_DEF2, s
120
+ assert_equal XML_DEF2, s
119
121
 
120
- #puts
121
- #puts TestDefinition2.do_make.to_code_s
122
- end
122
+ #puts
123
+ #puts TestDefinition2.do_make.to_code_s
124
+ end
123
125
 
124
126
 
125
- #
126
- # TEST 3
127
- #
127
+ #
128
+ # TEST 3
129
+ #
128
130
 
129
- class TestDefinition3 < OpenWFE::ProcessDefinition
130
- def make
131
- process_definition :name => "test3", :revision => "0" do
132
- _if do
133
- equals :field_value => "nada", :other_value => "surf"
134
- participant :ref => "b"
135
- end
136
- end
131
+ class TestDefinition3 < OpenWFE::ProcessDefinition
132
+ def make
133
+ process_definition :name => "test3", :revision => "0" do
134
+ _if do
135
+ equals :field_value => "nada", :other_value => "surf"
136
+ participant :ref => "b"
137
137
  end
138
+ end
138
139
  end
139
-
140
- XML_DEF3 =
141
- "<process-definition name='test3' revision='0'>"+
142
- "<if>"+
143
- "<equals field-value='nada' other-value='surf'/>"+
144
- "<participant ref='b'/>"+
145
- "</if>"+
146
- "</process-definition>"
147
-
148
- CODE_DEF3 = """
149
- process_definition :name => 'test3', :revision => '0' do
150
- _if do
151
- equals :field_value => 'nada', :other_value => 'surf'
152
- participant :ref => 'b'
153
- end
140
+ end
141
+
142
+ XML_DEF3 =
143
+ "<process-definition name='test3' revision='0'>"+
144
+ "<if>"+
145
+ "<equals field-value='nada' other-value='surf'/>"+
146
+ "<participant ref='b'/>"+
147
+ "</if>"+
148
+ "</process-definition>"
149
+
150
+ CODE_DEF3 = """
151
+ process_definition :name => \"test3\", :revision => \"0\" do
152
+ _if do
153
+ equals :field_value => \"nada\", :other_value => \"surf\"
154
+ participant :ref => \"b\"
155
+ end
154
156
  end""".strip
155
157
 
156
- def test_prog_3
158
+ def test_prog_3
157
159
 
158
- s = OpenWFE::ExpressionTree.to_s(TestDefinition3.do_make)
160
+ s = OpenWFE::ExpressionTree.to_s(TestDefinition3.do_make)
159
161
 
160
- assert_equal XML_DEF3, s
162
+ assert_equal XML_DEF3, s
161
163
 
162
- assert_equal(
163
- CODE_DEF3,
164
- OpenWFE::ExpressionTree.to_code_s(TestDefinition3.do_make))
164
+ assert_equal(
165
+ CODE_DEF3,
166
+ OpenWFE::ExpressionTree.to_code_s(TestDefinition3.do_make))
165
167
 
166
- #r = OpenWFE::SimpleExpRepresentation.from_xml(s)
167
- r = OpenWFE::DefParser.parse_xml s
168
+ r = OpenWFE::DefParser.parse s
168
169
 
169
- assert_equal CODE_DEF3, OpenWFE::ExpressionTree.to_code_s(r)
170
- end
170
+ assert_equal CODE_DEF3, OpenWFE::ExpressionTree.to_code_s(r)
171
+ end
171
172
 
172
173
 
173
- #
174
- # TEST 4
175
- #
174
+ #
175
+ # TEST 4
176
+ #
176
177
 
177
- class TestDefinition4 < OpenWFE::ProcessDefinition
178
- def make
179
- process_definition :name => "test4", :revision => "0" do
180
- sequence do
181
- 3.times { participant :ref => "b" }
182
- end
183
- end
178
+ class TestDefinition4 < OpenWFE::ProcessDefinition
179
+ def make
180
+ process_definition :name => "test4", :revision => "0" do
181
+ sequence do
182
+ 3.times { participant :ref => "b" }
184
183
  end
184
+ end
185
185
  end
186
-
187
- CODE_DEF4 = """
188
- process_definition :name => 'test4', :revision => '0' do
189
- sequence do
190
- participant :ref => 'b'
191
- participant :ref => 'b'
192
- participant :ref => 'b'
193
- end
194
- end""".strip
195
-
196
- def test_prog_4
197
-
198
- #puts
199
- #puts TestDefinition4.do_make.to_s
200
- #puts
201
- #puts TestDefinition4.do_make.to_code_s
202
-
203
- assert_equal(
204
- CODE_DEF4,
205
- OpenWFE::ExpressionTree.to_code_s(TestDefinition4.do_make))
206
- end
207
-
208
-
209
- #
210
- # TEST 4b
211
- #
212
-
213
- class TestDefinition4b < OpenWFE::ProcessDefinition
214
- def make
215
- sequence do
216
- [ :b, :b, :b ].each do |p|
217
- participant p
218
- end
219
- end
186
+ end
187
+
188
+ CODE_DEF4 = %{
189
+ process_definition :name => "test4", :revision => "0" do
190
+ sequence do
191
+ participant :ref => "b"
192
+ participant :ref => "b"
193
+ participant :ref => "b"
194
+ end
195
+ end}.strip
196
+
197
+ def test_prog_4
198
+
199
+ #puts
200
+ #puts TestDefinition4.do_make.to_s
201
+ #puts
202
+ #puts TestDefinition4.do_make.to_code_s
203
+
204
+ assert_equal(
205
+ CODE_DEF4,
206
+ OpenWFE::ExpressionTree.to_code_s(TestDefinition4.do_make))
207
+ end
208
+
209
+
210
+ #
211
+ # TEST 4b
212
+ #
213
+
214
+ class TestDefinition4b < OpenWFE::ProcessDefinition
215
+ def make
216
+ sequence do
217
+ [ :b, :b, :b ].each do |p|
218
+ participant p
220
219
  end
220
+ end
221
221
  end
222
+ end
222
223
 
223
- CODE_DEF4b = """
224
- process_definition :name => 'Test', :revision => '4b' do
225
- sequence do
226
- participant do
227
- 'b'
228
- end
229
- participant do
230
- 'b'
231
- end
232
- participant do
233
- 'b'
234
- end
235
- end
236
- end""".strip
224
+ CODE_DEF4b = %{
225
+ process_definition :name => "Test", :revision => "4b" do
226
+ sequence do
227
+ participant 'b'
228
+ participant 'b'
229
+ participant 'b'
230
+ end
231
+ end}.strip
237
232
 
238
- def test_prog_4b
233
+ def test_prog_4b
239
234
 
240
- assert_equal(
241
- CODE_DEF4b,
242
- OpenWFE::ExpressionTree.to_code_s(TestDefinition4b.do_make))
243
- end
235
+ assert_equal(
236
+ CODE_DEF4b,
237
+ OpenWFE::ExpressionTree.to_code_s(TestDefinition4b.do_make))
238
+ end
244
239
 
245
240
 
246
- #
247
- # TEST 5
248
- #
249
-
250
- class TestDefinition5 < OpenWFE::ProcessDefinition
251
- def make
252
- sequence do
253
- participant :ref => :toto
254
- sub0
255
- end
256
- process_definition :name => "sub0" do
257
- nada
258
- end
259
- end
260
- end
241
+ #
242
+ # TEST 5
243
+ #
261
244
 
262
- CODE_DEF5 = """
263
- process_definition :name => 'Test', :revision => '5' do
264
- sequence do
265
- participant :ref => 'toto'
245
+ class TestDefinition5 < OpenWFE::ProcessDefinition
246
+ def make
247
+ sequence do
248
+ participant :ref => :toto
266
249
  sub0
250
+ end
251
+ process_definition :name => "sub0" do
252
+ nada
253
+ end
267
254
  end
268
- process_definition :name => 'sub0' do
255
+ end
256
+
257
+ CODE_DEF5 = %{
258
+ process_definition :name => "Test", :revision => "5" do
259
+ sequence do
260
+ participant :ref => :toto
261
+ sub0
262
+ end
263
+ process_definition :name => "sub0" do
264
+ nada
265
+ end
266
+ end}.strip
267
+
268
+ def test_prog_5
269
+
270
+ assert_equal(
271
+ CODE_DEF5,
272
+ OpenWFE::ExpressionTree.to_code_s(TestDefinition5.do_make))
273
+ end
274
+
275
+
276
+ #
277
+ # TEST 6
278
+ #
279
+
280
+ class TestDefinition60 < OpenWFE::ProcessDefinition
281
+ def make
282
+ sequence do
283
+ participant :ref => :toto
269
284
  nada
285
+ end
270
286
  end
271
- end""".strip
287
+ end
272
288
 
273
- def test_prog_5
289
+ CODE_DEF6 = %{
290
+ process_definition :name => "Test", :revision => "60" do
291
+ sequence do
292
+ participant :ref => :toto
293
+ nada
294
+ end
295
+ end}.strip
274
296
 
275
- assert_equal(
276
- CODE_DEF5,
277
- OpenWFE::ExpressionTree.to_code_s(TestDefinition5.do_make))
278
- end
297
+ def test_prog_6
279
298
 
299
+ assert_equal(
300
+ CODE_DEF6,
301
+ OpenWFE::ExpressionTree.to_code_s(TestDefinition60.do_make))
302
+ end
280
303
 
281
- #
282
- # TEST 6
283
- #
284
304
 
285
- class TestDefinition60 < OpenWFE::ProcessDefinition
286
- def make
287
- sequence do
288
- participant :ref => :toto
289
- nada
290
- end
291
- end
292
- end
305
+ #
306
+ # TEST 7
307
+ #
293
308
 
294
- CODE_DEF6 = """
295
- process_definition :name => 'Test', :revision => '60' do
296
- sequence do
297
- participant :ref => 'toto'
298
- nada
309
+ class TestDefinitionSeven < OpenWFE::ProcessDefinition
310
+ def make
311
+ participant :ref => :toto
299
312
  end
300
- end""".strip
313
+ end
301
314
 
302
- def test_prog_6
315
+ CODE_DEF7 = %{
316
+ process_definition :name => "TestDefinitionSeven", :revision => "0" do
317
+ participant :ref => :toto
318
+ end}.strip
303
319
 
304
- assert_equal(
305
- CODE_DEF6,
306
- OpenWFE::ExpressionTree.to_code_s(TestDefinition60.do_make))
307
- end
320
+ A_DEF7 = [
321
+ "process-definition",
322
+ { "name"=>"TestDefinitionSeven", "revision"=>"0" },
323
+ [ [ "participant", { "ref" => :toto }, [] ] ]
324
+ ]
308
325
 
326
+ def test_prog_7
309
327
 
310
- #
311
- # TEST 7
312
- #
328
+ assert_equal(
329
+ CODE_DEF7,
330
+ OpenWFE::ExpressionTree.to_code_s(TestDefinitionSeven.do_make))
313
331
 
314
- class TestDefinitionSeven < OpenWFE::ProcessDefinition
315
- def make
316
- participant :ref => :toto
317
- end
318
- end
332
+ assert_equal(
333
+ A_DEF7,
334
+ TestDefinitionSeven.do_make)
335
+ end
319
336
 
320
- CODE_DEF7 = """
321
- process_definition :name => 'TestDefinitionSeven', :revision => '0' do
322
- participant :ref => 'toto'
323
- end""".strip
324
-
325
- A_DEF7 = [
326
- "process-definition",
327
- { "name"=>"TestDefinitionSeven", "revision"=>"0" },
328
- [ [ "participant", { "ref" => :toto }, [] ] ]
329
- ]
330
-
331
- def test_prog_7
332
-
333
- assert_equal(
334
- CODE_DEF7,
335
- OpenWFE::ExpressionTree.to_code_s(TestDefinitionSeven.do_make))
336
-
337
- assert_equal(
338
- A_DEF7,
339
- TestDefinitionSeven.do_make)
340
- end
337
+ #
338
+ # TEST 8
339
+ #
341
340
 
341
+ def do_test (class_name, pdef)
342
342
  #
343
- # TEST 8
343
+ # losing my time with an eval
344
344
  #
345
+ result = eval """
346
+ class #{class_name} < OpenWFE::ProcessDefinition
347
+ def make
348
+ participant 'nada'
349
+ end
350
+ end
351
+ #{class_name}.do_make
352
+ """
353
+ assert_equal result[1]['name'], pdef[0]
354
+ assert_equal result[1]['revision'], pdef[1]
355
+ end
345
356
 
346
- def do_test (class_name, pdef)
347
- #
348
- # losing my time with an eval
349
- #
350
- result = eval """
351
- class #{class_name} < OpenWFE::ProcessDefinition
352
- def make
353
- participant 'nada'
354
- end
355
- end
356
- #{class_name}.do_make
357
- """
358
- assert_equal result[1]['name'], pdef[0]
359
- assert_equal result[1]['revision'], pdef[1]
360
- end
361
-
362
- def test_process_names
357
+ def test_process_names
363
358
 
364
- do_test "MyProcessDefinition_10", ["MyProcess", "10"]
365
- do_test "MyProcessDefinition10", ["MyProcess", "10"]
366
- do_test "MyProcessDefinition1_0", ["MyProcess", "1.0"]
367
- do_test "MyProcessThing_1_0", ["MyProcessThing", "1.0"]
368
- end
359
+ do_test "MyProcessDefinition_10", ["MyProcess", "10"]
360
+ do_test "MyProcessDefinition10", ["MyProcess", "10"]
361
+ do_test "MyProcessDefinition1_0", ["MyProcess", "1.0"]
362
+ do_test "MyProcessThing_1_0", ["MyProcessThing", "1.0"]
363
+ end
369
364
 
370
- def do_test_2 (raw_name, expected)
365
+ def do_test_2 (raw_name, expected)
371
366
 
372
- assert_equal(
373
- expected,
374
- OpenWFE::ProcessDefinition.extract_name_and_revision(raw_name))
375
- end
367
+ assert_equal(
368
+ expected,
369
+ OpenWFE::ProcessDefinition.extract_name_and_revision(raw_name))
370
+ end
376
371
 
377
- def test_process_names_2
372
+ def test_process_names_2
378
373
 
379
- do_test_2 "MyProcessDefinition_10", ["MyProcess", "10"]
380
- do_test_2 "MyProcessDefinition5b", ["MyProcess", "5b"]
381
- end
374
+ do_test_2 "MyProcessDefinition_10", ["MyProcess", "10"]
375
+ do_test_2 "MyProcessDefinition5b", ["MyProcess", "5b"]
376
+ end
382
377
 
383
378
 
384
- #
385
- # TEST 9
386
- #
379
+ #
380
+ # TEST 9
381
+ #
387
382
 
388
- class TestDefinition9 < OpenWFE::ProcessDefinition
389
- def make
390
- description "this is my process"
391
- sequence do
392
- participant :ref => :toto
393
- end
394
- end
383
+ class TestDefinition9 < OpenWFE::ProcessDefinition
384
+ def make
385
+ description "this is my process"
386
+ sequence do
387
+ participant :ref => :toto
388
+ end
395
389
  end
390
+ end
396
391
 
397
- CODE_DEF9 = """
392
+ CODE_DEF9 = """
398
393
  process_definition :name => 'Test', :revision => '60' do
399
- description 'this is my process'
400
- sequence do
401
- participant :ref => 'toto'
402
- nada
403
- end
394
+ description 'this is my process'
395
+ sequence do
396
+ participant :ref => 'toto'
397
+ nada
398
+ end
404
399
  end""".strip
405
400
 
406
- def _test_prog_9
401
+ def _test_prog_9
407
402
 
408
- assert CODE_DEF9, TestDefinition9.do_make.to_code_s
409
- end
403
+ assert CODE_DEF9, TestDefinition9.do_make.to_code_s
404
+ end
410
405
 
411
406
  end
412
407