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,51 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Mon Sep 14 19:11:45 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/part/no_op_participant'
|
11
|
+
require 'ruote/part/null_participant'
|
12
|
+
|
13
|
+
|
14
|
+
class FtNullNoopParticipantsTest < Test::Unit::TestCase
|
15
|
+
include FunctionalBase
|
16
|
+
|
17
|
+
def test_null_participant
|
18
|
+
|
19
|
+
pdef = Ruote.process_definition :name => 'def0' do
|
20
|
+
alpha
|
21
|
+
end
|
22
|
+
|
23
|
+
alpha = @engine.register_participant :alpha, Ruote::NullParticipant
|
24
|
+
|
25
|
+
#noisy
|
26
|
+
|
27
|
+
wfid = @engine.launch(pdef)
|
28
|
+
|
29
|
+
wait_for(4)
|
30
|
+
|
31
|
+
ps = @engine.process(wfid)
|
32
|
+
|
33
|
+
assert_not_nil ps
|
34
|
+
assert_equal [], ps.errors
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_noop_participant
|
38
|
+
|
39
|
+
pdef = Ruote.process_definition :name => 'def0' do
|
40
|
+
alpha
|
41
|
+
echo 'done.'
|
42
|
+
end
|
43
|
+
|
44
|
+
@engine.register_participant :alpha, Ruote::NoOpParticipant
|
45
|
+
|
46
|
+
#noisy
|
47
|
+
|
48
|
+
assert_trace "done.", pdef
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Mon Sep 14 19:31:37 JST 2009
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
require 'ruote/part/template'
|
12
|
+
|
13
|
+
|
14
|
+
class FtPartTemplateTest < Test::Unit::TestCase
|
15
|
+
include FunctionalBase
|
16
|
+
|
17
|
+
class MyParticipant
|
18
|
+
include Ruote::LocalParticipant
|
19
|
+
include Ruote::TemplateMixin
|
20
|
+
|
21
|
+
def initialize(opts)
|
22
|
+
|
23
|
+
@template = opts['template']
|
24
|
+
end
|
25
|
+
|
26
|
+
def consume(workitem)
|
27
|
+
|
28
|
+
@context['s_tracer'] << render_template(
|
29
|
+
@template,
|
30
|
+
Ruote::Exp::FlowExpression.fetch(@context, workitem.fei.to_h),
|
31
|
+
workitem)
|
32
|
+
@context['s_tracer'] << "\n"
|
33
|
+
|
34
|
+
reply_to_engine(workitem)
|
35
|
+
end
|
36
|
+
|
37
|
+
def cancel(fei, flavour)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_template
|
42
|
+
|
43
|
+
pdef = Ruote.process_definition :name => 'def0' do
|
44
|
+
set 'v:var0' => 'v_value'
|
45
|
+
set 'f:field0' => 'f_value'
|
46
|
+
alpha
|
47
|
+
echo 'done.'
|
48
|
+
end
|
49
|
+
|
50
|
+
#noisy
|
51
|
+
|
52
|
+
@engine.register_participant(
|
53
|
+
:alpha,
|
54
|
+
MyParticipant,
|
55
|
+
:template => "0:${v:var0}\n1:${f:field0}")
|
56
|
+
|
57
|
+
assert_trace %w[ 0:v_value 1:f_value done. ], pdef
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,380 @@
|
|
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/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtErrorsTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_error
|
17
|
+
|
18
|
+
pdef = Ruote.process_definition do
|
19
|
+
nada
|
20
|
+
end
|
21
|
+
|
22
|
+
wfid = @engine.launch(pdef)
|
23
|
+
wait_for(wfid)
|
24
|
+
|
25
|
+
ps = @engine.process(wfid)
|
26
|
+
|
27
|
+
assert_equal 1, ps.errors.size
|
28
|
+
|
29
|
+
pss = @engine.processes
|
30
|
+
|
31
|
+
assert_equal 1, pss.size
|
32
|
+
assert_equal 1, pss.first.errors.size
|
33
|
+
end
|
34
|
+
|
35
|
+
# asm and jpr5 use that sometimes
|
36
|
+
#
|
37
|
+
def test_error_reapply
|
38
|
+
|
39
|
+
pdef = Ruote.process_definition do
|
40
|
+
nada
|
41
|
+
end
|
42
|
+
|
43
|
+
#noisy
|
44
|
+
|
45
|
+
wfid = @engine.launch(pdef)
|
46
|
+
wait_for(wfid)
|
47
|
+
|
48
|
+
ps = @engine.process(wfid)
|
49
|
+
|
50
|
+
exp = ps.expressions.find { |fe| fe.class == Ruote::Exp::RefExpression }
|
51
|
+
|
52
|
+
assert_not_nil exp
|
53
|
+
|
54
|
+
@engine.register_participant :nada do |workitem|
|
55
|
+
@tracer << 'done.'
|
56
|
+
end
|
57
|
+
|
58
|
+
@engine.re_apply(exp.fei)
|
59
|
+
wait_for(wfid)
|
60
|
+
|
61
|
+
assert_equal 'done.', @tracer.to_s
|
62
|
+
|
63
|
+
assert_equal 0, @engine.storage.get_many('errors').size
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_error_replay
|
67
|
+
|
68
|
+
pdef = Ruote.process_definition do
|
69
|
+
nada
|
70
|
+
end
|
71
|
+
|
72
|
+
#noisy
|
73
|
+
|
74
|
+
wfid = @engine.launch(pdef)
|
75
|
+
wait_for(wfid)
|
76
|
+
|
77
|
+
ps = @engine.process(wfid)
|
78
|
+
|
79
|
+
err = ps.errors.first
|
80
|
+
|
81
|
+
@engine.replay_at_error(err)
|
82
|
+
|
83
|
+
wait_for(wfid)
|
84
|
+
ps = @engine.process(wfid)
|
85
|
+
|
86
|
+
#p ps
|
87
|
+
|
88
|
+
assert_equal 1, ps.errors.size
|
89
|
+
# only one error
|
90
|
+
|
91
|
+
err1 = ps.errors.first
|
92
|
+
|
93
|
+
assert_not_equal err.at, err1.at
|
94
|
+
# not the same error
|
95
|
+
|
96
|
+
assert_equal 1, @engine.storage.get_many('errors').size
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_error_fix_then_replay
|
100
|
+
|
101
|
+
pdef = Ruote.process_definition do
|
102
|
+
nada
|
103
|
+
end
|
104
|
+
|
105
|
+
@engine.register_participant :alpha do
|
106
|
+
@tracer << "alpha\n"
|
107
|
+
end
|
108
|
+
|
109
|
+
#noisy
|
110
|
+
|
111
|
+
wfid = @engine.launch(pdef)
|
112
|
+
wait_for(wfid)
|
113
|
+
ps = @engine.process(wfid)
|
114
|
+
|
115
|
+
err = ps.errors.first
|
116
|
+
assert_equal [ 'nada', { 'ref' => 'nada' }, [] ], err.tree
|
117
|
+
|
118
|
+
err.tree = [ 'alpha', {}, [] ]
|
119
|
+
@engine.replay_at_error(err)
|
120
|
+
wait_for(wfid)
|
121
|
+
|
122
|
+
assert_nil @engine.process(wfid)
|
123
|
+
|
124
|
+
assert_equal 'alpha', @tracer.to_s
|
125
|
+
|
126
|
+
# check if error is really gone from error journal...
|
127
|
+
|
128
|
+
assert_equal [], @engine.storage.get_many('errors')
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_error_in_participant
|
132
|
+
|
133
|
+
pdef = Ruote.process_definition do
|
134
|
+
sequence do
|
135
|
+
alpha
|
136
|
+
echo 'done.'
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
@engine.context.stash[:count] = 0
|
141
|
+
|
142
|
+
@engine.register_participant :alpha do
|
143
|
+
stash[:count] += 1
|
144
|
+
@tracer << "alpha\n"
|
145
|
+
raise "something went wrong" if stash[:count] == 1
|
146
|
+
end
|
147
|
+
|
148
|
+
#noisy
|
149
|
+
|
150
|
+
wfid = @engine.launch(pdef)
|
151
|
+
|
152
|
+
wait_for(wfid)
|
153
|
+
|
154
|
+
sleep 0.250 # grrr...
|
155
|
+
|
156
|
+
ps = @engine.process(wfid)
|
157
|
+
|
158
|
+
assert_equal 1, ps.errors.size
|
159
|
+
|
160
|
+
@engine.replay_at_error(ps.errors.first)
|
161
|
+
|
162
|
+
wait_for(wfid)
|
163
|
+
|
164
|
+
assert_equal %w[ alpha alpha done. ].join("\n"), @tracer.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_error_in_do_no_thread_participant
|
168
|
+
|
169
|
+
pdef = Ruote.process_definition do
|
170
|
+
sequence do
|
171
|
+
alpha
|
172
|
+
echo 'done.'
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
@engine.context.stash[:count] = 0
|
177
|
+
|
178
|
+
alpha = @engine.register_participant :alpha, 'do_not_thread' => true do
|
179
|
+
stash[:count] += 1
|
180
|
+
@tracer << "alpha\n"
|
181
|
+
raise "something went wrong" if stash[:count] == 1
|
182
|
+
end
|
183
|
+
|
184
|
+
#noisy
|
185
|
+
|
186
|
+
wfid = @engine.launch(pdef)
|
187
|
+
|
188
|
+
wait_for(wfid)
|
189
|
+
|
190
|
+
ps = @engine.process(wfid)
|
191
|
+
|
192
|
+
assert_equal 1, ps.errors.size
|
193
|
+
|
194
|
+
@engine.replay_at_error(ps.errors.first)
|
195
|
+
|
196
|
+
wait_for(wfid)
|
197
|
+
|
198
|
+
assert_equal %w[ alpha alpha done. ].join("\n"), @tracer.to_s
|
199
|
+
end
|
200
|
+
|
201
|
+
class WeakCancelParticipant
|
202
|
+
include Ruote::LocalParticipant
|
203
|
+
|
204
|
+
def initialize(opts)
|
205
|
+
end
|
206
|
+
def consume(workitem)
|
207
|
+
# losing it
|
208
|
+
end
|
209
|
+
def do_not_thread
|
210
|
+
true
|
211
|
+
end
|
212
|
+
def cancel(fei, flavour)
|
213
|
+
raise "failure in #cancel"
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def test_error_in_participant_cancel
|
218
|
+
|
219
|
+
pdef = Ruote.process_definition do
|
220
|
+
alpha
|
221
|
+
end
|
222
|
+
|
223
|
+
@engine.register_participant 'alpha', WeakCancelParticipant
|
224
|
+
|
225
|
+
#noisy
|
226
|
+
|
227
|
+
wfid = @engine.launch(pdef)
|
228
|
+
|
229
|
+
wait_for(:alpha)
|
230
|
+
|
231
|
+
@engine.cancel_process(wfid)
|
232
|
+
|
233
|
+
wait_for(wfid)
|
234
|
+
|
235
|
+
ps = @engine.process(wfid)
|
236
|
+
|
237
|
+
#puts ps.errors.first.trace
|
238
|
+
assert_equal 1, ps.errors.size
|
239
|
+
assert_equal 2, ps.expressions.size
|
240
|
+
|
241
|
+
@engine.kill_process(wfid)
|
242
|
+
|
243
|
+
wait_for(wfid)
|
244
|
+
|
245
|
+
assert_nil @engine.process(wfid)
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_errors_and_subprocesses
|
249
|
+
|
250
|
+
pdef = Ruote.process_definition do
|
251
|
+
sequence do
|
252
|
+
sub0
|
253
|
+
echo 'done.'
|
254
|
+
end
|
255
|
+
define 'sub0' do
|
256
|
+
alpha
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
@engine.context.stash[:count] = 0
|
261
|
+
|
262
|
+
alpha = @engine.register_participant :alpha, :do_not_thread => true do
|
263
|
+
stash[:count] += 1
|
264
|
+
@tracer << "alpha\n"
|
265
|
+
raise "something went wrong" if stash[:count] == 1
|
266
|
+
end
|
267
|
+
|
268
|
+
#noisy
|
269
|
+
|
270
|
+
wfid = @engine.launch(pdef)
|
271
|
+
|
272
|
+
wait_for(wfid)
|
273
|
+
|
274
|
+
ps = @engine.process(wfid)
|
275
|
+
|
276
|
+
assert_equal 1, ps.errors.size
|
277
|
+
|
278
|
+
err = ps.errors.first
|
279
|
+
|
280
|
+
assert_equal wfid, err.fei.wfid
|
281
|
+
assert_not_nil err.fei.subid
|
282
|
+
|
283
|
+
@engine.replay_at_error(err)
|
284
|
+
|
285
|
+
wait_for(wfid)
|
286
|
+
|
287
|
+
assert_equal %w[ alpha alpha done. ].join("\n"), @tracer.to_s
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_process_cancellation
|
291
|
+
|
292
|
+
pdef = Ruote.process_definition do
|
293
|
+
nada
|
294
|
+
end
|
295
|
+
|
296
|
+
#noisy
|
297
|
+
|
298
|
+
wfid = @engine.launch(pdef)
|
299
|
+
|
300
|
+
wait_for(wfid)
|
301
|
+
|
302
|
+
assert_equal 1, @engine.process(wfid).errors.size
|
303
|
+
|
304
|
+
@engine.cancel_process(wfid)
|
305
|
+
|
306
|
+
wait_for(wfid)
|
307
|
+
|
308
|
+
assert_nil @engine.process(wfid)
|
309
|
+
assert_equal [], @engine.storage.get_many('errors')
|
310
|
+
end
|
311
|
+
|
312
|
+
def test_forgotten_subprocess
|
313
|
+
|
314
|
+
pdef = Ruote.process_definition do
|
315
|
+
sequence do
|
316
|
+
sub0 :forget => true
|
317
|
+
echo 'done.'
|
318
|
+
end
|
319
|
+
define 'sub0' do
|
320
|
+
error 'broken wing'
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
wfid = @engine.launch(pdef)
|
325
|
+
wait_for(wfid)
|
326
|
+
wait_for(wfid)
|
327
|
+
|
328
|
+
assert_equal 'done.', @tracer.to_s
|
329
|
+
|
330
|
+
ps = @engine.process(wfid)
|
331
|
+
assert_equal 3, ps.expressions.size
|
332
|
+
assert_equal 1, ps.errors.size
|
333
|
+
|
334
|
+
@engine.replay_at_error(ps.errors.first)
|
335
|
+
wait_for(wfid)
|
336
|
+
|
337
|
+
assert_nil @engine.process(wfid)
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_error_intercepted
|
341
|
+
|
342
|
+
pdef = Ruote.process_definition do
|
343
|
+
nada
|
344
|
+
end
|
345
|
+
|
346
|
+
wfid = @engine.launch(pdef)
|
347
|
+
|
348
|
+
r = @engine.wait_for(wfid)
|
349
|
+
|
350
|
+
assert_equal 'RuntimeError', r['error']['class']
|
351
|
+
assert_equal "unknown participant or subprocess 'nada'", r['error']['message']
|
352
|
+
assert_equal Array, r['error']['trace'].class
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_replay_at_error_fei
|
356
|
+
|
357
|
+
#@engine.noisy = true
|
358
|
+
|
359
|
+
@engine.register { catchall }
|
360
|
+
|
361
|
+
wfid = @engine.launch(Ruote.define do
|
362
|
+
error 'alpha'
|
363
|
+
error 'bravo'
|
364
|
+
end)
|
365
|
+
|
366
|
+
@engine.wait_for(wfid)
|
367
|
+
|
368
|
+
err = @engine.ps(wfid).errors.first
|
369
|
+
assert_match /alpha/, err.message
|
370
|
+
fei = err.fei
|
371
|
+
|
372
|
+
@engine.replay_at_error(fei)
|
373
|
+
|
374
|
+
@engine.wait_for(wfid)
|
375
|
+
|
376
|
+
err = @engine.ps(wfid).errors.first
|
377
|
+
assert_match /bravo/, err.message
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|