Sha256: 6e13ee51f01b56c6c9b2e3c8aadbf21d7e5f4a785f830f72a1ccc141c8a322f3

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

#
# testing ruote
#
# Tue Apr 20 12:32:44 JST 2010
#

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

require 'ruote/part/storage_participant'


class FtWaitLoggerTest < Test::Unit::TestCase

  def teardown

    @engine.shutdown
    @engine.context.storage.purge!
  end

  def test_wait_logger

    @engine = Ruote::Engine.new(Ruote::Worker.new(determine_storage({})))

    sp = @engine.register_participant :alpha, Ruote::StorageParticipant

    pdef = Ruote.process_definition { alpha }

    wfid = @engine.launch(pdef)

    r = @engine.wait_for(:alpha)
    assert_equal 'dispatch', r['action']

    sp.reply(sp.first)

    r = @engine.wait_for(wfid)

    assert_equal 'terminated', r['action']
  end

  def test_wait_logger_seen

    @engine = Ruote::Engine.new(Ruote::Worker.new(determine_storage({})))

    #@engine.noisy = true

    pdef = Ruote.process_definition { }

    wfid = @engine.launch(pdef)

    sleep 1.400 # worst case is ruote-couch

    assert_equal 2, @engine.context.logger.instance_variable_get(:@seen).size

    r = @engine.wait_for(wfid)

    assert_equal 'terminated', r['action']
    assert_equal 0, @engine.context.logger.instance_variable_get(:@seen).size
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-2.1.11 test/functional/ft_40_wait_logger.rb