openwferu 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/about_state.rb +81 -0
- data/examples/engine_template.rb +7 -0
- data/lib/openwfe/contextual.rb +2 -2
- data/lib/openwfe/def.rb +2 -3
- data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
- data/lib/openwfe/engine/engine.rb +202 -251
- data/lib/openwfe/engine/process_status.rb +359 -0
- data/lib/openwfe/expool/errorjournal.rb +6 -6
- data/lib/openwfe/expool/expressionpool.rb +161 -239
- data/lib/openwfe/expool/expstorage.rb +185 -55
- data/lib/openwfe/expool/journal.rb +1 -2
- data/lib/openwfe/expool/parser.rb +233 -0
- data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
- data/lib/openwfe/expool/wfidgen.rb +25 -7
- data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
- data/lib/openwfe/expressions/condition.rb +49 -12
- data/lib/openwfe/expressions/environment.rb +45 -15
- data/lib/openwfe/expressions/expressionmap.rb +39 -19
- data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
- data/lib/openwfe/expressions/fe_cron.rb +19 -18
- data/lib/openwfe/expressions/fe_cursor.rb +69 -28
- data/lib/openwfe/expressions/fe_define.rb +4 -1
- data/lib/openwfe/expressions/fe_do.rb +1 -3
- data/lib/openwfe/expressions/fe_equals.rb +131 -20
- data/lib/openwfe/expressions/fe_fqv.rb +27 -3
- data/lib/openwfe/expressions/fe_iterator.rb +14 -7
- data/lib/openwfe/expressions/fe_listen.rb +7 -2
- data/lib/openwfe/expressions/fe_misc.rb +187 -20
- data/lib/openwfe/expressions/fe_participant.rb +8 -7
- data/lib/openwfe/expressions/fe_reserve.rb +105 -33
- data/lib/openwfe/expressions/fe_save.rb +55 -5
- data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
- data/lib/openwfe/expressions/fe_sleep.rb +25 -15
- data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
- data/lib/openwfe/expressions/fe_wait.rb +3 -2
- data/lib/openwfe/expressions/fe_when.rb +7 -15
- data/lib/openwfe/expressions/flowexpression.rb +90 -49
- data/lib/openwfe/expressions/merge.rb +7 -1
- data/lib/openwfe/expressions/raw.rb +261 -63
- data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
- data/lib/openwfe/expressions/time.rb +36 -12
- data/lib/openwfe/expressions/timeout.rb +9 -7
- data/lib/openwfe/expressions/value.rb +126 -0
- data/lib/openwfe/flowexpressionid.rb +52 -22
- data/lib/openwfe/listeners/listeners.rb +3 -3
- data/lib/openwfe/listeners/socketlisteners.rb +8 -5
- data/lib/openwfe/logging.rb +6 -3
- data/lib/openwfe/omixins.rb +8 -6
- data/lib/openwfe/orest/xmlcodec.rb +16 -12
- data/lib/openwfe/participants.rb +38 -0
- data/lib/openwfe/participants/participant.rb +1 -1
- data/lib/openwfe/participants/participantmap.rb +24 -10
- data/lib/openwfe/participants/participants.rb +4 -3
- data/lib/openwfe/participants/soapparticipants.rb +1 -1
- data/lib/openwfe/participants/socketparticipants.rb +1 -1
- data/lib/openwfe/rudefinitions.rb +7 -5
- data/lib/openwfe/storage/yamlcustom.rb +10 -10
- data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
- data/lib/openwfe/tools/flowtracer.rb +6 -5
- data/lib/openwfe/util/dollar.rb +42 -85
- data/lib/openwfe/util/ometa.rb +1 -3
- data/lib/openwfe/util/workqueue.rb +1 -1
- data/lib/openwfe/utils.rb +33 -11
- data/lib/openwfe/version.rb +2 -2
- data/lib/openwfe/workitem.rb +76 -14
- data/lib/openwfe/worklist/storelocks.rb +9 -4
- data/lib/openwfe/worklist/storeparticipant.rb +1 -1
- data/test/back_0916_test.rb +101 -0
- data/test/bm/ft_26_load.rb +1 -1
- data/test/bm/ft_26b_load.rb +1 -1
- data/test/bm/ft_26c_load.rb +3 -2
- data/test/bm/ft_26d_load.rb +97 -0
- data/test/bm/ft_recu.rb +71 -0
- data/test/concurrence_test.rb +1 -1
- data/test/condition_test.rb +152 -0
- data/test/description_test.rb +12 -7
- data/test/eno_test.rb +1 -1
- data/test/expool_20031219_0916.tgz +0 -0
- data/test/fe_lookup_att_test.rb +1 -1
- data/test/fei_test.rb +16 -0
- data/test/file_persistence_test.rb +8 -12
- data/test/filep_cancel_test.rb +116 -0
- data/test/flowtestbase.rb +47 -25
- data/test/ft_0.rb +1 -1
- data/test/ft_10_loop.rb +29 -14
- data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
- data/test/ft_11_ppd.rb +6 -17
- data/test/ft_11b_ppd.rb +1 -4
- data/test/ft_12_blockparticipant.rb +1 -1
- data/test/ft_13_eno.rb +1 -1
- data/test/ft_15_iterator.rb +1 -1
- data/test/ft_15b_iterator.rb +1 -1
- data/test/ft_17_condition.rb +6 -6
- data/test/ft_18_pname.rb +1 -1
- data/test/ft_20_cron.rb +1 -1
- data/test/ft_21_cron.rb +6 -4
- data/test/ft_22_history.rb +1 -1
- data/test/ft_23_when.rb +1 -1
- data/test/ft_23b_when.rb +18 -6
- data/test/ft_23c_wait.rb +8 -6
- data/test/ft_25_cancel.rb +7 -5
- data/test/ft_27_getflowpos.rb +22 -17
- data/test/ft_28_fileparticipant.rb +1 -2
- data/test/ft_2_concurrence.rb +1 -1
- data/test/ft_2b_concurrence.rb +25 -20
- data/test/ft_30_socketlistener.rb +0 -3
- data/test/ft_34_cancelwfid.rb +9 -9
- data/test/ft_35_localdefs.rb +0 -1
- data/test/ft_36_subprocids.rb +6 -6
- data/test/ft_38_tag.rb +3 -2
- data/test/ft_38b_tag.rb +229 -0
- data/test/ft_39_reserve.rb +3 -18
- data/test/ft_39b_reserve.rb +34 -5
- data/test/ft_3b_lookup_vf.rb +83 -0
- data/test/ft_40_defined.rb +2 -11
- data/test/ft_42_environments.rb +4 -6
- data/test/ft_44b_restore.rb +88 -22
- data/test/ft_45_citerator.rb +57 -11
- data/test/ft_49_condition.rb +4 -2
- data/test/ft_4_misc.rb +24 -3
- data/test/ft_50_xml_attribute.rb +17 -20
- data/test/ft_54_listen.rb +1 -1
- data/test/ft_54b_listen.rb +2 -2
- data/test/ft_56_timeout.rb +8 -1
- data/test/ft_57_a.rb +10 -10
- data/test/ft_59_ps.rb +49 -16
- data/test/ft_60_ecancel.rb +52 -10
- data/test/ft_63_pause.rb +8 -8
- data/test/ft_65_stringlaunch.rb +4 -6
- data/test/ft_67_schedlaunch.rb +4 -4
- data/test/ft_69_cancelmissing.rb +4 -2
- data/test/ft_70_lookupvar.rb +2 -2
- data/test/ft_72_lookup_processes.rb +2 -2
- data/test/ft_73_cancel_sub.rb +8 -8
- data/test/ft_77_segments.rb +38 -0
- data/test/ft_78_eval.rb +154 -0
- data/test/ft_79_tticket.rb +185 -0
- data/test/ft_80_spname.rb +95 -0
- data/test/ft_81_exp.rb +64 -0
- data/test/ft_82_trecu.rb +48 -0
- data/test/ft_83_badpause.rb +62 -0
- data/test/ft_84_updateexp.rb +125 -0
- data/test/ft_9b_cursor.rb +105 -0
- data/test/ft_tests.rb +14 -1
- data/test/hash_test.rb +7 -7
- data/test/hparticipant_test.rb +4 -4
- data/test/lookup_vf_test.rb +94 -0
- data/test/misc_test.rb +5 -3
- data/test/orest_test.rb +4 -3
- data/test/param_test.rb +12 -16
- data/test/participant_test.rb +36 -0
- data/test/pending.rb +10 -10
- data/test/rake_ltest.rb +1 -10
- data/test/rake_qtest.rb +7 -6
- data/test/raw_prog_test.rb +89 -121
- data/test/restart_cron_test.rb +84 -36
- data/test/restart_paused_test.rb +100 -0
- data/test/restart_sleep_test.rb +1 -1
- data/test/restart_tests.rb +1 -0
- data/test/restart_when_test.rb +33 -22
- data/test/ruby_procdef_test.rb +19 -18
- data/test/sec_test.rb +74 -35
- data/test/storage_test.rb +44 -0
- data/test/test.rb +3 -0
- data/test/timeout_test.rb +7 -18
- data/test/wfid_test.rb +2 -1
- data/test/wi_test.rb +29 -18
- metadata +121 -57
- data/lib/openwfe/expressions/raw_xml.rb +0 -176
- data/lib/openwfe/expressions/simplerep.rb +0 -266
- data/lib/openwfe/util/kotoba.rb +0 -236
- data/lib/openwfe/util/lru.rb +0 -171
- data/lib/openwfe/util/otime.rb +0 -246
- data/lib/openwfe/util/safe.rb +0 -160
- data/lib/openwfe/util/scheduler.rb +0 -1158
- data/test/cron_test.rb +0 -113
- data/test/cronline_test.rb +0 -60
- data/test/dollar_test.rb +0 -90
- data/test/kotoba_test.rb +0 -72
- data/test/lru_test.rb +0 -79
- data/test/safely_test.rb +0 -84
- data/test/scheduler_1_test.rb +0 -88
- data/test/scheduler_test.rb +0 -363
- data/test/time_test.rb +0 -84
@@ -0,0 +1,95 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Fri Jan 4 15:00:26 JST 2008
|
8
|
+
#
|
9
|
+
# Fighting bug #16791
|
10
|
+
# http://rubyforge.org/tracker/index.php?func=detail&aid=16791&group_id=2609&atid=10023
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'flowtestbase'
|
14
|
+
#require 'openwfe/def'
|
15
|
+
#require 'openwfe/worklist/storeparticipant'
|
16
|
+
|
17
|
+
#include OpenWFE
|
18
|
+
|
19
|
+
|
20
|
+
class FlowTest80 < Test::Unit::TestCase
|
21
|
+
include FlowTestBase
|
22
|
+
|
23
|
+
#def setup
|
24
|
+
#end
|
25
|
+
|
26
|
+
#def teardown
|
27
|
+
#end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Test 0
|
31
|
+
#
|
32
|
+
|
33
|
+
class Def0 < OpenWFE::ProcessDefinition
|
34
|
+
sequence do
|
35
|
+
subprocess :ref => "last_step"
|
36
|
+
last_step
|
37
|
+
end
|
38
|
+
process_definition :name => "last_step" do
|
39
|
+
_print "last_step"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_0
|
44
|
+
dotest Def0, ([ "last_step" ] * 2).join("\n")
|
45
|
+
end
|
46
|
+
|
47
|
+
TEST0B = %{
|
48
|
+
<process-definition name="def" revision="0b">
|
49
|
+
<sequence>
|
50
|
+
<subprocess ref="last_step" />
|
51
|
+
<last_step />
|
52
|
+
</sequence>
|
53
|
+
<process-definition name="last_step">
|
54
|
+
<print>last_step</print>
|
55
|
+
</process-definition>
|
56
|
+
</process-definition>
|
57
|
+
}.strip
|
58
|
+
|
59
|
+
def test_0b
|
60
|
+
dotest TEST0B, ([ "last_step" ] * 2).join("\n")
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Test 1
|
65
|
+
#
|
66
|
+
# Checking with participants
|
67
|
+
#
|
68
|
+
|
69
|
+
class Def1 < OpenWFE::ProcessDefinition
|
70
|
+
sequence do
|
71
|
+
mister_alpha
|
72
|
+
participant :ref => :mister_alpha
|
73
|
+
participant :ref => "mister_alpha"
|
74
|
+
#participant :ref => "mister-alpha"
|
75
|
+
mister_bravo
|
76
|
+
#participant :ref => :mister_bravo
|
77
|
+
#participant :ref => "mister_bravo"
|
78
|
+
participant :ref => "mister-bravo"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_1
|
83
|
+
|
84
|
+
@engine.register_participant :mister_alpha do
|
85
|
+
@tracer << "alpha\n"
|
86
|
+
end
|
87
|
+
@engine.register_participant "mister-bravo" do
|
88
|
+
@tracer << "bravo\n"
|
89
|
+
end
|
90
|
+
|
91
|
+
dotest Def1, ([ "alpha" ] * 3 + [ "bravo" ] * 2).join("\n")
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
data/test/ft_81_exp.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Sat Jan 5 22:57:53 JST 2008
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'flowtestbase'
|
11
|
+
#require 'openwfe/def'
|
12
|
+
#require 'openwfe/worklist/storeparticipant'
|
13
|
+
|
14
|
+
#include OpenWFE
|
15
|
+
|
16
|
+
|
17
|
+
class FlowTest81 < Test::Unit::TestCase
|
18
|
+
include FlowTestBase
|
19
|
+
|
20
|
+
#def setup
|
21
|
+
#end
|
22
|
+
|
23
|
+
#def teardown
|
24
|
+
#end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Test 0
|
28
|
+
#
|
29
|
+
|
30
|
+
class Def0 < OpenWFE::ProcessDefinition
|
31
|
+
|
32
|
+
sequence do
|
33
|
+
|
34
|
+
exp :name => "p0"
|
35
|
+
exp :name => "sub0"
|
36
|
+
|
37
|
+
exp :name => "sequence" do
|
38
|
+
p0
|
39
|
+
sub0
|
40
|
+
end
|
41
|
+
|
42
|
+
set :var => "a", :value => { "ref" => "p0" }
|
43
|
+
exp :name => "participant", :variable_attributes => "a"
|
44
|
+
|
45
|
+
exp :default => "p0"
|
46
|
+
exp :name => " ", :default => "p0"
|
47
|
+
end
|
48
|
+
|
49
|
+
process_definition :name => "sub0" do
|
50
|
+
_print "sub0"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_0
|
55
|
+
|
56
|
+
@engine.register_participant :p0 do
|
57
|
+
@tracer << "p0\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
dotest Def0, %w{ p0 sub0 p0 sub0 p0 p0 p0 }.join("\n")
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
data/test/ft_82_trecu.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Sat Feb 16 19:07:42 JST 2008
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'flowtestbase'
|
11
|
+
#require 'openwfe/def'
|
12
|
+
#require 'openwfe/worklist/storeparticipant'
|
13
|
+
|
14
|
+
#include OpenWFE
|
15
|
+
|
16
|
+
|
17
|
+
class FlowTest82 < Test::Unit::TestCase
|
18
|
+
include FlowTestBase
|
19
|
+
|
20
|
+
#def setup
|
21
|
+
#end
|
22
|
+
|
23
|
+
#def teardown
|
24
|
+
#end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Test 0
|
28
|
+
#
|
29
|
+
|
30
|
+
class Test0 < OpenWFE::ProcessDefinition
|
31
|
+
sequence do
|
32
|
+
#_print "${r:fei.wfname}"
|
33
|
+
_print do
|
34
|
+
reval "$i += 1"
|
35
|
+
end
|
36
|
+
subprocess :ref => "Test", :unless => "${r:$i} == 3"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_0
|
41
|
+
|
42
|
+
$i = 0
|
43
|
+
|
44
|
+
dotest Test0, "1\n2\n3"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFEru
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Sat Feb 16 19:07:42 JST 2008
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'flowtestbase'
|
11
|
+
#require 'openwfe/def'
|
12
|
+
#require 'openwfe/worklist/storeparticipant'
|
13
|
+
|
14
|
+
#include OpenWFE
|
15
|
+
|
16
|
+
|
17
|
+
class FlowTest83 < Test::Unit::TestCase
|
18
|
+
include FlowTestBase
|
19
|
+
|
20
|
+
#def setup
|
21
|
+
#end
|
22
|
+
|
23
|
+
#def teardown
|
24
|
+
#end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Test 0
|
28
|
+
#
|
29
|
+
|
30
|
+
class Test0 < OpenWFE::ProcessDefinition
|
31
|
+
concurrence do
|
32
|
+
_loop do
|
33
|
+
alpha
|
34
|
+
end
|
35
|
+
_loop do
|
36
|
+
alpha
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_0
|
42
|
+
|
43
|
+
@engine.register_participant :alpha do
|
44
|
+
sleep 0.002
|
45
|
+
end
|
46
|
+
|
47
|
+
fei = @engine.launch Test0
|
48
|
+
|
49
|
+
sleep 0.350
|
50
|
+
|
51
|
+
1000.times do |i|
|
52
|
+
print "."
|
53
|
+
ps = @engine.process_status fei
|
54
|
+
assert ( ! ps.paused?)
|
55
|
+
#p ps.expressions.size
|
56
|
+
end
|
57
|
+
|
58
|
+
#dotest Test0, "1\n2\n3"
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,125 @@
|
|
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/worklist/storeparticipant'
|
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 < 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 = @engine.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 < 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 = @engine.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
|
+
end
|
125
|
+
|
@@ -0,0 +1,105 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing OpenWFE
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Thu Nov 22 11:53:13 JST 2007
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'flowtestbase'
|
11
|
+
require 'openwfe/def'
|
12
|
+
|
13
|
+
|
14
|
+
class FlowTest9b < Test::Unit::TestCase
|
15
|
+
include FlowTestBase
|
16
|
+
|
17
|
+
#def setup
|
18
|
+
#end
|
19
|
+
|
20
|
+
#def teardown
|
21
|
+
#end
|
22
|
+
|
23
|
+
#
|
24
|
+
# Test 0
|
25
|
+
#
|
26
|
+
|
27
|
+
class Test0 < ProcessDefinition
|
28
|
+
cursor do
|
29
|
+
set :v => "v0", :val => "x"
|
30
|
+
_print "${v0}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_0
|
35
|
+
|
36
|
+
dotest Test0, "x"
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Test 1
|
41
|
+
#
|
42
|
+
|
43
|
+
class Test1 < ProcessDefinition
|
44
|
+
cursor do
|
45
|
+
my_participant
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_1
|
50
|
+
|
51
|
+
@engine.register_participant :my_participant do |fexp, wi|
|
52
|
+
#puts fexp.to_s
|
53
|
+
#puts fexp.environment_id.to_s
|
54
|
+
@tracer << "ok0\n" if fexp.environment_id.expid != fexp.fei.expid
|
55
|
+
@tracer << "ok1\n" if fexp.environment_id.expid == "0.0"
|
56
|
+
@tracer << "ok2\n" if fexp.environment_id.wfid + ".0" == fexp.fei.wfid
|
57
|
+
end
|
58
|
+
|
59
|
+
dotest Test1, "ok0\nok1\nok2"
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Test 2
|
64
|
+
#
|
65
|
+
|
66
|
+
#class Test2 < ProcessDefinition
|
67
|
+
# cursor do
|
68
|
+
# my_participant
|
69
|
+
# end
|
70
|
+
#end
|
71
|
+
class MyParticipant
|
72
|
+
include LocalParticipant
|
73
|
+
|
74
|
+
def initialize (tracer)
|
75
|
+
@tracer = tracer
|
76
|
+
end
|
77
|
+
def consume (workitem)
|
78
|
+
@tracer << "consume\n"
|
79
|
+
@workitem = workitem
|
80
|
+
end
|
81
|
+
def cancel (cancelitem)
|
82
|
+
@tracer << @workitem.fei.sub_instance_id
|
83
|
+
@tracer << " cancel\n"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_2
|
88
|
+
|
89
|
+
log_level_to_debug
|
90
|
+
|
91
|
+
@engine.register_participant :my_participant, MyParticipant.new(@tracer)
|
92
|
+
|
93
|
+
fei = @engine.launch Test1
|
94
|
+
|
95
|
+
sleep 0.350
|
96
|
+
|
97
|
+
@engine.cancel_process fei
|
98
|
+
|
99
|
+
sleep 0.350
|
100
|
+
|
101
|
+
assert_equal "consume\n.0 cancel", @tracer.to_s
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|