Sha256: bd61a55917130a7c87f3f3935792f7c21280c9a362a4fd6635c02a3dce9eac1c

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

#
# testing ruote
#
# Wed Jun 10 11:03:26 JST 2009
#

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


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

  def test_workitems_dispatching_message

    pdef = Ruote.process_definition do
      sequence do
        alpha
      end
    end

    @engine.register_participant :alpha do |workitem|
      @tracer << "#{workitem.participant_name}\n"
    end

    #noisy

    assert_trace('alpha', pdef)

    Thread.pass
      # making sure the reply to the participant expression is intercepted
      # as well

    assert_equal(
      2, logger.log.select { |e| e['participant_name'] == 'alpha' }.size)
  end

  def test_missing_participant_name

    pdef = Ruote.process_definition do
      sequence do
        participant
      end
    end

    #noisy

    wfid = @engine.launch(pdef)

    wait_for(wfid)

    ps = @engine.process(wfid)

    assert_equal(
      1, ps.errors.size)
    assert_equal(
      '#<ArgumentError: no participant name specified>', ps.errors[0].message)
  end

  def test_dot_star

    pdef = Ruote.process_definition do
      sequence do
        alpha
      end
    end

    @engine.register_participant '.*' do |workitem|
      @tracer << "#{workitem.participant_name} #{workitem.fei.expid}\n"
    end

    assert_trace('alpha 0_0_0', pdef)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-2.1.8 test/functional/ft_8_participant_consumption.rb