test/wfid_test.rb in openwferu-0.9.7 vs test/wfid_test.rb in openwferu-0.9.8
- old
+ new
@@ -12,10 +12,12 @@
#require "fastthread"
require 'test/unit'
require 'openwfe/utils'
+require 'openwfe/workitem'
+require 'openwfe/engine/engine'
require 'openwfe/expool/wfidgen'
#
# testing otime and the scheduler (its cron aspect)
@@ -117,8 +119,49 @@
#puts OpenWFE::KotobaWfidGenerator.to_time(kid)
#kid = "20070320-nayozunuje"
#puts OpenWFE::KotobaWfidGenerator.to_time(kid)
#kid = "20070320-nazazunuje"
#puts OpenWFE::KotobaWfidGenerator.to_time(kid)
+ end
+
+
+ #
+ # test FieldWfidGenerator
+
+ class MyEngine < OpenWFE::Engine
+
+ def build_wfid_generator
+
+ g = FieldWfidGenerator.new(
+ S_WFID_GENERATOR, @application_context, "wfid")
+ end
+ end
+
+ class MyProcDef < OpenWFE::ProcessDefinition
+ sequence do
+ # do nothing
+ end
+ end
+
+ def test_field_wfid
+
+ eng = MyEngine.new
+
+ li = OpenWFE::LaunchItem.new(MyProcDef)
+ li.wfid = "toto"
+ fei = eng.launch(li)
+
+ assert_equal fei.wfid, "toto"
+
+ li = OpenWFE::LaunchItem.new(MyProcDef)
+ fei = eng.launch(li)
+
+ #puts fei.wfid
+
+ assert_not_equal fei.wfid, "toto"
+
+ t = OpenWFE::KotobaWfidGenerator.to_time(fei.wfid)
+
+ assert t.is_a?(Time)
end
end