test/functional/ft_18_kill.rb in ruote-2.2.0 vs test/functional/ft_18_kill.rb in ruote-2.3.0
- old
+ new
@@ -3,11 +3,11 @@
# testing ruote
#
# Sun Jul 5 22:56:06 JST 2009
#
-require File.join(File.dirname(__FILE__), 'base')
+require File.expand_path('../base', __FILE__)
class FtKillTest < Test::Unit::TestCase
include FunctionalBase
@@ -15,44 +15,57 @@
pdef = Ruote.process_definition do
alpha
end
- alpha = @engine.register_participant :alpha, Ruote::StorageParticipant
+ alpha = @dashboard.register_participant :alpha, Ruote::StorageParticipant
#noisy
- wfid = @engine.launch(pdef)
+ wfid = @dashboard.launch(pdef)
wait_for(:alpha)
- @engine.kill_process(wfid)
+ @dashboard.kill_process(wfid)
wait_for(wfid)
- ps = @engine.process(wfid)
+ ps = @dashboard.process(wfid)
assert_nil ps
assert_equal 0, alpha.size
assert_equal(
- 1, logger.log.select { |e| e['action'] == 'kill_process' }.size)
+ 1,
+ logger.log.select { |e|
+ e['action'] == 'cancel_process' &&
+ e['flavour'] == 'kill'
+ }.size)
end
+ def test_kill_process_with_source
+
+ @dashboard.kill('20111121-nada', :source => 'y')
+
+ @dashboard.wait_for(1)
+
+ assert_equal 'y', @dashboard.context.logger.log.first['source']
+ end
+
def test_kill_does_not_trigger_on_cancel
pdef = Ruote.process_definition do
sequence :on_cancel => 'catcher' do
alpha
end
end
- @engine.register_participant :alpha, Ruote::StorageParticipant
- sto = @engine.register_participant :catcher, Ruote::StorageParticipant
+ @dashboard.register_participant :alpha, Ruote::StorageParticipant
+ sto = @dashboard.register_participant :catcher, Ruote::StorageParticipant
- wfid = @engine.launch(pdef)
+ wfid = @dashboard.launch(pdef)
wait_for(:alpha)
- @engine.kill_process(wfid)
+ @dashboard.kill_process(wfid)
wait_for(wfid)
assert_equal 0, sto.size
end
@@ -63,17 +76,17 @@
sequence :on_cancel => 'catcher' do
alpha
end
end
- @engine.register_participant :alpha, Ruote::StorageParticipant
- sto = @engine.register_participant :catcher, Ruote::StorageParticipant
+ @dashboard.register_participant :alpha, Ruote::StorageParticipant
+ sto = @dashboard.register_participant :catcher, Ruote::StorageParticipant
- wfid = @engine.launch(pdef)
+ wfid = @dashboard.launch(pdef)
wait_for(:alpha)
- @engine.kill_expression(sto.first.fei)
+ @dashboard.kill_expression(sto.first.fei)
wait_for(wfid)
assert_equal 0, sto.size
end
@@ -82,25 +95,30 @@
pdef = Ruote.process_definition do
alpha
end
- @engine.register_participant :alpha, Ruote::NullParticipant
+ @dashboard.register_participant :alpha, Ruote::NullParticipant
#noisy
- wfid = @engine.launch(pdef)
+ wfid = @dashboard.launch(pdef)
- @engine.wait_for(:alpha)
+ @dashboard.wait_for(:alpha)
- @engine.kill(wfid)
+ @dashboard.kill(wfid)
- @engine.wait_for(wfid)
+ @dashboard.wait_for(wfid)
- assert_nil @engine.process(wfid)
+ assert_nil @dashboard.process(wfid)
- assert_equal 1, logger.log.select { |e| e['action'] == 'kill_process' }.size
+ assert_equal(
+ 1,
+ logger.log.select { |e|
+ e['action'] == 'cancel_process' &&
+ e['flavour'] == 'kill'
+ }.size)
end
def test_kill__process
pdef = Ruote.process_definition do
@@ -110,26 +128,26 @@
echo '1'
alpha
echo '2'
end
- @engine.register_participant :alpha, Ruote::NullParticipant
+ @dashboard.register_participant :alpha, Ruote::NullParticipant
- wfid = @engine.launch(pdef)
+ wfid = @dashboard.launch(pdef)
- r = @engine.wait_for(:alpha)
+ r = @dashboard.wait_for(:alpha)
- @engine.kill(r['fei']) # fei as a Hash
+ @dashboard.kill(r['fei']) # fei as a Hash
- r = @engine.wait_for(:alpha)
+ r = @dashboard.wait_for(:alpha)
- @engine.kill(Ruote.sid(r['fei'])) # fei as a String
+ @dashboard.kill(Ruote.sid(r['fei'])) # fei as a String
- r = @engine.wait_for(:alpha)
+ r = @dashboard.wait_for(:alpha)
- @engine.kill(Ruote::Workitem.new(r['workitem'])) # fei as workitem
+ @dashboard.kill(Ruote::Workitem.new(r['workitem'])) # fei as workitem
- @engine.wait_for(wfid)
+ @dashboard.wait_for(wfid)
assert_equal %w[ 0 1 2 ], @tracer.to_a
assert_equal 6, logger.log.select { |e| e['flavour'] == 'kill' }.size
end