public
Description: the [OpenWFEru] workflow and BPM engine (ruby)
Homepage: http://openwferu.rubyforge.org
Clone URL: git://github.com/jmettraux/ruote.git
ruote / test / ft_29_httprb.rb
100644 107 lines (72 sloc) 1.573 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#
# Testing OpenWFEru (Ruote)
#
# John Mettraux at openwfe.org
#
# Mon Oct 9 22:19:44 JST 2006
#
 
require 'rubygems'
 
require 'openwfe/def'
require 'openwfe/workitem'
require 'openwfe/participants/storeparticipants'
 
require 'flowtestbase'
 
 
class FlowTest29 < Test::Unit::TestCase
  include FlowTestBase
 
  #def teardown
  #end
 
  def setup
    super
    @engine.ac[:remote_definitions_allowed] = true
  end
 
  DEFHOST = "http://openwferu.rubyforge.org/defs"
 
  #
  # TEST 0
 
  def test_httprb_0
 
    li = OpenWFE::LaunchItem.new
    li.wfdurl = "#{DEFHOST}/testdef.rb"
 
    dotest li, %w{ a b c }.join("\n")
  end
 
 
  #
  # TEST 1
 
  class MainDefinition1 < OpenWFE::ProcessDefinition
    sequence do
      _print "A"
      subprocess :ref => "#{DEFHOST}/testdef.rb"
      _print "C"
    end
  end
 
  def test_httprb_1
 
    dotest MainDefinition1, %w{ A a b c C }.join("\n")
  end
 
 
  #
  # TEST 2
 
  class MainDefinition2 < OpenWFE::ProcessDefinition
    def make
      sequence do
        _print "-1"
        subprocess :ref => "#{DEFHOST}/testdef.xml"
        _print "3"
      end
    end
  end
 
  def test_httprb_2
 
    dotest MainDefinition2, %w{ -1 0 1 2 3 }.join("\n")
  end
 
 
  #
  # TEST 3
 
  def test_httprb_3
 
    @engine.ac.delete(:remote_definitions_allowed)
      #
      # relocking
 
    li = OpenWFE::LaunchItem.new
    li.wfdurl = "#{DEFHOST}/testdef.rb"
 
    e = nil
 
    begin
      dotest(li, "")
    rescue Exception => e
    end
 
    #puts e
 
    assert_not_nil e
    assert_equal e.to_s, ":remote_definitions_allowed is set to false"
  end
 
end