test/functional/eft_30_ref.rb in ruote-2.2.0 vs test/functional/eft_30_ref.rb in ruote-2.3.0

- old
+ new

@@ -3,11 +3,11 @@ # testing ruote # # Tue Jul 20 12:47:36 JST 2010 # -require File.join(File.dirname(__FILE__), 'base') +require File.expand_path('../base', __FILE__) require 'ruote/participant' class EftRefTest < Test::Unit::TestCase @@ -29,11 +29,11 @@ ref :ref => 'alpha' ref 'alpha' echo 'done.' end - @engine.register_participant :alpha, AlphaParticipant + @dashboard.register_participant :alpha, AlphaParticipant #noisy assert_trace %w[ 0_0 0_1 done. ], pdef end @@ -62,27 +62,27 @@ ref 'alpha' end #noisy - wfid = @engine.launch(pdef) + wfid = @dashboard.launch(pdef) - @engine.wait_for(wfid) + @dashboard.wait_for(wfid) - ps = @engine.process(wfid) + ps = @dashboard.process(wfid) assert_equal 1, ps.errors.size # correct problem and replay at error - @engine.register_participant 'alpha', AlphaParticipant + @dashboard.register_participant 'alpha', AlphaParticipant - @engine.replay_at_error(ps.errors.first) + @dashboard.replay_at_error(ps.errors.first) - @engine.wait_for(wfid) + @dashboard.wait_for(wfid) - assert_nil @engine.process(wfid) + assert_nil @dashboard.process(wfid) assert_equal '0_0', @tracer.to_s end def test_missing_subprocess_ref @@ -90,50 +90,50 @@ ref 'alpha' end #noisy - wfid = @engine.launch(pdef) + wfid = @dashboard.launch(pdef) - @engine.wait_for(wfid) + @dashboard.wait_for(wfid) - ps = @engine.process(wfid) + ps = @dashboard.process(wfid) assert_equal 1, ps.errors.size # correct problem and replay at error - @engine.variables['alpha'] = Ruote.process_definition do + @dashboard.variables['alpha'] = Ruote.process_definition do echo 'alpha' end - @engine.replay_at_error(ps.errors.first) + @dashboard.replay_at_error(ps.errors.first) - @engine.wait_for(wfid) + @dashboard.wait_for(wfid) - assert_nil @engine.process(wfid) + assert_nil @dashboard.process(wfid) assert_equal 'alpha', @tracer.to_s end # Making sure that the ref expression forces the triggered subprocess to # consider its timeout. # def test_ref_and_subprocess_timeout - @engine.register_participant :alpha, Ruote::StorageParticipant + @dashboard.register_participant :alpha, Ruote::StorageParticipant pdef = Ruote.process_definition do define 'sub0' do alpha end ref 'sub0', :timeout => '2d' end - wfid = @engine.launch(pdef) - @engine.wait_for(:alpha) + wfid = @dashboard.launch(pdef) + @dashboard.wait_for(:alpha) - scheds = @engine.schedules + scheds = @dashboard.schedules assert_equal 1, scheds.size assert_equal '0_1', scheds.first['target'].expid end @@ -141,15 +141,27 @@ pdef = Ruote.process_definition do ref 'nemo', :on_error => 'undo' end - #noisy + wfid = @dashboard.launch(pdef) - wfid = @engine.launch(pdef) + @dashboard.wait_for(wfid) - @engine.wait_for(wfid) + assert_nil @dashboard.process(wfid) + end - assert_nil @engine.process(wfid) + def test_ref_pointing_to_filter + + @dashboard.variables['needs'] = 'filter' + + pdef = Ruote.process_definition do + needs { x :type => 'string' } + end + + wfid = @dashboard.launch(pdef, 'x' => 'nada') + r = @dashboard.wait_for(wfid) + + assert_equal 'terminated', r['action'] end end