ruote-maestrodev 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +290 -0
- data/CREDITS.txt +99 -0
- data/LICENSE.txt +21 -0
- data/README.rdoc +88 -0
- data/Rakefile +108 -0
- data/TODO.txt +488 -0
- data/lib/ruote.rb +7 -0
- data/lib/ruote/context.rb +194 -0
- data/lib/ruote/engine.rb +1062 -0
- data/lib/ruote/engine/process_error.rb +122 -0
- data/lib/ruote/engine/process_status.rb +448 -0
- data/lib/ruote/exp/command.rb +87 -0
- data/lib/ruote/exp/commanded.rb +69 -0
- data/lib/ruote/exp/condition.rb +227 -0
- data/lib/ruote/exp/fe_add_branches.rb +138 -0
- data/lib/ruote/exp/fe_apply.rb +154 -0
- data/lib/ruote/exp/fe_cancel_process.rb +78 -0
- data/lib/ruote/exp/fe_command.rb +156 -0
- data/lib/ruote/exp/fe_concurrence.rb +321 -0
- data/lib/ruote/exp/fe_concurrent_iterator.rb +219 -0
- data/lib/ruote/exp/fe_cron.rb +141 -0
- data/lib/ruote/exp/fe_cursor.rb +324 -0
- data/lib/ruote/exp/fe_define.rb +112 -0
- data/lib/ruote/exp/fe_echo.rb +60 -0
- data/lib/ruote/exp/fe_equals.rb +115 -0
- data/lib/ruote/exp/fe_error.rb +82 -0
- data/lib/ruote/exp/fe_filter.rb +648 -0
- data/lib/ruote/exp/fe_forget.rb +88 -0
- data/lib/ruote/exp/fe_given.rb +154 -0
- data/lib/ruote/exp/fe_if.rb +127 -0
- data/lib/ruote/exp/fe_inc.rb +205 -0
- data/lib/ruote/exp/fe_iterator.rb +234 -0
- data/lib/ruote/exp/fe_let.rb +75 -0
- data/lib/ruote/exp/fe_listen.rb +304 -0
- data/lib/ruote/exp/fe_lose.rb +110 -0
- data/lib/ruote/exp/fe_noop.rb +45 -0
- data/lib/ruote/exp/fe_once.rb +215 -0
- data/lib/ruote/exp/fe_participant.rb +287 -0
- data/lib/ruote/exp/fe_read.rb +69 -0
- data/lib/ruote/exp/fe_redo.rb +82 -0
- data/lib/ruote/exp/fe_ref.rb +152 -0
- data/lib/ruote/exp/fe_registerp.rb +110 -0
- data/lib/ruote/exp/fe_reserve.rb +126 -0
- data/lib/ruote/exp/fe_restore.rb +102 -0
- data/lib/ruote/exp/fe_save.rb +72 -0
- data/lib/ruote/exp/fe_sequence.rb +59 -0
- data/lib/ruote/exp/fe_set.rb +154 -0
- data/lib/ruote/exp/fe_subprocess.rb +211 -0
- data/lib/ruote/exp/fe_that.rb +92 -0
- data/lib/ruote/exp/fe_undo.rb +67 -0
- data/lib/ruote/exp/fe_unregisterp.rb +69 -0
- data/lib/ruote/exp/fe_wait.rb +95 -0
- data/lib/ruote/exp/flowexpression.rb +886 -0
- data/lib/ruote/exp/iterator.rb +81 -0
- data/lib/ruote/exp/merge.rb +118 -0
- data/lib/ruote/exp/ro_attributes.rb +212 -0
- data/lib/ruote/exp/ro_filters.rb +136 -0
- data/lib/ruote/exp/ro_persist.rb +154 -0
- data/lib/ruote/exp/ro_variables.rb +189 -0
- data/lib/ruote/exp/ro_vf.rb +68 -0
- data/lib/ruote/fei.rb +260 -0
- data/lib/ruote/id/mnemo_wfid_generator.rb +43 -0
- data/lib/ruote/id/wfid_generator.rb +81 -0
- data/lib/ruote/log/default_history.rb +122 -0
- data/lib/ruote/log/pretty.rb +176 -0
- data/lib/ruote/log/storage_history.rb +159 -0
- data/lib/ruote/log/test_logger.rb +208 -0
- data/lib/ruote/log/wait_logger.rb +64 -0
- data/lib/ruote/part/block_participant.rb +137 -0
- data/lib/ruote/part/code_participant.rb +81 -0
- data/lib/ruote/part/engine_participant.rb +189 -0
- data/lib/ruote/part/local_participant.rb +138 -0
- data/lib/ruote/part/no_op_participant.rb +60 -0
- data/lib/ruote/part/null_participant.rb +54 -0
- data/lib/ruote/part/rev_participant.rb +169 -0
- data/lib/ruote/part/smtp_participant.rb +116 -0
- data/lib/ruote/part/storage_participant.rb +392 -0
- data/lib/ruote/part/template.rb +84 -0
- data/lib/ruote/participant.rb +7 -0
- data/lib/ruote/reader.rb +278 -0
- data/lib/ruote/reader/json.rb +49 -0
- data/lib/ruote/reader/radial.rb +290 -0
- data/lib/ruote/reader/ruby_dsl.rb +186 -0
- data/lib/ruote/reader/xml.rb +99 -0
- data/lib/ruote/receiver/base.rb +212 -0
- data/lib/ruote/storage/base.rb +364 -0
- data/lib/ruote/storage/composite_storage.rb +121 -0
- data/lib/ruote/storage/fs_storage.rb +139 -0
- data/lib/ruote/storage/hash_storage.rb +211 -0
- data/lib/ruote/svc/dispatch_pool.rb +158 -0
- data/lib/ruote/svc/dollar_sub.rb +298 -0
- data/lib/ruote/svc/error_handler.rb +138 -0
- data/lib/ruote/svc/expression_map.rb +97 -0
- data/lib/ruote/svc/participant_list.rb +397 -0
- data/lib/ruote/svc/tracker.rb +172 -0
- data/lib/ruote/svc/treechecker.rb +141 -0
- data/lib/ruote/tree_dot.rb +85 -0
- data/lib/ruote/util/filter.rb +525 -0
- data/lib/ruote/util/hashdot.rb +79 -0
- data/lib/ruote/util/look.rb +128 -0
- data/lib/ruote/util/lookup.rb +127 -0
- data/lib/ruote/util/misc.rb +167 -0
- data/lib/ruote/util/ometa.rb +71 -0
- data/lib/ruote/util/serializer.rb +103 -0
- data/lib/ruote/util/subprocess.rb +88 -0
- data/lib/ruote/util/time.rb +100 -0
- data/lib/ruote/util/tree.rb +58 -0
- data/lib/ruote/version.rb +29 -0
- data/lib/ruote/worker.rb +386 -0
- data/lib/ruote/workitem.rb +394 -0
- data/phil.txt +14 -0
- data/ruote.gemspec +44 -0
- data/test/bm/ci.rb +55 -0
- data/test/bm/ici.rb +71 -0
- data/test/bm/juuman.rb +54 -0
- data/test/bm/launch_bench.rb +37 -0
- data/test/bm/load_26c.rb +97 -0
- data/test/bm/mega.rb +64 -0
- data/test/bm/seq_thousand.rb +31 -0
- data/test/bm/t.rb +35 -0
- data/test/functional/base.rb +247 -0
- data/test/functional/concurrent_base.rb +98 -0
- data/test/functional/crunner.rb +31 -0
- data/test/functional/ct_0_concurrence.rb +65 -0
- data/test/functional/ct_1_iterator.rb +67 -0
- data/test/functional/ct_2_cancel.rb +81 -0
- data/test/functional/eft_0_process_definition.rb +65 -0
- data/test/functional/eft_10_cancel_process.rb +46 -0
- data/test/functional/eft_11_wait.rb +109 -0
- data/test/functional/eft_12_listen.rb +500 -0
- data/test/functional/eft_13_iterator.rb +342 -0
- data/test/functional/eft_14_cursor.rb +456 -0
- data/test/functional/eft_15_loop.rb +69 -0
- data/test/functional/eft_16_if.rb +183 -0
- data/test/functional/eft_17_equals.rb +55 -0
- data/test/functional/eft_18_concurrent_iterator.rb +410 -0
- data/test/functional/eft_19_reserve.rb +136 -0
- data/test/functional/eft_1_echo.rb +68 -0
- data/test/functional/eft_20_save.rb +116 -0
- data/test/functional/eft_21_restore.rb +61 -0
- data/test/functional/eft_22_noop.rb +28 -0
- data/test/functional/eft_23_apply.rb +168 -0
- data/test/functional/eft_24_add_branches.rb +98 -0
- data/test/functional/eft_25_command.rb +28 -0
- data/test/functional/eft_26_error.rb +77 -0
- data/test/functional/eft_27_inc.rb +280 -0
- data/test/functional/eft_28_once.rb +135 -0
- data/test/functional/eft_29_cron.rb +64 -0
- data/test/functional/eft_2_sequence.rb +58 -0
- data/test/functional/eft_30_ref.rb +155 -0
- data/test/functional/eft_31_registerp.rb +130 -0
- data/test/functional/eft_32_lose.rb +93 -0
- data/test/functional/eft_33_let.rb +31 -0
- data/test/functional/eft_34_given.rb +123 -0
- data/test/functional/eft_35_filter.rb +375 -0
- data/test/functional/eft_36_read.rb +95 -0
- data/test/functional/eft_3_participant.rb +149 -0
- data/test/functional/eft_4_set.rb +296 -0
- data/test/functional/eft_5_subprocess.rb +163 -0
- data/test/functional/eft_6_concurrence.rb +304 -0
- data/test/functional/eft_7_forget.rb +61 -0
- data/test/functional/eft_8_undo.rb +114 -0
- data/test/functional/eft_9_redo.rb +138 -0
- data/test/functional/ft_0_worker.rb +65 -0
- data/test/functional/ft_10_dollar.rb +304 -0
- data/test/functional/ft_11_recursion.rb +109 -0
- data/test/functional/ft_12_launchitem.rb +43 -0
- data/test/functional/ft_13_variables.rb +151 -0
- data/test/functional/ft_14_re_apply.rb +324 -0
- data/test/functional/ft_15_timeout.rb +226 -0
- data/test/functional/ft_16_participant_params.rb +98 -0
- data/test/functional/ft_17_conditional.rb +102 -0
- data/test/functional/ft_18_kill.rb +138 -0
- data/test/functional/ft_19_participant_code.rb +67 -0
- data/test/functional/ft_1_process_status.rb +796 -0
- data/test/functional/ft_20_storage_participant.rb +543 -0
- data/test/functional/ft_21_forget.rb +153 -0
- data/test/functional/ft_22_process_definitions.rb +90 -0
- data/test/functional/ft_23_load_defs.rb +79 -0
- data/test/functional/ft_24_block_participant.rb +235 -0
- data/test/functional/ft_25_receiver.rb +207 -0
- data/test/functional/ft_26_participant_rtimeout.rb +179 -0
- data/test/functional/ft_27_var_indirection.rb +128 -0
- data/test/functional/ft_28_null_noop_participants.rb +51 -0
- data/test/functional/ft_29_part_template.rb +60 -0
- data/test/functional/ft_2_errors.rb +380 -0
- data/test/functional/ft_30_smtp_participant.rb +122 -0
- data/test/functional/ft_31_part_blocking.rb +72 -0
- data/test/functional/ft_33_participant_subprocess_priority.rb +32 -0
- data/test/functional/ft_34_cursor_rewind.rb +101 -0
- data/test/functional/ft_35_add_service.rb +56 -0
- data/test/functional/ft_36_storage_history.rb +150 -0
- data/test/functional/ft_37_default_history.rb +109 -0
- data/test/functional/ft_38_participant_more.rb +193 -0
- data/test/functional/ft_39_wait_for.rb +136 -0
- data/test/functional/ft_3_participant_registration.rb +574 -0
- data/test/functional/ft_40_wait_logger.rb +62 -0
- data/test/functional/ft_41_participants.rb +91 -0
- data/test/functional/ft_42_storage_copy.rb +71 -0
- data/test/functional/ft_43_participant_on_reply.rb +87 -0
- data/test/functional/ft_44_var_participant.rb +35 -0
- data/test/functional/ft_45_participant_accept.rb +64 -0
- data/test/functional/ft_46_launch_single.rb +83 -0
- data/test/functional/ft_47_wfid_generator.rb +54 -0
- data/test/functional/ft_48_lose.rb +112 -0
- data/test/functional/ft_49_engine_on_error.rb +201 -0
- data/test/functional/ft_4_cancel.rb +132 -0
- data/test/functional/ft_50_engine_config.rb +22 -0
- data/test/functional/ft_51_misc.rb +67 -0
- data/test/functional/ft_52_case.rb +134 -0
- data/test/functional/ft_53_engine_on_terminate.rb +95 -0
- data/test/functional/ft_54_patterns.rb +104 -0
- data/test/functional/ft_55_engine_participant.rb +303 -0
- data/test/functional/ft_56_filter_attribute.rb +259 -0
- data/test/functional/ft_57_rev_participant.rb +252 -0
- data/test/functional/ft_58_workitem.rb +69 -0
- data/test/functional/ft_59_pause.rb +343 -0
- data/test/functional/ft_5_on_error.rb +384 -0
- data/test/functional/ft_60_code_participant.rb +45 -0
- data/test/functional/ft_61_trailing_fields.rb +34 -0
- data/test/functional/ft_62_exp_name_and_dollar_substitution.rb +35 -0
- data/test/functional/ft_6_on_cancel.rb +221 -0
- data/test/functional/ft_7_tags.rb +177 -0
- data/test/functional/ft_8_participant_consumption.rb +124 -0
- data/test/functional/ft_9_subprocesses.rb +146 -0
- data/test/functional/restart_base.rb +34 -0
- data/test/functional/rt_0_wait.rb +55 -0
- data/test/functional/rt_1_listen.rb +56 -0
- data/test/functional/rt_2_errors.rb +56 -0
- data/test/functional/rt_3_once.rb +70 -0
- data/test/functional/rt_4_cron.rb +64 -0
- data/test/functional/rt_5_timeout.rb +60 -0
- data/test/functional/rtest.rb +8 -0
- data/test/functional/storage_helper.rb +93 -0
- data/test/functional/test.rb +44 -0
- data/test/functional/vertical.rb +46 -0
- data/test/path_helper.rb +15 -0
- data/test/test.rb +13 -0
- data/test/test_helper.rb +28 -0
- data/test/unit/storage.rb +428 -0
- data/test/unit/storages.rb +37 -0
- data/test/unit/test.rb +28 -0
- data/test/unit/ut_0_ruby_reader.rb +223 -0
- data/test/unit/ut_11_lookup.rb +122 -0
- data/test/unit/ut_13_serializer.rb +65 -0
- data/test/unit/ut_14_is_uri.rb +28 -0
- data/test/unit/ut_15_util.rb +57 -0
- data/test/unit/ut_16_reader.rb +225 -0
- data/test/unit/ut_18_engine.rb +47 -0
- data/test/unit/ut_19_part_template.rb +86 -0
- data/test/unit/ut_1_fei.rb +165 -0
- data/test/unit/ut_20_composite_storage.rb +74 -0
- data/test/unit/ut_21_svc_participant_list.rb +46 -0
- data/test/unit/ut_22_filter.rb +1094 -0
- data/test/unit/ut_23_svc_tracker.rb +48 -0
- data/test/unit/ut_24_radial_reader.rb +332 -0
- data/test/unit/ut_25_merge.rb +113 -0
- data/test/unit/ut_3_wait_logger.rb +39 -0
- data/test/unit/ut_4_expmap.rb +20 -0
- data/test/unit/ut_5_tree.rb +54 -0
- data/test/unit/ut_6_condition.rb +303 -0
- data/test/unit/ut_7_workitem.rb +99 -0
- data/test/unit/ut_8_tree_to_dot.rb +72 -0
- data/test/unit/ut_9_xml_reader.rb +61 -0
- metadata +504 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Mon Oct 26 17:49:55 JST 2009
|
6
|
+
#
|
7
|
+
# in the train from Friboug to Zurich-Flughafen
|
8
|
+
#
|
9
|
+
|
10
|
+
require File.join(File.dirname(__FILE__), 'base')
|
11
|
+
|
12
|
+
require 'ruote/participant'
|
13
|
+
|
14
|
+
|
15
|
+
class EftOnceTest < Test::Unit::TestCase
|
16
|
+
include FunctionalBase
|
17
|
+
|
18
|
+
def test_once
|
19
|
+
|
20
|
+
pdef = Ruote.process_definition do
|
21
|
+
echo 'in'
|
22
|
+
concurrence do
|
23
|
+
once '${v:ok}', :freq => '1s' do
|
24
|
+
echo 'done.'
|
25
|
+
end
|
26
|
+
sequence do
|
27
|
+
wait '1s'
|
28
|
+
echo 'over'
|
29
|
+
set 'v:ok' => true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
#noisy
|
35
|
+
|
36
|
+
assert_trace %w[ in over done. ], pdef
|
37
|
+
|
38
|
+
assert_equal 0, @engine.storage.get_many('schedules').size
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_once_blocking
|
42
|
+
|
43
|
+
pdef = Ruote.process_definition do
|
44
|
+
echo 'in'
|
45
|
+
concurrence do
|
46
|
+
sequence do
|
47
|
+
once '${v:ok}', :freq => '1s'
|
48
|
+
echo 'done.'
|
49
|
+
end
|
50
|
+
sequence do
|
51
|
+
wait '1s'
|
52
|
+
echo 'over'
|
53
|
+
set 'v:ok' => true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
#noisy
|
59
|
+
|
60
|
+
assert_trace %w[ in over done. ], pdef
|
61
|
+
|
62
|
+
assert_equal 0, @engine.storage.get_many('schedules').size
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_cancel
|
66
|
+
|
67
|
+
pdef = Ruote.process_definition do
|
68
|
+
once '${v:ok}', :freq => '10d'
|
69
|
+
echo 'done.'
|
70
|
+
end
|
71
|
+
|
72
|
+
#noisy
|
73
|
+
|
74
|
+
wfid = @engine.launch(pdef)
|
75
|
+
|
76
|
+
wait_for(2)
|
77
|
+
|
78
|
+
assert_equal 1, @engine.storage.get_many('schedules').size
|
79
|
+
|
80
|
+
@engine.cancel_process(wfid)
|
81
|
+
|
82
|
+
wait_for(4)
|
83
|
+
|
84
|
+
assert_nil @engine.process(wfid)
|
85
|
+
assert_equal 0, @engine.storage.get_many('schedules').size
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_cancel_once_child_is_active
|
89
|
+
|
90
|
+
pdef = Ruote.process_definition do
|
91
|
+
as_soon_as 'true', :freq => '10d' do
|
92
|
+
alpha
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
@engine.register_participant :alpha, Ruote::StorageParticipant
|
97
|
+
|
98
|
+
#noisy
|
99
|
+
|
100
|
+
wfid = @engine.launch(pdef)
|
101
|
+
|
102
|
+
@engine.wait_for(:alpha)
|
103
|
+
|
104
|
+
@engine.cancel(wfid)
|
105
|
+
|
106
|
+
@engine.wait_for(wfid)
|
107
|
+
|
108
|
+
assert_equal 0, @engine.storage_participant.size
|
109
|
+
assert_equal 0, @engine.storage.get_many('schedules').size
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_once_cron
|
113
|
+
|
114
|
+
pdef = Ruote.process_definition do
|
115
|
+
echo 'in'
|
116
|
+
concurrence do
|
117
|
+
_when '${v:ok}', :freq => '* * * * * *' do # every second
|
118
|
+
echo 'done.'
|
119
|
+
end
|
120
|
+
sequence do
|
121
|
+
wait '1s'
|
122
|
+
echo 'over'
|
123
|
+
set 'v:ok' => true
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
#noisy
|
129
|
+
|
130
|
+
assert_trace %w[ in over done. ], pdef
|
131
|
+
|
132
|
+
assert_equal 0, @engine.storage.get_many('schedules').size
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Tue Oct 27 16:13:41 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class EftCronTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_cron
|
15
|
+
|
16
|
+
pdef = Ruote.process_definition do
|
17
|
+
cron '* * * * * *' do
|
18
|
+
echo 'ok'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
#noisy
|
23
|
+
|
24
|
+
t = Time.now
|
25
|
+
wfid = @engine.launch(pdef)
|
26
|
+
|
27
|
+
wait_for(7)
|
28
|
+
|
29
|
+
d = Time.now - t
|
30
|
+
|
31
|
+
@engine.cancel_process(wfid)
|
32
|
+
|
33
|
+
wait_for(5)
|
34
|
+
|
35
|
+
assert_match /^ok\nok/, @tracer.to_s
|
36
|
+
assert_nil @engine.process(wfid)
|
37
|
+
assert_equal 0, @engine.storage.get_many('schedules').size
|
38
|
+
#assert d < 5.0, "#{d} < 5.0 :("
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_every
|
42
|
+
|
43
|
+
pdef = Ruote.process_definition do
|
44
|
+
every '1s' do
|
45
|
+
echo 'ok'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
#noisy
|
50
|
+
|
51
|
+
wfid = @engine.launch(pdef)
|
52
|
+
|
53
|
+
wait_for(7)
|
54
|
+
|
55
|
+
@engine.cancel_process(wfid)
|
56
|
+
|
57
|
+
wait_for(5)
|
58
|
+
|
59
|
+
assert_match /^ok\nok/, @tracer.to_s
|
60
|
+
assert_nil @engine.process(wfid)
|
61
|
+
assert_equal 0, @engine.storage.get_many('schedules').size
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Sat Jan 24 22:40:35 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class EftSequenceTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_empty_sequence
|
15
|
+
|
16
|
+
pdef = Ruote.process_definition :name => 'test' do
|
17
|
+
sequence do
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#noisy
|
22
|
+
|
23
|
+
assert_trace('', pdef)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_a_b_sequence
|
27
|
+
|
28
|
+
pdef = Ruote.process_definition :name => 'test' do
|
29
|
+
sequence do
|
30
|
+
echo 'a'
|
31
|
+
echo 'b'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
#noisy
|
36
|
+
|
37
|
+
assert_trace("a\nb", pdef)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_alice_bob_sequence
|
41
|
+
|
42
|
+
pdef = Ruote.process_definition :name => 'test' do
|
43
|
+
sequence do
|
44
|
+
participant :ref => 'alice'
|
45
|
+
participant :ref => 'bob'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
@engine.register_participant '.+' do |workitem|
|
50
|
+
@tracer << workitem.participant_name + "\n"
|
51
|
+
end
|
52
|
+
|
53
|
+
#noisy
|
54
|
+
|
55
|
+
assert_trace("alice\nbob", pdef)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,155 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Tue Jul 20 12:47:36 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class EftRefTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
class AlphaParticipant
|
17
|
+
include Ruote::LocalParticipant
|
18
|
+
|
19
|
+
def consume(workitem)
|
20
|
+
@context.tracer << workitem.fei.expid
|
21
|
+
@context.tracer << "\n"
|
22
|
+
reply(workitem)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_participant
|
27
|
+
|
28
|
+
pdef = Ruote.process_definition do
|
29
|
+
ref :ref => 'alpha'
|
30
|
+
ref 'alpha'
|
31
|
+
echo 'done.'
|
32
|
+
end
|
33
|
+
|
34
|
+
@engine.register_participant :alpha, AlphaParticipant
|
35
|
+
|
36
|
+
#noisy
|
37
|
+
|
38
|
+
assert_trace %w[ 0_0 0_1 done. ], pdef
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_subprocess
|
42
|
+
|
43
|
+
pdef = Ruote.process_definition do
|
44
|
+
|
45
|
+
define 'alpha' do
|
46
|
+
echo 'alpha'
|
47
|
+
end
|
48
|
+
|
49
|
+
sequence do
|
50
|
+
ref :ref => 'alpha'
|
51
|
+
ref 'alpha'
|
52
|
+
echo 'done.'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
assert_trace %w[ alpha alpha done. ], pdef
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_missing_participant_ref
|
60
|
+
|
61
|
+
pdef = Ruote.process_definition do
|
62
|
+
ref 'alpha'
|
63
|
+
end
|
64
|
+
|
65
|
+
#noisy
|
66
|
+
|
67
|
+
wfid = @engine.launch(pdef)
|
68
|
+
|
69
|
+
@engine.wait_for(wfid)
|
70
|
+
|
71
|
+
ps = @engine.process(wfid)
|
72
|
+
|
73
|
+
assert_equal 1, ps.errors.size
|
74
|
+
|
75
|
+
# correct problem and replay at error
|
76
|
+
|
77
|
+
@engine.register_participant 'alpha', AlphaParticipant
|
78
|
+
|
79
|
+
@engine.replay_at_error(ps.errors.first)
|
80
|
+
|
81
|
+
@engine.wait_for(wfid)
|
82
|
+
|
83
|
+
assert_nil @engine.process(wfid)
|
84
|
+
assert_equal '0_0', @tracer.to_s
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_missing_subprocess_ref
|
88
|
+
|
89
|
+
pdef = Ruote.process_definition do
|
90
|
+
ref 'alpha'
|
91
|
+
end
|
92
|
+
|
93
|
+
#noisy
|
94
|
+
|
95
|
+
wfid = @engine.launch(pdef)
|
96
|
+
|
97
|
+
@engine.wait_for(wfid)
|
98
|
+
|
99
|
+
ps = @engine.process(wfid)
|
100
|
+
|
101
|
+
assert_equal 1, ps.errors.size
|
102
|
+
|
103
|
+
# correct problem and replay at error
|
104
|
+
|
105
|
+
@engine.variables['alpha'] = Ruote.process_definition do
|
106
|
+
echo 'alpha'
|
107
|
+
end
|
108
|
+
|
109
|
+
@engine.replay_at_error(ps.errors.first)
|
110
|
+
|
111
|
+
@engine.wait_for(wfid)
|
112
|
+
|
113
|
+
assert_nil @engine.process(wfid)
|
114
|
+
assert_equal 'alpha', @tracer.to_s
|
115
|
+
end
|
116
|
+
|
117
|
+
# Making sure that the ref expression forces the triggered subprocess to
|
118
|
+
# consider its timeout.
|
119
|
+
#
|
120
|
+
def test_ref_and_subprocess_timeout
|
121
|
+
|
122
|
+
@engine.register_participant :alpha, Ruote::StorageParticipant
|
123
|
+
|
124
|
+
pdef = Ruote.process_definition do
|
125
|
+
define 'sub0' do
|
126
|
+
alpha
|
127
|
+
end
|
128
|
+
ref 'sub0', :timeout => '2d'
|
129
|
+
end
|
130
|
+
|
131
|
+
wfid = @engine.launch(pdef)
|
132
|
+
@engine.wait_for(:alpha)
|
133
|
+
|
134
|
+
scheds = @engine.schedules
|
135
|
+
|
136
|
+
assert_equal 1, scheds.size
|
137
|
+
assert_equal '0_1', scheds.first['target'].expid
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_missing_ref_and_undo
|
141
|
+
|
142
|
+
pdef = Ruote.process_definition do
|
143
|
+
ref 'nemo', :on_error => 'undo'
|
144
|
+
end
|
145
|
+
|
146
|
+
#noisy
|
147
|
+
|
148
|
+
wfid = @engine.launch(pdef)
|
149
|
+
|
150
|
+
@engine.wait_for(wfid)
|
151
|
+
|
152
|
+
assert_nil @engine.process(wfid)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
@@ -0,0 +1,130 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Wed Oct 13 21:22:41 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class EftRegisterpTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_register_forbidden
|
17
|
+
|
18
|
+
pdef = Ruote.define do
|
19
|
+
registerp 'alpha', :class => 'C', :opt0 => 'val0'
|
20
|
+
end
|
21
|
+
|
22
|
+
wfid = @engine.launch(pdef)
|
23
|
+
|
24
|
+
@engine.wait_for(wfid)
|
25
|
+
|
26
|
+
err = @engine.errors.first
|
27
|
+
|
28
|
+
assert_equal(
|
29
|
+
"#<ArgumentError: 'registerp_allowed' is set to false, " +
|
30
|
+
"cannot [un]register participants from process definitions>",
|
31
|
+
err.message)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_register_from_attributes
|
35
|
+
|
36
|
+
#@engine.noisy = true
|
37
|
+
|
38
|
+
@engine.context['registerp_allowed'] = true
|
39
|
+
|
40
|
+
pdef = Ruote.define do
|
41
|
+
registerp 'alpha', :class => 'C', :opt0 => 'val_a'
|
42
|
+
registerp /bravo/, :class => 'C', :opt0 => 'val_b'
|
43
|
+
registerp :regex => /charly/, :class => 'C', :opt0 => 'val_c'
|
44
|
+
registerp :regex => 'delta', :class => 'C', :opt0 => 'val_d'
|
45
|
+
end
|
46
|
+
|
47
|
+
wfid = @engine.launch(pdef)
|
48
|
+
@engine.wait_for(wfid)
|
49
|
+
|
50
|
+
assert_equal(
|
51
|
+
[
|
52
|
+
[ '^alpha$', [ 'C', { 'opt0' => 'val_a' } ] ],
|
53
|
+
[ 'bravo', [ 'C', { 'opt0' => 'val_b' } ] ],
|
54
|
+
[ 'charly', [ 'C', { 'opt0' => 'val_c' } ] ],
|
55
|
+
[ 'delta', [ 'C', { 'opt0' => 'val_d' } ] ]
|
56
|
+
],
|
57
|
+
@engine.participant_list.collect { |e| e.to_a })
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_register_from_workitem
|
61
|
+
|
62
|
+
#@engine.noisy = true
|
63
|
+
|
64
|
+
@engine.context['registerp_allowed'] = true
|
65
|
+
|
66
|
+
pdef = Ruote.define do
|
67
|
+
registerp :participants => 'participants'
|
68
|
+
registerp :participant => 'participant'
|
69
|
+
end
|
70
|
+
|
71
|
+
wfid = @engine.launch(pdef,
|
72
|
+
'participants' => [
|
73
|
+
[ 'alpha', 'C', { 'opt0' => 'val_a' } ],
|
74
|
+
[ '/bravo/', 'C', { 'opt0' => 'val_b' } ]
|
75
|
+
],
|
76
|
+
'participant' => [ '/charly/', 'C', { 'opt0' => 'val_c' } ])
|
77
|
+
|
78
|
+
@engine.wait_for(wfid)
|
79
|
+
|
80
|
+
assert_equal(
|
81
|
+
[
|
82
|
+
[ '^alpha$', [ 'C', { 'opt0' => 'val_a' } ] ],
|
83
|
+
[ 'bravo', [ 'C', { 'opt0' => 'val_b' } ] ],
|
84
|
+
[ 'charly', [ 'C', { 'opt0' => 'val_c' } ] ]
|
85
|
+
],
|
86
|
+
@engine.participant_list.collect { |e| e.to_a })
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_register_with_position
|
90
|
+
|
91
|
+
#@engine.noisy = true
|
92
|
+
|
93
|
+
@engine.context['registerp_allowed'] = true
|
94
|
+
|
95
|
+
pdef = Ruote.define do
|
96
|
+
registerp 'alpha', :class => 'C', :opt0 => 'val_a'
|
97
|
+
registerp /bravo/, :class => 'C', :opt0 => 'val_b', :position => 0
|
98
|
+
end
|
99
|
+
|
100
|
+
wfid = @engine.launch(pdef)
|
101
|
+
@engine.wait_for(wfid)
|
102
|
+
|
103
|
+
assert_equal(
|
104
|
+
[
|
105
|
+
[ 'bravo', [ 'C', { 'opt0' => 'val_b', 'position' => 0 } ] ],
|
106
|
+
[ '^alpha$', [ 'C', { 'opt0' => 'val_a' } ] ]
|
107
|
+
],
|
108
|
+
@engine.participant_list.collect { |e| e.to_a })
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_unregister
|
112
|
+
|
113
|
+
#@engine.noisy = true
|
114
|
+
|
115
|
+
@engine.context['registerp_allowed'] = true
|
116
|
+
|
117
|
+
pdef = Ruote.define do
|
118
|
+
registerp 'alpha', :class => 'C', :opt0 => 'val_a'
|
119
|
+
unregisterp 'alpha'
|
120
|
+
end
|
121
|
+
|
122
|
+
wfid = @engine.launch(pdef)
|
123
|
+
@engine.wait_for(wfid)
|
124
|
+
|
125
|
+
assert_equal(
|
126
|
+
[],
|
127
|
+
@engine.participant_list.collect { |e| e.to_a })
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|