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,61 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Sun Jun 14 13:33:17 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class EftForgetTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_basic
|
15
|
+
|
16
|
+
pdef = Ruote.process_definition do
|
17
|
+
sequence do
|
18
|
+
forget do
|
19
|
+
alpha
|
20
|
+
end
|
21
|
+
alpha
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
@engine.register_participant :alpha do
|
26
|
+
@tracer << "alpha\n"
|
27
|
+
end
|
28
|
+
|
29
|
+
#noisy
|
30
|
+
|
31
|
+
wfid = @engine.launch(pdef)
|
32
|
+
|
33
|
+
wait_for(:alpha)
|
34
|
+
wait_for(:alpha)
|
35
|
+
wait_for(wfid)
|
36
|
+
wait_for(wfid)
|
37
|
+
|
38
|
+
assert_equal "alpha\nalpha", @tracer.to_s
|
39
|
+
|
40
|
+
#logger.log.each { |e| puts e['action'] }
|
41
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'ceased' }.size
|
42
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'terminated' }.size
|
43
|
+
end
|
44
|
+
|
45
|
+
#def test_variables
|
46
|
+
# pdef = Ruote.process_definition do
|
47
|
+
# set :var => 'a', :value => 0
|
48
|
+
# concurrence do
|
49
|
+
# set :var => 'a', :value => 1
|
50
|
+
# forget do
|
51
|
+
# echo '0_${v:a}'
|
52
|
+
# end
|
53
|
+
# echo '1_${v:a}'
|
54
|
+
# end
|
55
|
+
# echo '2_${v:a}'
|
56
|
+
# end
|
57
|
+
# noisy
|
58
|
+
# assert_trace %w[ 1_1 0_0 2_1 ], pdef
|
59
|
+
#end
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,114 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Sun Jun 14 14:48:03 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class EftUndoTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_undo_ref
|
17
|
+
|
18
|
+
pdef = Ruote.process_definition do
|
19
|
+
concurrence do
|
20
|
+
alpha :tag => 'kilroy'
|
21
|
+
undo :ref => 'kilroy'
|
22
|
+
end
|
23
|
+
echo 'over'
|
24
|
+
end
|
25
|
+
|
26
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
27
|
+
|
28
|
+
#noisy
|
29
|
+
|
30
|
+
assert_trace %w[ over ], pdef
|
31
|
+
|
32
|
+
assert_equal 0, alpha.size
|
33
|
+
|
34
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'entered_tag' }.size
|
35
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'cancel' }.size
|
36
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'left_tag' }.size
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_undo
|
40
|
+
|
41
|
+
pdef = Ruote.process_definition do
|
42
|
+
concurrence do
|
43
|
+
alpha :tag => :kilroy
|
44
|
+
#undo :kilroy
|
45
|
+
cancel :kilroy
|
46
|
+
end
|
47
|
+
echo 'over'
|
48
|
+
end
|
49
|
+
|
50
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
51
|
+
|
52
|
+
#noisy
|
53
|
+
|
54
|
+
assert_trace %w[ over ], pdef
|
55
|
+
|
56
|
+
assert_equal 0, alpha.size
|
57
|
+
|
58
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'entered_tag' }.size
|
59
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'cancel' }.size
|
60
|
+
assert_equal 1, logger.log.select { |e| e['action'] == 'left_tag' }.size
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_undo_parent
|
64
|
+
|
65
|
+
pdef = Ruote.process_definition do
|
66
|
+
sequence :tag => :richard do
|
67
|
+
cancel :richard
|
68
|
+
echo 'out'
|
69
|
+
end
|
70
|
+
echo '.'
|
71
|
+
end
|
72
|
+
|
73
|
+
#noisy
|
74
|
+
|
75
|
+
assert_trace '.', pdef
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_undo_missing_tag
|
79
|
+
|
80
|
+
pdef = Ruote.process_definition do
|
81
|
+
cancel :nada
|
82
|
+
echo '.'
|
83
|
+
end
|
84
|
+
|
85
|
+
assert_trace '.', pdef
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_undo_tag_pointing_nowhere
|
89
|
+
|
90
|
+
pdef = Ruote.process_definition do
|
91
|
+
set 'v:nada' => []
|
92
|
+
cancel :nada
|
93
|
+
echo '.'
|
94
|
+
end
|
95
|
+
|
96
|
+
#@engine.noisy = true
|
97
|
+
|
98
|
+
assert_trace '.', pdef
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_undo_tag_pointing_to_missing_fei
|
102
|
+
|
103
|
+
pdef = Ruote.process_definition do
|
104
|
+
set 'v:nada' => { 'wfid' => '${wfid}', 'expid' => '${expid}', 'engine_id' => '${engine_id}' }
|
105
|
+
cancel :nada
|
106
|
+
echo '.'
|
107
|
+
end
|
108
|
+
|
109
|
+
#@engine.noisy = true
|
110
|
+
|
111
|
+
assert_trace '.', pdef
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
@@ -0,0 +1,138 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Mon Jun 15 12:58:12 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class EftRedoTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_redo
|
17
|
+
|
18
|
+
pdef = Ruote.process_definition do
|
19
|
+
sequence :tag => 'seq' do
|
20
|
+
alpha
|
21
|
+
_redo :ref => 'seq'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
26
|
+
|
27
|
+
#noisy
|
28
|
+
|
29
|
+
wfid = @engine.launch(pdef)
|
30
|
+
wait_for(:alpha)
|
31
|
+
|
32
|
+
alpha.proceed(alpha.first)
|
33
|
+
wait_for(:alpha)
|
34
|
+
|
35
|
+
alpha.proceed(alpha.first)
|
36
|
+
wait_for(:alpha)
|
37
|
+
|
38
|
+
ps = @engine.process(wfid)
|
39
|
+
|
40
|
+
assert_equal 0, ps.errors.size
|
41
|
+
assert_equal 3, ps.expressions.size
|
42
|
+
|
43
|
+
assert_equal 3, logger.log.select { |e| e['action'] == 'entered_tag' }.size
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_redo_missing_tag
|
47
|
+
|
48
|
+
pdef = Ruote.process_definition do
|
49
|
+
_redo :nada
|
50
|
+
echo '.'
|
51
|
+
end
|
52
|
+
|
53
|
+
assert_trace '.', pdef
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_redo_tag_pointing_nowhere
|
57
|
+
|
58
|
+
pdef = Ruote.process_definition do
|
59
|
+
set 'v:nada' => []
|
60
|
+
_redo :nada
|
61
|
+
echo '.'
|
62
|
+
end
|
63
|
+
|
64
|
+
#@engine.noisy = true
|
65
|
+
|
66
|
+
assert_trace '.', pdef
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_redo_tag_pointing_to_missing_fei
|
70
|
+
|
71
|
+
pdef = Ruote.process_definition do
|
72
|
+
set 'v:nada' => { 'wfid' => '${wfid}', 'expid' => '${expid}', 'engine_id' => '${engine_id}' }
|
73
|
+
_redo :nada
|
74
|
+
echo '.'
|
75
|
+
end
|
76
|
+
|
77
|
+
#@engine.noisy = true
|
78
|
+
|
79
|
+
assert_trace '.', pdef
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_forget_and_redo
|
83
|
+
|
84
|
+
pdef = Ruote.process_definition do
|
85
|
+
sequence :tag => 'x' do
|
86
|
+
alpha :forget => true
|
87
|
+
_redo 'x'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
#noisy
|
92
|
+
|
93
|
+
@engine.register 'alpha', Ruote::StorageParticipant
|
94
|
+
|
95
|
+
wfid = @engine.launch(pdef)
|
96
|
+
|
97
|
+
while @engine.storage_participant.size < 2
|
98
|
+
sleep 0.350
|
99
|
+
end
|
100
|
+
|
101
|
+
assert_not_nil @engine.process(wfid)
|
102
|
+
assert_equal [], @engine.errors
|
103
|
+
end
|
104
|
+
|
105
|
+
class Alpha
|
106
|
+
include Ruote::LocalParticipant
|
107
|
+
@@seen = false
|
108
|
+
def consume(workitem)
|
109
|
+
(workitem.fields['alpha'] ||= []) << 'x'
|
110
|
+
workitem.fields['over'] = @@seen
|
111
|
+
@@seen = true
|
112
|
+
reply_to_engine(workitem)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_redo__blank_workitem
|
117
|
+
|
118
|
+
@engine.register do
|
119
|
+
alpha Alpha
|
120
|
+
end
|
121
|
+
|
122
|
+
pdef = Ruote.process_definition do
|
123
|
+
sequence :tag => 'x' do
|
124
|
+
alpha
|
125
|
+
_redo 'x', :unless => '${over}'
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
#noisy
|
130
|
+
|
131
|
+
wfid = @engine.launch(pdef)
|
132
|
+
|
133
|
+
r = @engine.wait_for(wfid)
|
134
|
+
|
135
|
+
assert_equal %w[ x ], r['workitem']['fields']['alpha']
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Fri May 15 09:51:28 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/part/null_participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtWorkerTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_launch_terminate
|
17
|
+
|
18
|
+
#noisy
|
19
|
+
|
20
|
+
pdef = Ruote.process_definition do
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_trace '', pdef
|
24
|
+
|
25
|
+
#puts; logger.log.each { |e| p e }; puts
|
26
|
+
assert_equal %w[ launch terminated ], logger.log.map { |e| e['action'] }
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_stop_worker
|
30
|
+
|
31
|
+
sleep 0.010 # warm up time
|
32
|
+
|
33
|
+
assert_equal true, @engine.context.worker.running
|
34
|
+
|
35
|
+
@engine.shutdown
|
36
|
+
|
37
|
+
assert_equal false, @engine.context.worker.running
|
38
|
+
|
39
|
+
pdef = Ruote.process_definition do; end
|
40
|
+
|
41
|
+
@engine.launch(pdef)
|
42
|
+
|
43
|
+
Thread.pass
|
44
|
+
|
45
|
+
#assert_equal 1, @engine.storage.get_many('msgs').size
|
46
|
+
# won't work with the latest ruote-redis implementations
|
47
|
+
|
48
|
+
assert_equal 1, @engine.storage.get_msgs.size
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_remaining_messages
|
52
|
+
|
53
|
+
@engine.register_participant :alfred, Ruote::NullParticipant
|
54
|
+
|
55
|
+
pdef = Ruote.process_definition do
|
56
|
+
end
|
57
|
+
|
58
|
+
assert_trace '', pdef
|
59
|
+
|
60
|
+
sleep 0.300
|
61
|
+
|
62
|
+
assert_equal [], @engine.storage.get_msgs
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,304 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Wed Jun 10 22:57:18 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class FtDollarTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_default
|
15
|
+
|
16
|
+
pdef = Ruote.process_definition do
|
17
|
+
sequence do
|
18
|
+
set :var => 'x', :val => 'variable'
|
19
|
+
set :field => 'x', :val => 'field'
|
20
|
+
echo '${x}'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
#noisy
|
25
|
+
|
26
|
+
assert_trace 'field', pdef
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_v
|
30
|
+
|
31
|
+
pdef = Ruote.process_definition do
|
32
|
+
sequence do
|
33
|
+
echo 'a${v:missing}'
|
34
|
+
set :var => 'v0', :val => '0'
|
35
|
+
echo 'b${v:v0}'
|
36
|
+
echo 'c${var:v0}'
|
37
|
+
echo 'd${variable:v0}'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
#noisy
|
42
|
+
|
43
|
+
assert_trace(%w[ a b0 c0 d0 ], pdef)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_nested_v
|
47
|
+
|
48
|
+
pdef = Ruote.process_definition do
|
49
|
+
sequence do
|
50
|
+
set(
|
51
|
+
:var => 'v0',
|
52
|
+
:val => {
|
53
|
+
'name' => 'toto',
|
54
|
+
'address' => [ 'e-street', 'atlantic_city' ] })
|
55
|
+
echo 'a:${v:v0.name}'
|
56
|
+
echo 'b:${v:v0.address.1}'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
#noisy
|
61
|
+
|
62
|
+
assert_trace(%w[ a:toto b:atlantic_city ], pdef)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_f
|
66
|
+
|
67
|
+
pdef = Ruote.process_definition do
|
68
|
+
sequence do
|
69
|
+
set :field => 'f', :val => { 'name' => 'toto', 'address' => %w[ KL Asia ]}
|
70
|
+
echo 'a${f:missing}'
|
71
|
+
echo 'b${f:f.name}'
|
72
|
+
echo 'c${f:f.address.1}'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
#noisy
|
77
|
+
|
78
|
+
assert_trace(%w[ a btoto cAsia ], pdef)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_no_r
|
82
|
+
|
83
|
+
pdef = Ruote.process_definition do
|
84
|
+
sequence do
|
85
|
+
echo '>${r:1 + 2}<'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
#noisy
|
90
|
+
|
91
|
+
wfid = @engine.launch(pdef)
|
92
|
+
|
93
|
+
@engine.wait_for(wfid)
|
94
|
+
|
95
|
+
assert_equal(
|
96
|
+
"#<ArgumentError: 'ruby_eval_allowed' is set to false, cannot evaluate" +
|
97
|
+
" >1 + 2< (http://ruote.rubyforge.org/dollar.html)>",
|
98
|
+
@engine.errors.first.message)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_r
|
102
|
+
|
103
|
+
pdef = Ruote.process_definition do
|
104
|
+
sequence do
|
105
|
+
echo '>${r:1 + 2}<'
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
#noisy
|
110
|
+
|
111
|
+
@engine.context['ruby_eval_allowed'] = true
|
112
|
+
|
113
|
+
assert_trace('>3<', pdef)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_r_and_wi
|
117
|
+
|
118
|
+
pdef = Ruote.process_definition do
|
119
|
+
sequence do
|
120
|
+
set 'f:toto' => 'person'
|
121
|
+
echo "${r:wi.fields['toto']}"
|
122
|
+
echo "${r:workitem.fields['toto']}"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
#noisy
|
127
|
+
|
128
|
+
@engine.context['ruby_eval_allowed'] = true
|
129
|
+
|
130
|
+
assert_trace "person\nperson", pdef
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_r_and_d
|
134
|
+
|
135
|
+
pdef = Ruote.process_definition do
|
136
|
+
sequence do
|
137
|
+
set 'f:toto' => 'person'
|
138
|
+
echo "${r:d('f:toto')}"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
#noisy
|
143
|
+
|
144
|
+
@engine.context['ruby_eval_allowed'] = true
|
145
|
+
|
146
|
+
assert_trace 'person', pdef
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_nested
|
150
|
+
|
151
|
+
pdef = Ruote.process_definition do
|
152
|
+
sequence do
|
153
|
+
set 'f:a' => 'a'
|
154
|
+
set 'v:a' => 'AA'
|
155
|
+
echo '${v:${f:a}}'
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
#noisy
|
160
|
+
|
161
|
+
assert_trace 'AA', pdef
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_fei_and_wfid
|
165
|
+
|
166
|
+
pdef = Ruote.process_definition do
|
167
|
+
sequence do
|
168
|
+
echo '${fei}'
|
169
|
+
echo '${wfid}'
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
wfid = @engine.launch(pdef)
|
174
|
+
|
175
|
+
@engine.wait_for(wfid)
|
176
|
+
|
177
|
+
assert_match /^0_0_0![^!]+!#{wfid}\n#{wfid}$/, @tracer.to_s
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_direct_access_to_fields
|
181
|
+
|
182
|
+
pdef = Ruote.process_definition do
|
183
|
+
sequence do
|
184
|
+
set 'f:a' => [ 'alpha', 'bravo', 'charly' ]
|
185
|
+
echo '${r:a.join("/")}'
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
@engine.context['ruby_eval_allowed'] = true
|
190
|
+
|
191
|
+
#noisy
|
192
|
+
|
193
|
+
assert_trace 'alpha/bravo/charly', pdef
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_dollar_quote
|
197
|
+
|
198
|
+
pdef = Ruote.define do
|
199
|
+
set 'f:a' => 'alpha'
|
200
|
+
set 'f:b' => 'bra vo'
|
201
|
+
echo '${"f:a}'
|
202
|
+
echo "${'f:a}"
|
203
|
+
echo 'ok', :if => "${'f:b} == 'bra vo'"
|
204
|
+
end
|
205
|
+
|
206
|
+
assert_trace %w[ "alpha" "alpha" ok ], pdef
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_literally
|
210
|
+
|
211
|
+
pdef = Ruote.define do
|
212
|
+
set 'f:a' => %w[ A B C ]
|
213
|
+
set 'f:b' => 'a'
|
214
|
+
set 'v:c' => %w[ venture capitalist ]
|
215
|
+
set 'f:A' => '$f:a'
|
216
|
+
set 'f:B' => '$f:${b}'
|
217
|
+
set 'f:C' => '$v:c'
|
218
|
+
set 'f:D' => '$f:nada'
|
219
|
+
set 'f:E' => '$v:nada'
|
220
|
+
set 'f:F' => '$a'
|
221
|
+
set 'f:G' => '$nada'
|
222
|
+
set 'f:H' => '$a '
|
223
|
+
filter :f => /^[a-c]$/, :del => true
|
224
|
+
end
|
225
|
+
|
226
|
+
#noisy
|
227
|
+
|
228
|
+
wfid = @engine.launch(pdef)
|
229
|
+
|
230
|
+
r = @engine.wait_for(wfid)
|
231
|
+
|
232
|
+
assert_equal(
|
233
|
+
{
|
234
|
+
'A' => %w[ A B C ],
|
235
|
+
'B' => %w[ A B C ],
|
236
|
+
'C' => %w[ venture capitalist ],
|
237
|
+
'D' => '$f:nada',
|
238
|
+
'E' => '$v:nada',
|
239
|
+
'F' => %w[ A B C ],
|
240
|
+
'G' => '$nada',
|
241
|
+
'H' => '$a '
|
242
|
+
},
|
243
|
+
r['workitem']['fields'])
|
244
|
+
end
|
245
|
+
|
246
|
+
def test_literally_and_participant_params
|
247
|
+
|
248
|
+
pdef = Ruote.define do
|
249
|
+
set 'f:a' => %w[ A B C ]
|
250
|
+
alpha :b => '$f:a'
|
251
|
+
end
|
252
|
+
|
253
|
+
@engine.register_participant :alpha do |wi|
|
254
|
+
wi.fields['parameters'] = wi.fields['params']
|
255
|
+
end
|
256
|
+
|
257
|
+
#noisy
|
258
|
+
|
259
|
+
wfid = @engine.launch(pdef)
|
260
|
+
|
261
|
+
r = @engine.wait_for(wfid)
|
262
|
+
|
263
|
+
assert_equal(
|
264
|
+
{ 'b' => %w[ A B C ], 'ref' => 'alpha' },
|
265
|
+
r['workitem']['fields']['parameters'])
|
266
|
+
end
|
267
|
+
|
268
|
+
# Issue pointed out by John Le.
|
269
|
+
#
|
270
|
+
def test_not_a_number
|
271
|
+
|
272
|
+
pdef = Ruote.define do
|
273
|
+
echo 'a0', :if => '${a}'
|
274
|
+
echo 'a1', :if => '${a} is set'
|
275
|
+
echo 'b', :if => '${b}'
|
276
|
+
echo 'c'
|
277
|
+
end
|
278
|
+
|
279
|
+
wfid = @engine.launch(
|
280
|
+
pdef,
|
281
|
+
'a' => '0a')
|
282
|
+
|
283
|
+
@engine.wait_for(wfid)
|
284
|
+
|
285
|
+
assert_equal "a0\na1\nc", @tracer.to_s
|
286
|
+
end
|
287
|
+
|
288
|
+
def test_literal
|
289
|
+
|
290
|
+
pdef = Ruote.define do
|
291
|
+
set 'f:a' => true
|
292
|
+
_if '$a' do
|
293
|
+
echo 'a0'
|
294
|
+
end
|
295
|
+
echo 'a1', :if => '$a'
|
296
|
+
end
|
297
|
+
|
298
|
+
wfid = @engine.launch(pdef)
|
299
|
+
@engine.wait_for(wfid)
|
300
|
+
|
301
|
+
assert_equal "a0\na1", @tracer.to_s
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|