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,136 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Fri Jul 31 21:44:04 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class EftReserveTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_reserve
|
17
|
+
|
18
|
+
pdef = Ruote.process_definition :name => 'test' do
|
19
|
+
concurrence do
|
20
|
+
reserve :mutex => 'a' do
|
21
|
+
alpha
|
22
|
+
end
|
23
|
+
reserve 'a' do
|
24
|
+
alpha
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
#noisy
|
30
|
+
|
31
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
32
|
+
|
33
|
+
wfid = @engine.launch(pdef)
|
34
|
+
|
35
|
+
wait_for(:alpha)
|
36
|
+
|
37
|
+
assert_equal 1, alpha.size
|
38
|
+
assert_equal '0_0_0_0', alpha.first.fei.expid
|
39
|
+
|
40
|
+
ps = @engine.process(wfid)
|
41
|
+
|
42
|
+
assert_equal 2, ps.variables.size
|
43
|
+
|
44
|
+
assert_equal(
|
45
|
+
[ 'mutex', 'a' ], ps.variables['a'][0, 2])
|
46
|
+
assert_equal(
|
47
|
+
[ '0_0_0', '0_0_1' ],
|
48
|
+
ps.variables['a'].last.collect { |e| e['expid'] })
|
49
|
+
|
50
|
+
alpha.proceed(alpha.first)
|
51
|
+
|
52
|
+
wait_for(:alpha)
|
53
|
+
|
54
|
+
assert_equal 1, alpha.size
|
55
|
+
assert_equal '0_0_1_0', alpha.first.fei.expid
|
56
|
+
|
57
|
+
alpha.proceed(alpha.first)
|
58
|
+
|
59
|
+
wait_for(wfid)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_cancel_reserve
|
63
|
+
|
64
|
+
pdef = Ruote.process_definition :name => 'test' do
|
65
|
+
concurrence do
|
66
|
+
reserve :mutex => 'a' do
|
67
|
+
alpha
|
68
|
+
end
|
69
|
+
reserve 'a' do
|
70
|
+
alpha
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
#noisy
|
76
|
+
|
77
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
78
|
+
|
79
|
+
wfid = @engine.launch(pdef)
|
80
|
+
|
81
|
+
wait_for(:alpha)
|
82
|
+
|
83
|
+
ps = @engine.process(wfid)
|
84
|
+
exp = ps.expressions.find { |e| e.fei.expid == '0_0_0' }
|
85
|
+
|
86
|
+
@engine.cancel_expression(exp.fei)
|
87
|
+
|
88
|
+
wait_for(:alpha)
|
89
|
+
|
90
|
+
#alpha.instance_variable_get(:@items).each { |i| p i }
|
91
|
+
|
92
|
+
assert_equal 1, alpha.size
|
93
|
+
assert_equal '0_0_1_0', alpha.first.fei.expid
|
94
|
+
|
95
|
+
alpha.proceed(alpha.first)
|
96
|
+
|
97
|
+
wait_for(wfid)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_reserve_but_no_name
|
101
|
+
|
102
|
+
pdef = Ruote.process_definition :name => 'test' do
|
103
|
+
concurrence do
|
104
|
+
reserve do
|
105
|
+
alpha
|
106
|
+
end
|
107
|
+
reserve do
|
108
|
+
alpha
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
#noisy
|
114
|
+
|
115
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
116
|
+
|
117
|
+
wfid = @engine.launch(pdef)
|
118
|
+
|
119
|
+
2.times do
|
120
|
+
|
121
|
+
wait_for(:alpha)
|
122
|
+
|
123
|
+
assert_equal 1, alpha.size
|
124
|
+
|
125
|
+
ps = @engine.process(wfid)
|
126
|
+
|
127
|
+
assert_equal 2, ps.variables.size
|
128
|
+
assert_not_nil ps.variables['reserve']
|
129
|
+
|
130
|
+
alpha.proceed(alpha.first)
|
131
|
+
end
|
132
|
+
|
133
|
+
wait_for(wfid)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Sat Sep 20 23:40:10 JST 2008
|
6
|
+
#
|
7
|
+
|
8
|
+
#class String
|
9
|
+
# def empty?
|
10
|
+
# puts '=' * 80
|
11
|
+
# puts caller.join("\n")
|
12
|
+
# return (size == 0)
|
13
|
+
# end
|
14
|
+
#end
|
15
|
+
|
16
|
+
#require 'perftools'
|
17
|
+
#PerfTools::CpuProfiler.start("/tmp/out.profile")
|
18
|
+
|
19
|
+
#def require (o)
|
20
|
+
# p o
|
21
|
+
# Kernel.require(o)
|
22
|
+
#end
|
23
|
+
|
24
|
+
#require 'profile'
|
25
|
+
|
26
|
+
require File.join(File.dirname(__FILE__), 'base')
|
27
|
+
|
28
|
+
|
29
|
+
class EftEchoTest < Test::Unit::TestCase
|
30
|
+
include FunctionalBase
|
31
|
+
|
32
|
+
def test_echo
|
33
|
+
|
34
|
+
pdef = Ruote.process_definition :name => 'test' do
|
35
|
+
echo 'a'
|
36
|
+
end
|
37
|
+
|
38
|
+
#noisy
|
39
|
+
|
40
|
+
assert_trace('a', pdef)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_echo_text
|
44
|
+
|
45
|
+
pdef = Ruote.define do
|
46
|
+
echo :text => 'a'
|
47
|
+
end
|
48
|
+
|
49
|
+
assert_trace('a', pdef)
|
50
|
+
end
|
51
|
+
|
52
|
+
#def test_print_escape
|
53
|
+
# pdef = OpenWFE.process_definition :name => 'test' do
|
54
|
+
# sequence do
|
55
|
+
# set :v => 'toto', :value => 'otot'
|
56
|
+
# echo '${toto}', :escape => 'true'
|
57
|
+
# echo '${toto}', :escape => true
|
58
|
+
# echo :escape => true do
|
59
|
+
# '${toto}'
|
60
|
+
# end
|
61
|
+
# end
|
62
|
+
# end
|
63
|
+
# assert_trace(
|
64
|
+
# pdef,
|
65
|
+
# ([ '${toto}' ] * 3).join("\n"))
|
66
|
+
#end
|
67
|
+
end
|
68
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Mon Aug 3 12:13:11 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class EftSaveTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_save_to_variable
|
17
|
+
|
18
|
+
pdef = Ruote.process_definition :name => 'test' do
|
19
|
+
save :to_variable => 'v'
|
20
|
+
alpha
|
21
|
+
end
|
22
|
+
|
23
|
+
#noisy
|
24
|
+
|
25
|
+
@engine.register_participant :alpha, Ruote::StorageParticipant
|
26
|
+
|
27
|
+
wfid = @engine.launch(pdef)
|
28
|
+
|
29
|
+
wait_for(:alpha)
|
30
|
+
|
31
|
+
ps = @engine.process(wfid)
|
32
|
+
|
33
|
+
assert_equal Hash, ps.variables['v'].class
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_save_to_field
|
37
|
+
|
38
|
+
pdef = Ruote.process_definition :name => 'test' do
|
39
|
+
set :field => 'nada', :value => 'surf'
|
40
|
+
save :to_f => 'f'
|
41
|
+
alpha
|
42
|
+
end
|
43
|
+
|
44
|
+
#noisy
|
45
|
+
|
46
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
47
|
+
|
48
|
+
wfid = @engine.launch(pdef)
|
49
|
+
|
50
|
+
wait_for(:alpha)
|
51
|
+
|
52
|
+
assert_equal 'surf', alpha.first.fields['f']['nada']
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_save_to_field_deep
|
56
|
+
|
57
|
+
pdef = Ruote.process_definition :name => 'test' do
|
58
|
+
set :field => 'nada', :value => 'surf'
|
59
|
+
set :field => 'h', :value => {}
|
60
|
+
save :to_f => 'h.wi_as_before'
|
61
|
+
alpha
|
62
|
+
end
|
63
|
+
|
64
|
+
#noisy
|
65
|
+
|
66
|
+
alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
|
67
|
+
|
68
|
+
wfid = @engine.launch(pdef)
|
69
|
+
|
70
|
+
wait_for(:alpha)
|
71
|
+
|
72
|
+
#p alpha.first.fields
|
73
|
+
assert_equal 'surf', alpha.first.fields['h']['wi_as_before']['nada']
|
74
|
+
end
|
75
|
+
|
76
|
+
# sfo -> fra
|
77
|
+
|
78
|
+
def test_save_to_f # and deep f
|
79
|
+
|
80
|
+
pdef = Ruote.process_definition do
|
81
|
+
set 'f:x' => 'val0'
|
82
|
+
set 'f:h' => {}
|
83
|
+
save :to => 'f:h.deep'
|
84
|
+
save :to => 'f:a'
|
85
|
+
end
|
86
|
+
|
87
|
+
#@engine.noisy = true
|
88
|
+
|
89
|
+
wfid = @engine.launch(pdef)
|
90
|
+
fields = @engine.wait_for(wfid)['workitem']['fields']
|
91
|
+
|
92
|
+
assert_equal(
|
93
|
+
{ 'deep' => { 'x' => 'val0', 'h' => {} } },
|
94
|
+
fields['h'])
|
95
|
+
assert_equal(
|
96
|
+
{ 'x' => 'val0', 'h' => { 'deep' => { 'x' => 'val0', 'h' => { } } } },
|
97
|
+
fields['a'])
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_save_to_v
|
101
|
+
|
102
|
+
pdef = Ruote.process_definition do
|
103
|
+
set 'f:x' => 'val0'
|
104
|
+
save :to => 'v:a'
|
105
|
+
set 'f:y' => '$v:a'
|
106
|
+
end
|
107
|
+
|
108
|
+
#@engine.noisy = true
|
109
|
+
|
110
|
+
wfid = @engine.launch(pdef)
|
111
|
+
fields = @engine.wait_for(wfid)['workitem']['fields']
|
112
|
+
|
113
|
+
assert_equal({ 'x' => 'val0' }, fields['y'])
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Tue Aug 4 08:53:33 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class EftRestoreTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_save_to_variable
|
15
|
+
|
16
|
+
pdef = Ruote.process_definition :name => 'test' do
|
17
|
+
sequence do
|
18
|
+
set :field => 'nada', :value => 'surf'
|
19
|
+
save :to_variable => 'v'
|
20
|
+
unset :field => 'nada'
|
21
|
+
echo '-${f:nada}-'
|
22
|
+
restore :from_variable => 'v'
|
23
|
+
echo '-${f:nada}-'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#noisy
|
28
|
+
|
29
|
+
assert_trace %w[ -- -surf- ], pdef
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_set_fields
|
33
|
+
|
34
|
+
pdef = Ruote.process_definition :name => 'test' do
|
35
|
+
sequence do
|
36
|
+
set_fields :val => { 'a' => 'A', 'b' => 'B' }
|
37
|
+
echo '-${f:a}-'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
#noisy
|
42
|
+
|
43
|
+
assert_trace '-A-', pdef
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_set_fields_deep
|
47
|
+
|
48
|
+
pdef = Ruote.process_definition :name => 'test' do
|
49
|
+
sequence do
|
50
|
+
set :f => 'h', :val => {}
|
51
|
+
set_fields :val => { 'a' => 'A', 'b' => 'B' }, :to => 'h.hh'
|
52
|
+
echo '-${f:h.hh.b}-'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
#noisy
|
57
|
+
|
58
|
+
assert_trace '-B-', pdef
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Sun Aug 16 20:46:13 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class EftNoOpTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_no_operation
|
15
|
+
|
16
|
+
pdef = Ruote.process_definition :name => 'test' do
|
17
|
+
sequence do
|
18
|
+
noop
|
19
|
+
echo 'done.'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#noisy
|
24
|
+
|
25
|
+
assert_trace('done.', pdef)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,168 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Thu Aug 20 13:21:54 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class EftApplyTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_empty_apply
|
15
|
+
|
16
|
+
pdef = Ruote.process_definition :name => 'test' do
|
17
|
+
sequence do
|
18
|
+
echo 'in'
|
19
|
+
apply
|
20
|
+
echo 'out.'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
#noisy
|
25
|
+
|
26
|
+
assert_trace(%w[ in out. ], pdef)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_apply_tree
|
30
|
+
|
31
|
+
pdef = Ruote.process_definition :name => 'test' do
|
32
|
+
apply :tree => [ 'echo', { 'nada' => nil }, [] ]
|
33
|
+
end
|
34
|
+
|
35
|
+
#noisy
|
36
|
+
|
37
|
+
assert_trace('nada', pdef)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_apply_default_tree_variable
|
41
|
+
|
42
|
+
pdef = Ruote.process_definition :name => 'test' do
|
43
|
+
sequence do
|
44
|
+
set :var => 'tree', :val => [ 'echo', { 'nada' => nil }, [] ]
|
45
|
+
apply
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
#noisy
|
50
|
+
|
51
|
+
assert_trace('nada', pdef)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_apply_tree_variable
|
55
|
+
|
56
|
+
pdef = Ruote.process_definition :name => 'test' do
|
57
|
+
sequence do
|
58
|
+
set :var => 't', :val => [ 'echo', { 'nada' => nil }, [] ]
|
59
|
+
apply :tree_var => 't'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#noisy
|
64
|
+
|
65
|
+
assert_trace('nada', pdef)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_apply_tree_field
|
69
|
+
|
70
|
+
pdef = Ruote.process_definition :name => 'test' do
|
71
|
+
sequence do
|
72
|
+
set :field => 't', :val => [ 'echo', { 'nada' => nil }, [] ]
|
73
|
+
#apply :tree_field => 't'
|
74
|
+
apply :tree_f => 't'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
#noisy
|
79
|
+
|
80
|
+
assert_trace('nada', pdef)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_apply_attributes_as_variables
|
84
|
+
|
85
|
+
pdef = Ruote.process_definition :name => 'test' do
|
86
|
+
apply :tree => [ 'echo', { 'a:${v:a}' => nil }, [] ], :a => 'surf'
|
87
|
+
end
|
88
|
+
|
89
|
+
#noisy
|
90
|
+
|
91
|
+
assert_trace('a:surf', pdef)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_apply_default_with_attributes_as_variables
|
95
|
+
|
96
|
+
pdef = Ruote.process_definition :name => 'test' do
|
97
|
+
sequence do
|
98
|
+
set :var => 'tree', :val => [ 'echo', { 'a:${v:a}' => nil }, [] ], :escape => true
|
99
|
+
apply
|
100
|
+
apply :a => 'surf'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
#noisy
|
105
|
+
|
106
|
+
assert_trace(%w[ a: a:surf ], pdef)
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_apply_within_subprocess
|
110
|
+
|
111
|
+
pdef = Ruote.process_definition 'test' do
|
112
|
+
sub0 do
|
113
|
+
echo 'nada'
|
114
|
+
end
|
115
|
+
define 'sub0' do
|
116
|
+
sequence do
|
117
|
+
apply
|
118
|
+
apply
|
119
|
+
apply
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
#noisy
|
125
|
+
|
126
|
+
assert_trace(%w[ nada ] * 3, pdef)
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_apply_within_subprocess_2
|
130
|
+
|
131
|
+
pdef = Ruote.process_definition 'test' do
|
132
|
+
subprocess :ref => 'sub0' do
|
133
|
+
echo 'nada'
|
134
|
+
end
|
135
|
+
define 'sub0' do
|
136
|
+
apply
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
#noisy
|
141
|
+
|
142
|
+
assert_trace('nada', pdef)
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_apply_on_error
|
146
|
+
|
147
|
+
pdef = Ruote.process_definition do
|
148
|
+
handle do
|
149
|
+
sequence do
|
150
|
+
echo 'in'
|
151
|
+
nemo
|
152
|
+
end
|
153
|
+
end
|
154
|
+
define 'handle' do
|
155
|
+
apply :on_error => 'notify'
|
156
|
+
echo 'over.'
|
157
|
+
end
|
158
|
+
define 'notify' do
|
159
|
+
echo 'error'
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
#noisy
|
164
|
+
|
165
|
+
assert_trace(%w[ in error over. ], pdef)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|