test/functional/ft_21_forget.rb in ruote-2.1.11 vs test/functional/ft_21_forget.rb in ruote-2.2.0

- old
+ new

@@ -5,11 +5,11 @@ # Mon Jul 27 09:17:51 JST 2009 # require File.join(File.dirname(__FILE__), 'base') -require 'ruote/part/storage_participant' +require 'ruote/participant' class FtForgetTest < Test::Unit::TestCase include FunctionalBase @@ -65,8 +65,89 @@ assert_equal fei, ps.root_expression_for(fei).fei #puts "not sure..." #p ps.original_tree #p ps.current_tree + end + + def test_forget_true_string + + pdef = Ruote.process_definition do + concurrence :count => 1 do + alpha :forget => 'true' + bravo + end + charly + end + + @engine.register_participant '.+' do |wi| + @tracer << wi.participant_name + "\n" + end + + wfid = @engine.launch(pdef) + + wait_for(wfid) + wait_for(wfid) + + #assert_equal "alpha\nbravo\ncharly", @tracer.to_s + assert_equal %w[ alpha bravo charly ], @tracer.to_a.sort + end + + def test_forget_and_cursor + + pdef = Ruote.define do + cursor do + alpha :forget => true + bravo + rewind + end + end + + @engine.register_participant 'alpha', Ruote::NullParticipant + # this participant never replies + + @engine.register_participant 'bravo', Ruote::NoOpParticipant + # this one simply replies + + #@engine.noisy = true + + wfid = @engine.launch(pdef) + + @engine.wait_for(:bravo) + @engine.wait_for(:bravo) + + assert_not_nil @engine.process(wfid) + end + + # As reported by Nando Sola + # + # http://groups.google.com/group/openwferu-users/browse_thread/thread/50308e9dce8359e6 + # + def test_forget_on_forget + + pdef = Ruote.define do + concurrence do + listen :to => 'bravo', :upon =>'reply', :wfid => true do + sequence :forget => true do + alpha + end + end + bravo + end + end + + @engine.register do + catchall Ruote::NoOpParticipant + end + + #noisy + + wfid = @engine.launch(pdef) + + @engine.wait_for(wfid) + + assert_equal( + [], + @engine.history.all.select { |e| e['action'] == 'error_intercepted' }) end end