# # Testing OpenWFE # # John Mettraux at openwfe.org # # Sun Oct 29 15:41:44 JST 2006 # # Kita Yokohama # require 'test/unit' require 'openwfe/workitem' require 'openwfe/engine/engine' require 'openwfe/expressions/raw_prog' require 'openwfe/participants/atomparticipants' include OpenWFE class AtomTest < Test::Unit::TestCase def setup @engine = Engine.new() end #def teardown #end # # test atom 0 class AtomDefinition0 < ProcessDefinition sequence do set \ :field => "atom_entry_title", :value => "#{$run_index}" set \ :field => "colour", :value => "blue" participant :ref => "feed0-alpha" set \ :field => "atom_entry_title", :value => "#{$run_index}" set \ :field => "colour", :value => "red" participant :ref => "feed1-bravo" end end def test_atom_0 feed0 = AtomParticipant.new(7, """

${f:colour}

""") feed1 = AtomParticipant.new(7) do |fe, participant, workitem| t = Time.now.to_s """

${f:colour}

""" end @engine.register_participant("feed0-.*", feed0) @engine.register_participant("feed1-.*", feed1) $run_index = "first run" @engine.launch(LaunchItem.new(AtomDefinition0)) $run_index = "second run" @engine.launch(LaunchItem.new(AtomDefinition0)) $run_index = "third and last run" @engine.launch(LaunchItem.new(AtomDefinition0)) @engine.join_until_idle assert File.exist?('work/atom_feed0-alpha.xml') assert File.exist?('work/atom_feed1-bravo.xml') end end