Sha256: ac67663e278b20f90dc4b107f0ce3b8167e10a3c9c093dd5dcad3916b51be724

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Sun Oct 29 15:41:44 JST 2006
#

require 'test/unit'

require 'yaml'

require 'rubygems'

require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/engine/engine'

require 'openwfe/extras/misc/activityfeed'


class ActivityFeedTest < Test::Unit::TestCase

  #def setup
  #end
  #def teardown
  #end

  #
  # test 0

  class Test0 < OpenWFE::ProcessDefinition
    sequence do
      step_one
      step_two
      step_three
    end
  end

  def test_0

    engine = OpenWFE::Engine.new({
      :definition_in_launchitem_allowed => true })

    feedservice = engine.init_service(
      'activityFeed', OpenWFE::Extras::ActivityFeedService)

    steps = []

    engine.register_participant "step_.*" do |workitem|
      steps << workitem.participant_name
    end

    li = OpenWFE::LaunchItem.new Test0
    li.message = "2 > 1 < 3"

    fei = engine.launch li
    engine.wait_for fei

    feed = feedservice.get_feed(".*")
    #puts feed.to_s

    assert_equal "step_one, step_two, step_three", steps.join(", ")
    assert_equal "OpenWFEru engine activity feed", feed.title.to_s

    assert_equal 6, feed.instance_variable_get(:@entries).size

    feed = feedservice.get_feed(".*", :upon => :reply)

    assert_equal 3, feed.instance_variable_get(:@entries).size

    entry = feed.instance_variable_get(:@entries)[0]

    assert entry

    workitem = YAML.load(entry.content.to_s)

    assert_equal OpenWFE::InFlowWorkItem, workitem.class
    assert_equal "2 > 1 < 3", workitem.message

    #puts workitem.to_s
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-0.9.19 test/extras/activityfeed_test.rb