Sha256: b7dc9431ce827d9ec07f7ae63921e17cad10d2d6acadd6b613f22cf2773caf51

Contents?: true

Size: 2 KB

Versions: 4

Compression:

Stored size: 2 KB

Contents

#
# testing ruote
#
# Thu Nov 25 11:20:04 JST 2010
#

require File.expand_path('../base', __FILE__)

#require 'ruote/part/storage_participant'


class FtLoseTest < Test::Unit::TestCase
  include FunctionalBase

  def test_lose_participiant

    pdef = Ruote.process_definition do
      sequence do
        alpha :lose => true
        alpha
      end
    end

    @dashboard.register_participant '.+' do |wi|
      tracer << wi.participant_name + "\n"
    end

    wfid = @dashboard.launch(pdef)

    @dashboard.wait_for(6)

    #sleep 0.500

    assert_equal 'alpha', @tracer.to_s

    ps = @dashboard.process(wfid)

    assert_equal 3, ps.expressions.size
    assert_equal 0, ps.errors.size
      # the sequence is stuck, the lost alpha is not replying
  end

  def test_lose_sequence

    pdef = Ruote.process_definition do
      concurrence do
        alpha
        sequence :lose => 'true' do
          bravo
        end
      end
    end

    @dashboard.register_participant '.+' do |wi|
      tracer << wi.participant_name + "\n"
    end

    wfid = @dashboard.launch(pdef)

    2.times { @dashboard.wait_for('dispatched') }

    assert_match /alpha/, @tracer.to_s
    assert_match /bravo/, @tracer.to_s

    ps = @dashboard.process(wfid)

    assert_equal 3, ps.expressions.size
    assert_equal 0, ps.errors.size
      # the concurrence is stuck, the lost sequence won't reply
  end

  def test_cancel_lost_expression

    pdef = Ruote.define do
      sequence do
        alpha
        bravo :lose => true
        charly
      end
    end

    @dashboard.register_participant '.+' do |wi|
      tracer << wi.participant_name + "\n"
    end

    wfid = @dashboard.launch(pdef)

    @dashboard.wait_for(12)
      # until bravo is reached

    #sleep 0.500

    assert_equal "alpha\nbravo", @tracer.to_s

    bravo = @dashboard.process(wfid).expressions.last

    @dashboard.cancel_expression(bravo.fei)

    @dashboard.wait_for(wfid)

    assert_equal "alpha\nbravo\ncharly", @tracer.to_s
    assert_nil @dashboard.process(wfid)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruote-2.3.0.3 test/functional/ft_48_lose.rb
ruote-2.3.0.2 test/functional/ft_48_lose.rb
ruote-2.3.0.1 test/functional/ft_48_lose.rb
ruote-2.3.0 test/functional/ft_48_lose.rb