ruote-maestrodev 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,62 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Tue Apr 20 12:32:44 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/part/storage_participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtWaitLoggerTest < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
|
17
|
+
@engine.shutdown
|
18
|
+
@engine.context.storage.purge!
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_wait_logger
|
22
|
+
|
23
|
+
@engine = Ruote::Engine.new(Ruote::Worker.new(determine_storage({})))
|
24
|
+
|
25
|
+
sp = @engine.register_participant :alpha, Ruote::StorageParticipant
|
26
|
+
|
27
|
+
pdef = Ruote.process_definition { alpha }
|
28
|
+
|
29
|
+
wfid = @engine.launch(pdef)
|
30
|
+
|
31
|
+
r = @engine.wait_for(:alpha)
|
32
|
+
assert_equal 'dispatch', r['action']
|
33
|
+
|
34
|
+
sp.proceed(sp.first)
|
35
|
+
|
36
|
+
r = @engine.wait_for(wfid)
|
37
|
+
|
38
|
+
assert_equal 'terminated', r['action']
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_wait_logger_seen
|
42
|
+
|
43
|
+
@engine = Ruote::Engine.new(Ruote::Worker.new(determine_storage({})))
|
44
|
+
|
45
|
+
#@engine.noisy = true
|
46
|
+
|
47
|
+
pdef = Ruote.process_definition { }
|
48
|
+
|
49
|
+
wfid = @engine.launch(pdef)
|
50
|
+
|
51
|
+
sleep 0.500
|
52
|
+
sleep 2.000 if @engine.storage.class.name.match(/Couch/)
|
53
|
+
|
54
|
+
assert_equal 2, @engine.context.logger.instance_variable_get(:@seen).size
|
55
|
+
|
56
|
+
r = @engine.wait_for(wfid)
|
57
|
+
|
58
|
+
assert_equal 'terminated', r['action']
|
59
|
+
assert_equal 0, @engine.context.logger.instance_variable_get(:@seen).size
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Mon Jun 14 12:02:53 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/part/local_participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtParticipantsTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
class MyParticipant
|
17
|
+
include Ruote::LocalParticipant
|
18
|
+
def consume(workitem)
|
19
|
+
workitem.fields['seen'] = true
|
20
|
+
reply_to_engine(workitem)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class MyMessageParticipant
|
25
|
+
include Ruote::LocalParticipant
|
26
|
+
def initialize(opts)
|
27
|
+
@opts = opts
|
28
|
+
end
|
29
|
+
def consume(workitem)
|
30
|
+
workitem.fields['message'] = @opts['message']
|
31
|
+
reply_to_engine(workitem)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_participant_without_initialize
|
36
|
+
|
37
|
+
@engine.register_participant :alpha, MyParticipant
|
38
|
+
|
39
|
+
#noisy
|
40
|
+
|
41
|
+
wfid = @engine.launch(Ruote.process_definition do
|
42
|
+
alpha
|
43
|
+
end)
|
44
|
+
|
45
|
+
r = wait_for(wfid)
|
46
|
+
|
47
|
+
assert_equal true, r['workitem']['fields']['seen']
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_participant_with_initialize
|
51
|
+
|
52
|
+
@engine.register_participant :bravo, MyMessageParticipant, 'message' => 'hi'
|
53
|
+
|
54
|
+
#noisy
|
55
|
+
|
56
|
+
wfid = @engine.launch(Ruote.process_definition do
|
57
|
+
bravo
|
58
|
+
end)
|
59
|
+
|
60
|
+
r = wait_for(wfid)
|
61
|
+
|
62
|
+
assert_equal 'hi', r['workitem']['fields']['message']
|
63
|
+
end
|
64
|
+
|
65
|
+
class MyOtherParticipant
|
66
|
+
include Ruote::LocalParticipant
|
67
|
+
def consume(wi)
|
68
|
+
wi.fields['hello'] = 'kitty'
|
69
|
+
reply_to_engine(wi)
|
70
|
+
end
|
71
|
+
def on_reply(wi)
|
72
|
+
@context.tracer << wi.fields['hello'] + "\n"
|
73
|
+
@context.tracer << applied_workitem(wi.fei).fields['hello'] + "\n"
|
74
|
+
@context.tracer << workitem(wi.fei).fields['hello']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_workitem_method
|
79
|
+
|
80
|
+
@engine.register 'alpha', MyOtherParticipant
|
81
|
+
|
82
|
+
#noisy
|
83
|
+
|
84
|
+
wfid = @engine.launch(Ruote.define { alpha }, 'hello' => 'world')
|
85
|
+
|
86
|
+
@engine.wait_for(wfid)
|
87
|
+
|
88
|
+
assert_equal %w[ kitty world world ], @tracer.to_a
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Tue Jun 15 09:07:58 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/part/storage_participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtStorageCopyTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_copy_to_hash_storage
|
17
|
+
|
18
|
+
@engine.register_participant '.+', Ruote::StorageParticipant
|
19
|
+
|
20
|
+
#noisy
|
21
|
+
|
22
|
+
wfid = @engine.launch(Ruote.process_definition do
|
23
|
+
sequence do
|
24
|
+
alpha :timeout => '2d'
|
25
|
+
end
|
26
|
+
end)
|
27
|
+
|
28
|
+
wait_for(:alpha)
|
29
|
+
|
30
|
+
sleep 0.100 # making sure msgs have all been processed
|
31
|
+
|
32
|
+
target = Ruote::HashStorage.new
|
33
|
+
source = @engine.context.storage
|
34
|
+
|
35
|
+
#count = source.copy_to(target, :verbose => true)
|
36
|
+
count = source.copy_to(target)
|
37
|
+
|
38
|
+
assert_equal 8, count
|
39
|
+
assert_equal source.ids('expressions'), target.ids('expressions')
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_copy_from_hash_storage
|
43
|
+
|
44
|
+
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new()))
|
45
|
+
|
46
|
+
engine.register_participant '.+', Ruote::StorageParticipant
|
47
|
+
|
48
|
+
#engine.context.logger.noisy = true
|
49
|
+
|
50
|
+
wfid = engine.launch(Ruote.process_definition do
|
51
|
+
sequence do
|
52
|
+
alpha :timeout => '2d'
|
53
|
+
end
|
54
|
+
end)
|
55
|
+
|
56
|
+
engine.wait_for(:alpha)
|
57
|
+
|
58
|
+
sleep 0.100 # making sure msgs have all been processed
|
59
|
+
|
60
|
+
source = engine.context.storage
|
61
|
+
target = @engine.context.storage
|
62
|
+
|
63
|
+
#count = source.copy_to(target, :verbose => true)
|
64
|
+
count = source.copy_to(target)
|
65
|
+
|
66
|
+
assert_equal 8, count
|
67
|
+
assert_equal source.ids('expressions'), target.ids('expressions')
|
68
|
+
assert_not_nil @engine.process(wfid)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Thu Apr 22 14:41:38 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/part/local_participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtParticipantOnReplyTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
class MyParticipant
|
17
|
+
include Ruote::LocalParticipant
|
18
|
+
def initialize(opts)
|
19
|
+
end
|
20
|
+
def consume(workitem)
|
21
|
+
reply(workitem)
|
22
|
+
end
|
23
|
+
def on_reply(workitem)
|
24
|
+
workitem.fields['message'] = 'hello'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_participant_on_reply
|
29
|
+
|
30
|
+
pdef = Ruote.process_definition do
|
31
|
+
sequence do
|
32
|
+
alpha
|
33
|
+
echo '${f:message}'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
@engine.register_participant :alpha, MyParticipant
|
38
|
+
|
39
|
+
#noisy
|
40
|
+
|
41
|
+
assert_trace('hello', pdef)
|
42
|
+
end
|
43
|
+
|
44
|
+
class AwkwardParticipant
|
45
|
+
include Ruote::LocalParticipant
|
46
|
+
def initialize(opts)
|
47
|
+
end
|
48
|
+
def consume(workitem)
|
49
|
+
reply(workitem)
|
50
|
+
end
|
51
|
+
def on_reply(workitem)
|
52
|
+
return if workitem.fields['pass']
|
53
|
+
raise "something went wrong"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_participant_on_reply_error
|
58
|
+
|
59
|
+
pdef = Ruote.process_definition do
|
60
|
+
sequence do
|
61
|
+
alpha
|
62
|
+
echo 'over.'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
@engine.register_participant :alpha, AwkwardParticipant
|
67
|
+
|
68
|
+
#noisy
|
69
|
+
|
70
|
+
wfid = @engine.launch(pdef)
|
71
|
+
|
72
|
+
wait_for(wfid)
|
73
|
+
|
74
|
+
ps = @engine.process(wfid)
|
75
|
+
|
76
|
+
assert_equal 1, ps.errors.size
|
77
|
+
|
78
|
+
err = ps.errors.first
|
79
|
+
err.fields['pass'] = true
|
80
|
+
@engine.replay_at_error(err)
|
81
|
+
|
82
|
+
wait_for(wfid)
|
83
|
+
|
84
|
+
assert_equal 'over.', @tracer.to_s
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Wed Jul 14 09:43:58 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtVarParticipantTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
def test_var_participant
|
17
|
+
|
18
|
+
pdef = Ruote.process_definition do
|
19
|
+
sequence do
|
20
|
+
set 'v:alpha' => [ 'Ruote::StorageParticipant', {} ]
|
21
|
+
alpha
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
#noisy
|
26
|
+
|
27
|
+
wfid = @engine.launch(pdef)
|
28
|
+
|
29
|
+
@engine.wait_for(:alpha)
|
30
|
+
|
31
|
+
assert_equal 1, @engine.storage_participant.size
|
32
|
+
assert_equal 'alpha', @engine.storage_participant.first.participant_name
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Wed Jul 21 13:37:59 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
require 'ruote/part/local_participant'
|
11
|
+
|
12
|
+
|
13
|
+
class FtParticipantAcceptTest < Test::Unit::TestCase
|
14
|
+
include FunctionalBase
|
15
|
+
|
16
|
+
class MyParticipant
|
17
|
+
include Ruote::LocalParticipant
|
18
|
+
|
19
|
+
def initialize(opts)
|
20
|
+
@opts = opts
|
21
|
+
end
|
22
|
+
|
23
|
+
def accept?(workitem)
|
24
|
+
workitem.participant_name.match(@opts['filter'] || '.?')
|
25
|
+
end
|
26
|
+
|
27
|
+
def consume(workitem)
|
28
|
+
@context.tracer << 'filtered:'
|
29
|
+
@context.tracer << workitem.participant_name
|
30
|
+
@context.tracer << "\n"
|
31
|
+
reply(workitem)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class MyOtherParticipant
|
36
|
+
include Ruote::LocalParticipant
|
37
|
+
|
38
|
+
def consume(workitem)
|
39
|
+
@context.tracer << workitem.participant_name
|
40
|
+
@context.tracer << "\n"
|
41
|
+
reply(workitem)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_participant_on_reply
|
46
|
+
|
47
|
+
pdef = Ruote.process_definition do
|
48
|
+
sequence do
|
49
|
+
absolute
|
50
|
+
aberrant
|
51
|
+
aloof
|
52
|
+
nada
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
@engine.register_participant 'a.+', MyParticipant, 'filter' => '^ab'
|
57
|
+
@engine.register_participant '.+', MyOtherParticipant
|
58
|
+
|
59
|
+
#noisy
|
60
|
+
|
61
|
+
assert_trace %w[ filtered:absolute filtered:aberrant aloof nada ], pdef
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing ruote
|
4
|
+
#
|
5
|
+
# Sat Sep 25 23:24:16 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class FtLaunchSingleTest < Test::Unit::TestCase
|
12
|
+
include FunctionalBase
|
13
|
+
|
14
|
+
def test_no_name_singles_are_rejected
|
15
|
+
|
16
|
+
assert_raise ArgumentError do
|
17
|
+
@engine.launch_single(Ruote.process_definition do
|
18
|
+
wait '2y'
|
19
|
+
echo 'over.'
|
20
|
+
end)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_launch_single
|
25
|
+
|
26
|
+
pdef = Ruote.process_definition 'unique_process' do
|
27
|
+
wait '2y'
|
28
|
+
echo 'over.'
|
29
|
+
end
|
30
|
+
|
31
|
+
#noisy
|
32
|
+
|
33
|
+
wfid = @engine.launch_single(pdef)
|
34
|
+
|
35
|
+
assert_equal(
|
36
|
+
wfid,
|
37
|
+
@engine.storage.get('variables', 'singles')['h']['unique_process'].first)
|
38
|
+
|
39
|
+
@engine.wait_for(2)
|
40
|
+
|
41
|
+
assert_not_nil @engine.process(wfid)
|
42
|
+
|
43
|
+
wfid1 = @engine.launch_single(pdef)
|
44
|
+
|
45
|
+
sleep 1
|
46
|
+
|
47
|
+
assert_equal wfid, wfid1
|
48
|
+
assert_equal 1, @engine.processes.size
|
49
|
+
end
|
50
|
+
|
51
|
+
# Fighting the issue reported by Gonzalo in
|
52
|
+
# http://groups.google.com/group/openwferu-users/browse_thread/thread/fa9c8b414f355f79
|
53
|
+
#
|
54
|
+
def test_launch_single_cancel_launch_single
|
55
|
+
|
56
|
+
pdef = Ruote.process_definition 'unique_process' do
|
57
|
+
wait '2y'
|
58
|
+
echo 'over.'
|
59
|
+
end
|
60
|
+
|
61
|
+
#noisy
|
62
|
+
|
63
|
+
wfid0 = @engine.launch_single(pdef)
|
64
|
+
|
65
|
+
sleep 0.700
|
66
|
+
assert_not_nil @engine.process(wfid0)
|
67
|
+
|
68
|
+
@engine.cancel(wfid0)
|
69
|
+
|
70
|
+
@engine.wait_for(6)
|
71
|
+
assert_nil @engine.process(wfid0)
|
72
|
+
|
73
|
+
sleep 0.700
|
74
|
+
wfid1 = @engine.launch_single(pdef)
|
75
|
+
|
76
|
+
@engine.wait_for(2)
|
77
|
+
|
78
|
+
assert_not_equal wfid0, wfid1
|
79
|
+
assert_nil @engine.process(wfid0)
|
80
|
+
assert_not_nil @engine.process(wfid1)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|