Sha256: ec7c883848cea522a68674a450218dfd9ec2e131ffc7ead3639c45146de05da0

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 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 0.500
    sleep 2.000 if @engine.storage.class.name.match(/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.2.0 test/functional/ft_40_wait_logger.rb