test/ft_58_ejournal.rb in ruote-0.9.18 vs test/ft_58_ejournal.rb in ruote-0.9.19

- old
+ new

@@ -17,135 +17,138 @@ require 'openwfe/expool/errorjournal' class FlowTest58 < Test::Unit::TestCase - include FlowTestBase + include FlowTestBase - #def teardown - #end + #def teardown + #end - #def setup - #end + #def setup + #end - # - # TEST 0 + # + # TEST 0 - class Test0 < OpenWFE::ProcessDefinition - sequence do - participant :alpha - participant :nada - participant :bravo - end + class Test0 < OpenWFE::ProcessDefinition + sequence do + participant :alpha + participant :nada + participant :bravo end + end - def test_0 + def test_0 - ejournal = @engine.get_error_journal + ejournal = @engine.get_error_journal - @engine.register_participant(:alpha) do |wi| - @tracer << "alpha\n" - end + @engine.register_participant(:alpha) do |wi| + @tracer << "alpha\n" + end - li = OpenWFE::LaunchItem.new Test0 - fei = launch li + li = OpenWFE::LaunchItem.new Test0 + fei = launch li - sleep 0.300 + sleep 0.300 - assert File.exist?("work/ejournal/#{fei.parent_wfid}.ejournal") \ - if @engine.is_a?(OpenWFE::FilePersistedEngine) + assert File.exist?("work/ejournal/#{fei.parent_wfid}.ejournal") \ + if @engine.is_a?(OpenWFE::FilePersistedEngine) - errors = ejournal.get_error_log fei + errors = ejournal.get_error_log fei - #require 'pp'; pp ejournal - #puts "/// error journal of class #{ejournal.class.name}" + #require 'pp'; pp ejournal + #puts "/// error journal of class #{ejournal.class.name}" - assert_equal 1, errors.length + assert_equal 1, errors.length - assert ejournal.has_errors?(fei) - assert ejournal.has_errors?(fei.wfid) + assert ejournal.has_errors?(fei) + assert ejournal.has_errors?(fei.wfid) - # OK, let's fix the root and replay + assert_equal 1, ejournal.get_error_logs.size + assert_equal fei.wfid, ejournal.get_error_logs.keys.first - @engine.register_participant(:nada) do |wi| - @tracer << "nada\n" - end - @engine.register_participant(:bravo) do |wi| - @tracer << "bravo\n" - end + # OK, let's fix the root and replay - # fix done + @engine.register_participant(:nada) do |wi| + @tracer << "nada\n" + end + @engine.register_participant(:bravo) do |wi| + @tracer << "bravo\n" + end - assert_equal "alpha", @tracer.to_s + # fix done - @engine.replay_at_error errors.first + assert_equal "alpha", @tracer.to_s - sleep 0.300 + @engine.replay_at_error errors.first - assert_equal "alpha\nnada\nbravo", @tracer.to_s + sleep 0.300 - errors = ejournal.get_error_log fei + assert_equal "alpha\nnada\nbravo", @tracer.to_s - assert_equal 0, errors.length + errors = ejournal.get_error_log fei - assert ( ! ejournal.has_errors?(fei)) - end + assert_equal 0, errors.length - # - # TEST 1 + assert ( ! ejournal.has_errors?(fei)) + end - # Testing that the changes to the workitem are taken into account + # + # TEST 1 - class Test1 < OpenWFE::ProcessDefinition - sequence do - participant :nada - _print "it's ${f:weather}" - end + # Testing that the changes to the workitem are taken into account + + class Test1 < OpenWFE::ProcessDefinition + sequence do + participant :nada + _print "it's ${f:weather}" end + end - def test_1 + def test_1 - ejournal = @engine.get_error_journal + ejournal = @engine.get_error_journal - li = OpenWFE::LaunchItem.new Test1 - li.weather = "sunny" + li = OpenWFE::LaunchItem.new Test1 + li.weather = "sunny" - fei = launch li + fei = launch li - sleep 0.300 + sleep 0.300 - errors = ejournal.get_error_log fei + errors = ejournal.get_error_log fei - #require 'pp'; pp ejournal - #puts "/// error journal of class #{ejournal.class.name}" + #require 'pp'; pp ejournal + #puts "/// error journal of class #{ejournal.class.name}" - assert_equal 1, errors.length + assert_equal 1, errors.length - assert ejournal.has_errors?(fei) - assert ejournal.has_errors?(fei.wfid) + assert ejournal.has_errors?(fei) + assert ejournal.has_errors?(fei.wfid) - # - # fix + # + # fix - @engine.register_participant :nada do - # do nothing - end + @engine.register_participant :nada do + # do nothing + end - # - # replay + # + # replay - error = errors.first + error = errors.first - assert_equal "sunny", error.workitem.weather + assert_equal "sunny", error.workitem.weather - error.workitem.weather = "rainy" + error.workitem.weather = "rainy" - @engine.replay_at_error error + @engine.replay_at_error error - sleep 0.300 + sleep 0.300 - assert_trace "it's rainy" - end + assert_trace "it's rainy" + end end