Sha256: 26334490d47feaf05e0ae020d7d503ce8963fe936403b35479241d1e3f6ae496

Contents?: true

Size: 1.73 KB

Versions: 11

Compression:

Stored size: 1.73 KB

Contents

#
# testing ruote
#
# Fri Nov 13 10:30:32 JST 2009
#

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

require 'ruote/part/hash_participant'

#
# testing forced rewinding
#
class FtCursorRewindTest < Test::Unit::TestCase
  include FunctionalBase

  def test_cursor_forced_back

    pdef = Ruote.process_definition do
      cursor do
        alpha
        bravo
        charly
      end
    end

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

    #noisy

    #
    # reaching initial situation...

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

    alpha.reply(alpha.first)
    wait_for(:bravo)

    #
    # rewinding...

    wi = bravo.first
    wi.fields['__command__'] = [ 'back', 2 ]

    @engine.reply(wi)

    #
    # workitem is back to alpha

    wait_for(:alpha)
  end

  def test_cursor_forced_jump

    pdef = Ruote.process_definition do
      cursor do
        alpha
        bravo
        charly
      end
    end

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

    #noisy

    #
    # reaching initial situation...

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

    alpha.reply(alpha.first)
    wait_for(:bravo)

    #
    # rewinding...

    wi = bravo.first

    wi.h['fei']['expid'] = wi.h['fei']['expid'][0..-3] # parent wfid
    wi.fields['__command__'] = [ 'jump', 'alpha' ]

    @engine.reply(wi)

    #
    # workitem is back to alpha

    wait_for(:alpha)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ruote-2.1.11 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.10 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.9 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.8 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.7 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.6 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.5 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.4 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.3 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.2 test/functional/ft_34_cursor_rewind.rb
ruote-2.1.1 test/functional/ft_34_cursor_rewind.rb