Sha256: 5eba9cf52aec684a3bdffbf2856fcfff63abe537a2f728c74fc60388f6ae4b44

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

#
# testing ruote
#
# Wed Jun  3 08:42:07 JST 2009
#

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

require 'ruote/part/hash_participant'


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

  def test_cancel_process

    pdef = Ruote.process_definition do
      alpha
    end

    alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new

    #noisy

    wfid = @engine.launch(pdef)
    wait_for(:alpha)

    ps = @engine.process(wfid)
    assert_equal 1, alpha.size

    assert_not_nil ps

    @engine.cancel_process(wfid)

    wait_for(wfid)
    ps = @engine.process(wfid)

    assert_nil ps
    assert_equal 0, alpha.size

    #puts; logger.log.each { |e| p e['action'] }; puts
    assert_equal 1, logger.log.select { |e| e['action'] == 'cancel_process' }.size
    assert_equal 2, logger.log.select { |e| e['action'] == 'cancel' }.size
  end

  def test_cancel_expression

    pdef = Ruote.process_definition do
      sequence do
        alpha
        bravo
      end
    end

    alpha = @engine.register_participant :alpha, Ruote::HashParticipant.new
    bravo = @engine.register_participant :bravo, Ruote::HashParticipant.new

    #noisy

    wfid = @engine.launch(pdef)
    wait_for(:alpha)

    wi = alpha.first

    @engine.cancel_expression(wi.fei)
    wait_for(:bravo)

    assert_not_nil bravo.first
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruote-2.1.11 test/functional/ft_4_cancel.rb
ruote-2.1.10 test/functional/ft_4_cancel.rb
ruote-2.1.9 test/functional/ft_4_cancel.rb
ruote-2.1.8 test/functional/ft_4_cancel.rb
ruote-2.1.7 test/functional/ft_4_cancel.rb
ruote-2.1.6 test/functional/ft_4_cancel.rb
ruote-2.1.5 test/functional/ft_4_cancel.rb
ruote-2.1.4 test/functional/ft_4_cancel.rb