Sha256: 9c1996df6bd45d37e34090a6f82cbd65046a3d74ee4fbf9f97975ab42302d9db

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

#
# testing ruote
#
# Thu Nov 25 10:05:28 JST 2010
#

require File.join(File.dirname(__FILE__), 'base')

require 'ruote/participant'


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

  def test_lose_alone

    pdef = Ruote.process_definition do
      lose
    end

    #@engine.noisy = true

    wfid = @engine.launch(pdef)

    @engine.wait_for(2)
      # wait until the process reaches the 'lose' expression

    sleep 0.500

    ps = @engine.process(wfid)

    assert_equal 0, ps.errors.size
    assert_equal 2, ps.expressions.size

    # the process is just stuck at the 'lose' expression
  end

  def test_losing_child

    pdef = Ruote.process_definition do
      lose do
        alpha
      end
      charly
    end

    @engine.register_participant '.+' do |wi|
      @tracer << wi.participant_name
    end

    #@engine.noisy = true

    wfid = @engine.launch(pdef)

    @engine.wait_for(7)
      # wait until 'alpha' replies to its parent 'lose'

    sleep 0.500

    assert_equal 'alpha', @tracer.to_s
  end

  def test_cancelling_lose

    pdef = Ruote.process_definition do
      lose do
        alpha
      end
    end

    @engine.register_participant '.+', Ruote::StorageParticipant

    #@engine.noisy = true

    wfid = @engine.launch(pdef)

    @engine.wait_for(6)
      # wait until 'alpha' replies to its parent 'lose'

    sleep 0.500

    assert_equal 1, @engine.storage_participant.size

    @engine.cancel_process(wfid)

    sleep 0.500

    assert_equal 0, @engine.storage_participant.size
    assert_nil @engine.process(wfid)
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ruote-maestrodev-2.2.1 test/functional/eft_32_lose.rb
ruote-2.2.0 test/functional/eft_32_lose.rb