test/hparticipant_test.rb in openwferu-0.9.7 vs test/hparticipant_test.rb in openwferu-0.9.8

- old
+ new

@@ -50,11 +50,12 @@ do_test() end def test_hp_1 - FileUtils.remove_dir "./work" if File.exist? "./work" + #FileUtils.remove_dir "./work" if File.exist? "./work" + FileUtils.rm_rf "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) @@ -108,9 +109,54 @@ assert \ @hpAlice.size == 0 assert \ @hpBob.size == 0 + + assert \ + @engine.get_expression_storage.size == 1 + end + + def test_d_0 + + @hpAlice = HashParticipant.new + @hpBob = HashParticipant.new + + @engine.register_participant(:alice, @hpAlice) + @engine.register_participant(:bob, @hpBob) + + id = @engine.launch(HpDefinition0) + + assert_equal @hpAlice.size, 1 + assert_equal @hpBob.size, 0 + + wi = @hpAlice.first_workitem + + @hpAlice.delegate wi, @hpBob + + assert_equal @hpAlice.size, 0 + assert_equal @hpBob.size, 1 + + wi = @hpBob.first_workitem + + @hpBob.proceed wi + + assert_equal @hpAlice.size, 0 + assert_equal @hpBob.size, 1 + + wi = @hpBob.first_workitem + + @hpBob.delegate wi.fei, @hpAlice + + assert_equal @hpAlice.size, 1 + assert_equal @hpBob.size, 0 + + wi = @hpAlice.first_workitem + + @hpAlice.forward wi + + assert_equal @hpAlice.size, 0 + assert_equal @hpBob.size, 0 assert \ @engine.get_expression_storage.size == 1 end