test/bm/ft_26b_load.rb in ruote-0.9.18 vs test/bm/ft_26b_load.rb in ruote-0.9.19

- old
+ new

@@ -10,77 +10,75 @@ #require 'profile' require 'flowtestbase' require 'openwfe/def' -include OpenWFE - class FlowTest26b < Test::Unit::TestCase - include FlowTestBase + include FlowTestBase - #def setup - #end + #def setup + #end - #def teardown - #end + #def teardown + #end - # - # Test 0 - # + # + # Test 0 + # - class TestDefinition0 < ProcessDefinition - count - end + class TestDefinition0 < ProcessDefinition + count + end - #def xxxx_load_0 - def test_load_0 + #def xxxx_load_0 + def test_load_0 - #require 'openwfe/expool/journal' - #@engine.application_context[:keep_journals] = true - #@engine.init_service("journal", Journal) + #require 'openwfe/expool/journal' + #@engine.application_context[:keep_journals] = true + #@engine.init_service("journal", Journal) - $count = 0 + $count = 0 - @engine.register_participant("count") do |workitem| - $count += 1 - #puts "count is #{$count}" - end - + @engine.register_participant("count") do |workitem| + $count += 1 + #puts "count is #{$count}" + end - n = 1000 - n.times do |i| - @engine.launch(LaunchItem.new(TestDefinition0)) - end - - puts "launched #{n} items" - #n.times do |i| - # Thread.new do - # @engine.launch(LaunchItem.new(TestDefinition0)) - # end - #end + n = 1000 + n.times do |i| + @engine.launch(LaunchItem.new(TestDefinition0)) + end - #5.times do - # Thread.new do - # (n / 5).times do - # @engine.launch(LaunchItem.new(TestDefinition0)) - # end - # end - #end - #sleep 1 + puts "launched #{n} items" - join_until_idle + #n.times do |i| + # Thread.new do + # @engine.launch(LaunchItem.new(TestDefinition0)) + # end + #end - assert_equal $count, n + #5.times do + # Thread.new do + # (n / 5).times do + # @engine.launch(LaunchItem.new(TestDefinition0)) + # end + # end + #end + #sleep 1 + + join_until_idle + + assert_equal $count, n + end + + def join_until_idle () + storage = @engine.get_expression_storage + while storage.size > 1 + sleep 1 + puts "storage.size:#{storage.size}" end - - def join_until_idle () - storage = @engine.get_expression_storage - while storage.size > 1 - sleep 1 - puts "storage.size:#{storage.size}" - end - end + end end