Sha256: 1d6a6b50e0ea9cb8b9510f96a9d0d83bcf7ac6364aabddfb60813eeed14949cb

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

#
# Testing OpenWFEru
#
# John Mettraux at openwfe.org
#

require 'flowtestbase'
require 'openwfe/def'
require 'openwfe/participants/storeparticipants'


class FlowTest72 < Test::Unit::TestCase
  include FlowTestBase

  #def setup
  #end

  #def teardown
  #end


  #
  # Test 0
  #

  class Test0 < OpenWFE::ProcessDefinition
    sequence do
      _set :variable => "/toto", :value => "${f:toto}"
      participant :alpha
    end
  end

  def test_0

    #log_level_to_debug

    sa = @engine.register_participant :alpha, OpenWFE::HashParticipant

    li = OpenWFE::LaunchItem.new Test0
    li.toto = 'toto_zero'
    fei0 = launch li

    li = OpenWFE::LaunchItem.new Test0
    li.toto = 'toto_one'
    fei1 = launch li

    sleep 0.350

    wfids = @engine.lookup_processes('nada')
    assert_equal 0, wfids.size

    wfids = @engine.lookup_processes('toto')
    assert_equal 2, wfids.size
    assert wfids.include?(fei0.wfid)
    assert wfids.include?(fei1.wfid)

    wfids = @engine.lookup_processes('toto', 'smurf')
    assert_equal 0, wfids.size

    wfids = @engine.lookup_processes('toto', 'toto_.*')
    assert_equal 0, wfids.size

    wfids = @engine.lookup_processes('toto', /toto_.*/)
    assert_equal 2, wfids.size

    wfids = @engine.lookup_processes('toto', Regexp.compile('toto_one'))
    assert_equal wfids, [ fei1.wfid ]

    # over.

    @engine.cancel_process fei0
    @engine.cancel_process fei1

    sleep 0.350
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-0.9.19 test/ft_72_lookup_processes.rb