Sha256: 52ecd344693772e4f7caaf102bb81d555161ca4c160fa81a076a1ff97d2518f6

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

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

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


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

  #def setup
  #end

  #def teardown
  #end


  #
  # Test 0
  #

  class Test0 < OpenWFE::ProcessDefinition
    concurrence do

      listen :to => "^channel_.$", :once => false do
        _print "apply"
      end

      sequence do
        _sleep "300"
        participant :ref => "channel_z"
        channel_z
      end
    end
  end

  def test_0

    @engine.register_participant :channel_z do
      @tracer << "z\n"
    end

    #log_level_to_debug

    outputs = [
      %w{ z apply z apply }.join("\n"),
      %w{ z z apply apply }.join("\n")
    ]

    dotest Test0, outputs, 0.850, true
  end

  #
  # Test 1
  #

  class Test1 < OpenWFE::ProcessDefinition
    concurrence do
      listen :to => "channel9", :once => false do
        listen9
      end
      sequence do
        _sleep "300"
        channel9
      end
    end
  end

  def test_1

    #log_level_to_debug

    @engine.register_participant "channel9", OpenWFE::NullParticipant
    @engine.register_participant "listen9", OpenWFE::NullParticipant

    fei = launch Test1

    sleep 0.700

    #puts @engine.get_expression_storage
    assert_equal 8, @engine.get_expression_storage.size

    #puts @engine.get_expression_storage

    @engine.cancel_process fei

    sleep 0.700

    #puts @engine.get_expression_storage
    assert_equal 1, @engine.get_expression_storage.size
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-0.9.19 test/ft_54c_listen.rb