Sha256: 4be790b8b0c465f241ef010949a834ca719f781068745f4f3fc42e6a6a8a03fb

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

#
# Testing Ruote (OpenWFEru)
#
# Mon Dec  7 13:54:18 JST 2009
#

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


class CtIteratorTest < Test::Unit::TestCase
  include ConcurrentBase

  def test_collision

    pdef = Ruote.process_definition do
      concurrence do
        iterator :on => (1..10).to_a, :tag => 'it' do
          echo '${v:i}'
        end
        sequence do
          sequence do
            stop :ref => 'it'
          end
        end
      end
    end

    #noisy

    wfid = @engine0.launch(pdef)

    #@engine0.step 11
    msg = @engine0.step_until { |msg| msg['command'] != nil }

    assert_equal 'stop', msg['command'].first
    assert_equal '0_0_0', msg['fei']['expid']

    msgs = @storage.get_msgs

    assert_equal 3, msgs.size

    msgs = msgs - [ msg ]

    assert_equal 2, msgs.size

    msg1 = msgs.first

    t0 = Thread.new { @engine1.do_step(msg) }
    t1 = Thread.new { @engine0.do_step(msg1) }
    t0.join
    t1.join

    #@engine0.step 4
    @engine1.walk

    assert_equal "1\n2", @tracer0.to_s
    assert_equal "", @tracer1.to_s
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruote-2.1.3 test/functional/ct_1_iterator.rb
ruote-2.1.2 test/functional/ct_1_iterator.rb
ruote-2.1.1 test/functional/ct_1_iterator.rb