Sha256: 5ff91fb91d508f6a23b9d3e57731d4d1e02d28938326710b9ac945594acedf49

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

#
# testing ruote
#
# Tue Oct 27 01:36:52 JST 2009
#

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


class RtWhenTest < Test::Unit::TestCase
  include FunctionalBase
  include RestartBase

  def test_when_and_restart

    do_test('1s')
  end

  def test_when_cron_and_restart

    do_test('* * * * * *')
  end

  protected

  def do_test (freq)

    start_new_engine

    pdef = Ruote.process_definition :name => 'test' do
      sequence do
        echo 'in'
        _when '${v:resume}', :freq => freq
        echo 'out.'
      end
    end

    #noisy

    wfid = @engine.launch(pdef)

    wait_for(5)

    assert_equal 1, @engine.processes.size
    assert_equal 1, @engine.storage.get_many('schedules').size

    @engine.shutdown

    # restart...

    start_new_engine

    #noisy

    assert_equal 1, @engine.processes.size
    assert_equal 1, @engine.storage.get_many('schedules').size

    @engine.variables['resume'] = true

    wait_for(wfid)

    assert_equal "in\nout.", @tracer.to_s

    assert_equal 0, @engine.processes.size
    assert_equal 0, @engine.storage.get_many('schedules').size
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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