test/hparticipant_test.rb in openwferu-0.9.4 vs test/hparticipant_test.rb in openwferu-0.9.5
- old
+ new
@@ -39,55 +39,78 @@
end
end
def test_hp_0
- hpAlice = HashParticipant.new
- hpBob = HashParticipant.new
+ @hpAlice = HashParticipant.new
+ @hpBob = HashParticipant.new
- @engine.register_participant(:alice, hpAlice)
- @engine.register_participant(:bob, hpBob)
+ @engine.register_participant(:alice, @hpAlice)
+ @engine.register_participant(:bob, @hpBob)
+ do_test()
+ end
+
+ def test_hp_1
+
+ FileUtils.remove_dir "./work" if File.exist? "./work"
+
+ @engine.application_context[:work_directory] = "./work"
+ @hpAlice = YamlParticipant.new("alice", @engine.application_context)
+ #@hpBob = YamlParticipant.new("bob", @engine.application_context)
+
+ @engine.register_participant(:alice, @hpAlice)
+ #@engine.register_participant(:bob, @hpBob)
+ @hpBob = @engine.register_participant(:bob, YamlParticipant)
+
+ do_test()
+ end
+
+ def do_test
+
id = @engine.launch(HpDefinition0)
assert \
(id.kind_of? FlowExpressionId),
"engine.launch() doesn't return an instance of FlowExpressionId "+
"but of #{id.class}"
#puts id.to_s
+ #puts "alice count : #{@hpAlice.size}"
+ #puts "bob count : #{@hpBob.size}"
+
assert \
- hpBob.size == 0
+ @hpBob.size == 0
assert \
- hpAlice.size == 1
+ @hpAlice.size == 1
- wi = hpAlice.list_workitems(id.workflow_instance_id)[0]
+ wi = @hpAlice.list_workitems(id.workflow_instance_id)[0]
assert \
wi != nil,
"didn't find wi for flow #{id.workflow_instance_id}"
wi.message = "Hello bob !"
- hpAlice.forward(wi)
+ @hpAlice.forward(wi)
assert \
- hpAlice.size == 0
+ @hpAlice.size == 0
assert \
- hpBob.size == 1
+ @hpBob.size == 1
- wi = hpBob.list_workitems(id.workflow_instance_id)[0]
+ wi = @hpBob.list_workitems(id.workflow_instance_id)[0]
assert \
wi.message == "Hello bob !"
- hpBob.proceed(wi)
+ @hpBob.proceed(wi)
assert \
- hpAlice.size == 0
+ @hpAlice.size == 0
assert \
- hpBob.size == 0
+ @hpBob.size == 0
assert \
@engine.get_expression_storage.size == 1
end