ruote 0.9.18
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +24 -0
- data/bin/validate-workflow.rb +89 -0
- data/examples/about_state.rb +81 -0
- data/examples/bigflow.rb +19 -0
- data/examples/csv_weather.rb +23 -0
- data/examples/engine_template.rb +247 -0
- data/examples/flowtracing.rb +24 -0
- data/examples/homeworkreview.rb +68 -0
- data/examples/kotoba.rb +22 -0
- data/examples/mano_tracker.rb +172 -0
- data/examples/openwferu.rb +58 -0
- data/examples/quotereporter.rb +157 -0
- data/examples/scheduler_cron_usage.rb +48 -0
- data/examples/scheduler_usage.rb +56 -0
- data/lib/openwfe.rb +41 -0
- data/lib/openwfe/contextual.rb +111 -0
- data/lib/openwfe/def.rb +46 -0
- data/lib/openwfe/engine.rb +37 -0
- data/lib/openwfe/engine/engine.rb +756 -0
- data/lib/openwfe/engine/expool_methods.rb +172 -0
- data/lib/openwfe/engine/file_persisted_engine.rb +105 -0
- data/lib/openwfe/engine/participant_methods.rb +133 -0
- data/lib/openwfe/engine/status_methods.rb +353 -0
- data/lib/openwfe/engine/update_exp_methods.rb +112 -0
- data/lib/openwfe/exceptions.rb +51 -0
- data/lib/openwfe/expool/errorjournal.rb +476 -0
- data/lib/openwfe/expool/expressionpool.rb +1144 -0
- data/lib/openwfe/expool/expstorage.rb +403 -0
- data/lib/openwfe/expool/history.rb +174 -0
- data/lib/openwfe/expool/journal.rb +224 -0
- data/lib/openwfe/expool/journal_replay.rb +321 -0
- data/lib/openwfe/expool/parser.rb +242 -0
- data/lib/openwfe/expool/representation.rb +121 -0
- data/lib/openwfe/expool/threadedexpstorage.rb +188 -0
- data/lib/openwfe/expool/wfidgen.rb +388 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +224 -0
- data/lib/openwfe/expressions/condition.rb +244 -0
- data/lib/openwfe/expressions/environment.rb +246 -0
- data/lib/openwfe/expressions/expressionmap.rb +258 -0
- data/lib/openwfe/expressions/fe_cancel.rb +109 -0
- data/lib/openwfe/expressions/fe_command.rb +241 -0
- data/lib/openwfe/expressions/fe_concurrence.rb +662 -0
- data/lib/openwfe/expressions/fe_cron.rb +259 -0
- data/lib/openwfe/expressions/fe_cursor.rb +259 -0
- data/lib/openwfe/expressions/fe_define.rb +192 -0
- data/lib/openwfe/expressions/fe_do.rb +168 -0
- data/lib/openwfe/expressions/fe_equals.rb +291 -0
- data/lib/openwfe/expressions/fe_filter.rb +129 -0
- data/lib/openwfe/expressions/fe_filter_definition.rb +168 -0
- data/lib/openwfe/expressions/fe_fqv.rb +250 -0
- data/lib/openwfe/expressions/fe_if.rb +303 -0
- data/lib/openwfe/expressions/fe_iterator.rb +145 -0
- data/lib/openwfe/expressions/fe_listen.rb +371 -0
- data/lib/openwfe/expressions/fe_losfor.rb +111 -0
- data/lib/openwfe/expressions/fe_misc.rb +421 -0
- data/lib/openwfe/expressions/fe_participant.rb +269 -0
- data/lib/openwfe/expressions/fe_reserve.rb +212 -0
- data/lib/openwfe/expressions/fe_save.rb +274 -0
- data/lib/openwfe/expressions/fe_sequence.rb +117 -0
- data/lib/openwfe/expressions/fe_set.rb +139 -0
- data/lib/openwfe/expressions/fe_sleep.rb +166 -0
- data/lib/openwfe/expressions/fe_step.rb +159 -0
- data/lib/openwfe/expressions/fe_subprocess.rb +168 -0
- data/lib/openwfe/expressions/fe_timeout.rb +127 -0
- data/lib/openwfe/expressions/fe_wait.rb +78 -0
- data/lib/openwfe/expressions/fe_when.rb +142 -0
- data/lib/openwfe/expressions/filter.rb +104 -0
- data/lib/openwfe/expressions/flowexpression.rb +847 -0
- data/lib/openwfe/expressions/iterator.rb +221 -0
- data/lib/openwfe/expressions/merge.rb +84 -0
- data/lib/openwfe/expressions/raw.rb +547 -0
- data/lib/openwfe/expressions/rprocdef.rb +375 -0
- data/lib/openwfe/expressions/time.rb +333 -0
- data/lib/openwfe/expressions/timeout.rb +178 -0
- data/lib/openwfe/expressions/value.rb +126 -0
- data/lib/openwfe/filterdef.rb +259 -0
- data/lib/openwfe/flowexpressionid.rb +357 -0
- data/lib/openwfe/listeners/listener.rb +97 -0
- data/lib/openwfe/listeners/listeners.rb +139 -0
- data/lib/openwfe/listeners/socketlisteners.rb +272 -0
- data/lib/openwfe/logging.rb +122 -0
- data/lib/openwfe/omixins.rb +95 -0
- data/lib/openwfe/orest/controlclient.rb +119 -0
- data/lib/openwfe/orest/definitions.rb +113 -0
- data/lib/openwfe/orest/exception.rb +60 -0
- data/lib/openwfe/orest/oldrestservlet.rb +279 -0
- data/lib/openwfe/orest/osocket.rb +148 -0
- data/lib/openwfe/orest/restclient.rb +176 -0
- data/lib/openwfe/orest/workitem.rb +206 -0
- data/lib/openwfe/orest/worklistclient.rb +272 -0
- data/lib/openwfe/orest/xmlcodec.rb +670 -0
- data/lib/openwfe/participants.rb +38 -0
- data/lib/openwfe/participants/enoparticipants.rb +230 -0
- data/lib/openwfe/participants/participant.rb +141 -0
- data/lib/openwfe/participants/participantmap.rb +249 -0
- data/lib/openwfe/participants/participants.rb +407 -0
- data/lib/openwfe/participants/soapparticipants.rb +135 -0
- data/lib/openwfe/participants/socketparticipants.rb +202 -0
- data/lib/openwfe/participants/storeparticipants.rb +254 -0
- data/lib/openwfe/rudefinitions.rb +130 -0
- data/lib/openwfe/service.rb +103 -0
- data/lib/openwfe/storage/yamlcustom.rb +106 -0
- data/lib/openwfe/storage/yamlfilestorage.rb +245 -0
- data/lib/openwfe/tools/flowtracer.rb +81 -0
- data/lib/openwfe/util/dollar.rb +217 -0
- data/lib/openwfe/util/irb.rb +86 -0
- data/lib/openwfe/util/observable.rb +144 -0
- data/lib/openwfe/util/ometa.rb +62 -0
- data/lib/openwfe/util/workqueue.rb +124 -0
- data/lib/openwfe/util/xml.rb +418 -0
- data/lib/openwfe/utils.rb +554 -0
- data/lib/openwfe/version.rb +37 -0
- data/lib/openwfe/workitem.rb +499 -0
- data/lib/openwfe/worklist/oldrest.rb +244 -0
- data/lib/openwfe/worklist/storelocks.rb +293 -0
- data/lib/openwfe/worklist/storeparticipant.rb +44 -0
- data/lib/openwfe/worklist/worklist.rb +297 -0
- data/test/README.txt +27 -0
- data/test/back_0916_test.rb +111 -0
- data/test/bm/bm_1_xml_vs_prog.rb +56 -0
- data/test/bm/bm_2_step.rb +109 -0
- data/test/bm/ft_0f_5ms.rb +35 -0
- data/test/bm/ft_26_load.rb +210 -0
- data/test/bm/ft_26b_load.rb +86 -0
- data/test/bm/ft_26c_load.rb +97 -0
- data/test/bm/ft_26d_load.rb +97 -0
- data/test/bm/ft_recu.rb +71 -0
- data/test/clone_test.rb +122 -0
- data/test/concurrence_test.rb +77 -0
- data/test/condition_test.rb +155 -0
- data/test/console_test.rb +12 -0
- data/test/cron_ltest.rb +15 -0
- data/test/description_test.rb +87 -0
- data/test/eno_test.rb +76 -0
- data/test/expmap_test.rb +54 -0
- data/test/expool_20031219_0916.tgz +0 -0
- data/test/fe_lookup_att_test.rb +62 -0
- data/test/fei_test.rb +181 -0
- data/test/file_persisted_engine_test.rb +64 -0
- data/test/file_persistence_test.rb +134 -0
- data/test/filep_cancel_test.rb +123 -0
- data/test/filter_test.rb +109 -0
- data/test/flowtestbase.rb +351 -0
- data/test/ft_0.rb +68 -0
- data/test/ft_0b_sequence.rb +36 -0
- data/test/ft_0c_testname.rb +33 -0
- data/test/ft_0d_participant.rb +30 -0
- data/test/ft_0e_multibody.rb +34 -0
- data/test/ft_10_loop.rb +134 -0
- data/test/ft_11_ppd.rb +415 -0
- data/test/ft_11b_ppd.rb +54 -0
- data/test/ft_12_blockparticipant.rb +97 -0
- data/test/ft_13_eno.rb +52 -0
- data/test/ft_14_subprocess.rb +88 -0
- data/test/ft_14b_subprocess.rb +192 -0
- data/test/ft_14c_subprocess.rb +68 -0
- data/test/ft_15_iterator.rb +216 -0
- data/test/ft_15b_iterator.rb +74 -0
- data/test/ft_16_fqv.rb +73 -0
- data/test/ft_17_condition.rb +84 -0
- data/test/ft_18_pname.rb +56 -0
- data/test/ft_1_unset.rb +175 -0
- data/test/ft_1b_unset.rb +39 -0
- data/test/ft_20_cron.rb +53 -0
- data/test/ft_21_cron.rb +87 -0
- data/test/ft_21b_cron_pause.rb +82 -0
- data/test/ft_22_history.rb +74 -0
- data/test/ft_23_when.rb +77 -0
- data/test/ft_23b_when.rb +70 -0
- data/test/ft_23c_wait.rb +80 -0
- data/test/ft_23d_cww.rb +58 -0
- data/test/ft_24_def.rb +44 -0
- data/test/ft_25_cancel.rb +89 -0
- data/test/ft_27_getflowpos.rb +147 -0
- data/test/ft_28_fileparticipant.rb +63 -0
- data/test/ft_29_httprb.rb +106 -0
- data/test/ft_2_concurrence.rb +135 -0
- data/test/ft_2b_concurrence.rb +188 -0
- data/test/ft_2c_concurrence.rb +64 -0
- data/test/ft_30_socketlistener.rb +203 -0
- data/test/ft_31_flowname.rb +40 -0
- data/test/ft_32_journal.rb +91 -0
- data/test/ft_32c_journal.rb +102 -0
- data/test/ft_32d_journal.rb +84 -0
- data/test/ft_33_description.rb +107 -0
- data/test/ft_34_cancelwfid.rb +80 -0
- data/test/ft_35_localdefs.rb +75 -0
- data/test/ft_36_subprocids.rb +97 -0
- data/test/ft_37_pnames.rb +70 -0
- data/test/ft_38_tag.rb +127 -0
- data/test/ft_38b_tag.rb +161 -0
- data/test/ft_38c_tag.rb +100 -0
- data/test/ft_39_reserve.rb +63 -0
- data/test/ft_39b_reserve.rb +84 -0
- data/test/ft_3_equals.rb +170 -0
- data/test/ft_3b_lookup_vf.rb +83 -0
- data/test/ft_40_defined.rb +61 -0
- data/test/ft_41_case.rb +110 -0
- data/test/ft_42_environments.rb +75 -0
- data/test/ft_43_pat10.rb +85 -0
- data/test/ft_44_save.rb +70 -0
- data/test/ft_44b_restore.rb +212 -0
- data/test/ft_45_citerator.rb +214 -0
- data/test/ft_46_pparams.rb +62 -0
- data/test/ft_47_filter.rb +160 -0
- data/test/ft_48_fe_filter.rb +88 -0
- data/test/ft_49_condition.rb +126 -0
- data/test/ft_4_misc.rb +237 -0
- data/test/ft_50_xml_attribute.rb +155 -0
- data/test/ft_51_stack.rb +55 -0
- data/test/ft_52_obs_participant.rb +123 -0
- data/test/ft_53_null_noop_participant.rb +62 -0
- data/test/ft_54_listen.rb +288 -0
- data/test/ft_54b_listen.rb +66 -0
- data/test/ft_54c_listen.rb +99 -0
- data/test/ft_55_ptimeout.rb +59 -0
- data/test/ft_56_timeout.rb +59 -0
- data/test/ft_57_a.rb +145 -0
- data/test/ft_58_ejournal.rb +151 -0
- data/test/ft_59_ps.rb +150 -0
- data/test/ft_59b_ps_for_pat.rb +58 -0
- data/test/ft_5_time.rb +118 -0
- data/test/ft_60_ecancel.rb +161 -0
- data/test/ft_61_elsub.rb +51 -0
- data/test/ft_62_procparticipant.rb +71 -0
- data/test/ft_63_pause.rb +124 -0
- data/test/ft_64_alias.rb +102 -0
- data/test/ft_64_clone.rb +69 -0
- data/test/ft_65_stringlaunch.rb +59 -0
- data/test/ft_66_subforget.rb +70 -0
- data/test/ft_67_schedlaunch.rb +116 -0
- data/test/ft_68_ifparticipant.rb +70 -0
- data/test/ft_69_cancelmissing.rb +51 -0
- data/test/ft_6_lambda.rb +64 -0
- data/test/ft_70_lookupvar.rb +55 -0
- data/test/ft_71_log.rb +60 -0
- data/test/ft_72_lookup_processes.rb +76 -0
- data/test/ft_73_cancel_sub.rb +139 -0
- data/test/ft_74_block_and_workitem_dup.rb +63 -0
- data/test/ft_75_ruby_attributes.rb +87 -0
- data/test/ft_76_merge_isolate.rb +88 -0
- data/test/ft_77_segments.rb +35 -0
- data/test/ft_78_eval.rb +150 -0
- data/test/ft_79_tticket.rb +187 -0
- data/test/ft_79b_tticket.rb +172 -0
- data/test/ft_79c_outcome.rb +56 -0
- data/test/ft_7_lose.rb +104 -0
- data/test/ft_7b_lose.rb +78 -0
- data/test/ft_80_spname.rb +91 -0
- data/test/ft_81_exp.rb +60 -0
- data/test/ft_82_trecu.rb +46 -0
- data/test/ft_83_badpause.rb +58 -0
- data/test/ft_84_updateexp.rb +198 -0
- data/test/ft_85_dolhash.rb +43 -0
- data/test/ft_86_dollar_fv.rb +68 -0
- data/test/ft_87_define.rb +74 -0
- data/test/ft_8_forget.rb +44 -0
- data/test/ft_9_cursor.rb +145 -0
- data/test/ft_9b_cursor.rb +105 -0
- data/test/ft_tests.rb +124 -0
- data/test/hash_test.rb +75 -0
- data/test/hparticipant_test.rb +164 -0
- data/test/lookup_att_test.rb +90 -0
- data/test/lookup_vf_test.rb +94 -0
- data/test/misc_test.rb +90 -0
- data/test/nut_0_irb.rb +20 -0
- data/test/obs_test.rb +142 -0
- data/test/orest_test.rb +251 -0
- data/test/param_test.rb +290 -0
- data/test/participant_test.rb +101 -0
- data/test/pending.rb +23 -0
- data/test/ps_representation.rb +133 -0
- data/test/rake_ltest.rb +38 -0
- data/test/rake_qtest.rb +68 -0
- data/test/raw_prog_test.rb +412 -0
- data/test/restart_cron_test.rb +136 -0
- data/test/restart_paused_test.rb +98 -0
- data/test/restart_sleep_test.rb +140 -0
- data/test/restart_tests.rb +18 -0
- data/test/restart_when_test.rb +112 -0
- data/test/ruby_procdef_test.rb +132 -0
- data/test/rutest_utils.rb +63 -0
- data/test/sec_test.rb +205 -0
- data/test/slock_test.rb +80 -0
- data/test/storage_test.rb +44 -0
- data/test/test.rb +3 -0
- data/test/timeout_test.rb +105 -0
- data/test/util_xml_test.rb +112 -0
- data/test/wfid_test.rb +175 -0
- data/test/wi_test.rb +75 -0
- 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
|
+
|
data/test/ft_8_forget.rb
ADDED
@@ -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
|
+
|
data/test/ft_9_cursor.rb
ADDED
@@ -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
|
+
|