public
Description: RESTful workflow / bpm engine based on Rack and OpenWFEru
Homepage: http://openwferu.rubyforge.org
Clone URL: git://github.com/jmettraux/ruote-rest.git
indent = 2 for tests as well
jmettraux (author)
Tue Jun 17 00:43:58 -0700 2008
commit  4286d3bb108c9c9c754777ec5ac3c91763c9a44f
tree    496515338d86e01d0dbd59b1528175c9c5b5b6b0
parent  12b768d10b375541aa1440232314d902feb640a0
...
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
108
 
109
110
111
 
112
113
 
 
114
115
116
117
118
 
119
120
121
122
 
 
 
 
123
124
125
126
 
 
 
127
128
 
 
 
129
130
 
131
132
 
133
134
135
 
 
 
 
136
137
...
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
 
 
108
109
 
110
111
112
 
 
 
 
113
114
 
 
 
115
116
117
118
119
 
 
 
120
121
122
123
 
124
125
126
127
 
128
129
 
130
131
 
 
132
133
134
135
136
137
0
@@ -21,117 +21,117 @@ require 'testbase'
0
 
0
 class StExpressionsTest < Test::Unit::TestCase
0
 
0
- include TestBase
0
+ include TestBase
0
 
0
- include Sinatra::Builder
0
- include Sinatra::RenderingHelpers
0
-
0
+ include Sinatra::Builder
0
+ include Sinatra::RenderingHelpers
0
 
0
- def test_0
0
 
0
- li = OpenWFE::LaunchItem.new <<-EOS
0
- class TestStExpressions < OpenWFE::ProcessDefinition
0
- sequence do
0
- alpha
0
- bravo
0
- end
0
- end
0
- EOS
0
+ def test_0
0
 
0
- post_it(
0
- "/processes",
0
- OpenWFE::Xml.launchitem_to_xml(li),
0
- { "CONTENT_TYPE" => "application/xml" })
0
+ li = OpenWFE::LaunchItem.new <<-EOS
0
+ class TestStExpressions < OpenWFE::ProcessDefinition
0
+ sequence do
0
+ alpha
0
+ bravo
0
+ end
0
+ end
0
+ EOS
0
 
0
- fei = OpenWFE::Xml.fei_from_xml @response.body
0
+ post_it(
0
+ "/processes",
0
+ OpenWFE::Xml.launchitem_to_xml(li),
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- sleep 0.350
0
+ fei = OpenWFE::Xml.fei_from_xml @response.body
0
 
0
- get_it "/expressions/#{fei.wfid}"
0
- #puts
0
- #puts @response.body
0
- #puts
0
- assert_not_nil @response.body.index(' count="5"')
0
+ sleep 0.350
0
 
0
+ get_it "/expressions/#{fei.wfid}"
0
+ #puts
0
+ #puts @response.body
0
+ #puts
0
+ assert_not_nil @response.body.index(' count="5"')
0
 
0
- get_it "/expressions/#{fei.wfid}/0_0"
0
 
0
- assert_not_nil @response.body.index(
0
- '<class>OpenWFE::SequenceExpression</class>')
0
+ get_it "/expressions/#{fei.wfid}/0_0"
0
 
0
- get_it "/expressions/#{fei.wfid}/0e"
0
- #puts
0
- #puts @response.body
0
- #puts
0
- assert_not_nil(
0
- @response.body.index('<class>OpenWFE::Environment</class>'),
0
- "GET /0e --> not an environment")
0
+ assert_not_nil @response.body.index(
0
+ '<class>OpenWFE::SequenceExpression</class>')
0
 
0
+ get_it "/expressions/#{fei.wfid}/0e"
0
+ #puts
0
+ #puts @response.body
0
+ #puts
0
+ assert_not_nil(
0
+ @response.body.index('<class>OpenWFE::Environment</class>'),
0
+ "GET /0e --> not an environment")
0
 
0
- get_it "/expressions/#{fei.wfid}/0"
0
 
0
- assert_not_nil(
0
- @response.body.index('<class>OpenWFE::DefineExpression</class>'),
0
- "GET /0e --> not an 'process-definition'")
0
+ get_it "/expressions/#{fei.wfid}/0"
0
 
0
- #
0
- # cancel process
0
+ assert_not_nil(
0
+ @response.body.index('<class>OpenWFE::DefineExpression</class>'),
0
+ "GET /0e --> not an 'process-definition'")
0
 
0
- delete_it "/expressions/#{fei.wfid}/0"
0
+ #
0
+ # cancel process
0
 
0
- assert_equal 303, @response.status
0
+ delete_it "/expressions/#{fei.wfid}/0"
0
 
0
- sleep 0.350
0
+ assert_equal 303, @response.status
0
 
0
- # done.
0
- end
0
+ sleep 0.350
0
 
0
- def test_1
0
+ # done.
0
+ end
0
 
0
- li = OpenWFE::LaunchItem.new <<-EOS
0
- class TestStExpressions < OpenWFE::ProcessDefinition
0
- nada
0
- end
0
- EOS
0
+ def test_1
0
 
0
- post_it(
0
- "/processes",
0
- OpenWFE::Xml.launchitem_to_xml(li),
0
- { "CONTENT_TYPE" => "application/xml" })
0
+ li = OpenWFE::LaunchItem.new <<-EOS
0
+ class TestStExpressions < OpenWFE::ProcessDefinition
0
+ nada
0
+ end
0
+ EOS
0
 
0
- fei = OpenWFE::Xml.fei_from_xml @response.body
0
+ post_it(
0
+ "/processes",
0
+ OpenWFE::Xml.launchitem_to_xml(li),
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- sleep 0.350
0
+ fei = OpenWFE::Xml.fei_from_xml @response.body
0
 
0
- get_it "/expressions/#{fei.wfid}/0_0?format=yaml"
0
+ sleep 0.350
0
 
0
- assert_equal "application/yaml", @response["Content-Type"]
0
+ get_it "/expressions/#{fei.wfid}/0_0?format=yaml"
0
 
0
- exp = YAML.load @response.body
0
- assert_kind_of OpenWFE::FlowExpression, exp
0
+ assert_equal "application/yaml", @response["Content-Type"]
0
 
0
- exp.attributes = { :toto => :surf }
0
+ exp = YAML.load @response.body
0
+ assert_kind_of OpenWFE::FlowExpression, exp
0
 
0
- put_it(
0
- "/expressions/#{fei.wfid}/0_0",
0
- exp.to_yaml,
0
- { "CONTENT_TYPE" => "application/yaml" })
0
+ exp.attributes = { :toto => :surf }
0
 
0
- assert_equal(
0
- "http://example.org/expressions/#{fei.wfid}/0_0",
0
- @response["Location"])
0
+ put_it(
0
+ "/expressions/#{fei.wfid}/0_0",
0
+ exp.to_yaml,
0
+ { "CONTENT_TYPE" => "application/yaml" })
0
 
0
- get_it(
0
- "/expressions/#{fei.wfid}/0_0",
0
- :env => { 'HTTP_ACCEPT' => "application/yaml" })
0
+ assert_equal(
0
+ "http://example.org/expressions/#{fei.wfid}/0_0",
0
+ @response["Location"])
0
 
0
- exp = YAML.load @response.body
0
+ get_it(
0
+ "/expressions/#{fei.wfid}/0_0",
0
+ :env => { 'HTTP_ACCEPT' => "application/yaml" })
0
 
0
- assert_equal :surf, exp.attributes[:toto]
0
+ exp = YAML.load @response.body
0
 
0
- $engine.cancel_process fei
0
+ assert_equal :surf, exp.attributes[:toto]
0
 
0
- sleep 0.350
0
- end
0
+ $engine.cancel_process fei
0
+
0
+ sleep 0.350
0
+ end
0
 end
0
 
...
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
...
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
0
@@ -20,69 +20,69 @@ require 'testbase'
0
 
0
 class StParticipantsTest < Test::Unit::TestCase
0
 
0
- include TestBase
0
+ include TestBase
0
 
0
- include Sinatra::Builder
0
- include Sinatra::RenderingHelpers
0
+ include Sinatra::Builder
0
+ include Sinatra::RenderingHelpers
0
 
0
 
0
- def test_0
0
+ def test_0
0
 
0
- get_it "/participants"
0
+ get_it "/participants"
0
 
0
- assert_equal 200, @response.status
0
- assert_equal "application/xml", @response["Content-Type"]
0
+ assert_equal 200, @response.status
0
+ assert_equal "application/xml", @response["Content-Type"]
0
 
0
- post_it(
0
- "/participants",
0
- '["toto","OpenWFE::HashParticipant"]',
0
- { "CONTENT_TYPE" => "application/json" })
0
+ post_it(
0
+ "/participants",
0
+ '["toto","OpenWFE::HashParticipant"]',
0
+ { "CONTENT_TYPE" => "application/json" })
0
 
0
- assert_equal 201, @response.status
0
- assert_not_equal "", @response.body
0
+ assert_equal 201, @response.status
0
+ assert_not_equal "", @response.body
0
 
0
- get_it "/participants"
0
+ get_it "/participants"
0
 
0
- #puts @response.body
0
+ #puts @response.body
0
 
0
- assert_not_nil(
0
- @response.body.index(' count="3"'), "expected 3 participants")
0
+ assert_not_nil(
0
+ @response.body.index(' count="3"'), "expected 3 participants")
0
 
0
- get_it "/participants/toto"
0
+ get_it "/participants/toto"
0
 
0
- assert_not_nil @response.body.index('>toto<')
0
+ assert_not_nil @response.body.index('>toto<')
0
 
0
- delete_it "/participants/toto"
0
+ delete_it "/participants/toto"
0
 
0
- assert_equal 303, @response.status
0
+ assert_equal 303, @response.status
0
 
0
- get_it "/participants"
0
+ get_it "/participants"
0
 
0
- #puts @response.body
0
+ #puts @response.body
0
 
0
- assert_not_nil @response.body.index(' count="2"')
0
- end
0
+ assert_not_nil @response.body.index(' count="2"')
0
+ end
0
 
0
- def test_1
0
+ def test_1
0
 
0
- post_it(
0
- "/participants",
0
- '["toto","OpenWFE::Extras::ActiveStoreParticipant", "totostore"]',
0
- { "CONTENT_TYPE" => "application/json" })
0
+ post_it(
0
+ "/participants",
0
+ '["toto","OpenWFE::Extras::ActiveStoreParticipant", "totostore"]',
0
+ { "CONTENT_TYPE" => "application/json" })
0
 
0
- assert_equal 201, @response.status
0
- assert_not_equal "", @response.body
0
+ assert_equal 201, @response.status
0
+ assert_not_equal "", @response.body
0
 
0
- get_it "/participants"
0
+ get_it "/participants"
0
 
0
- assert_not_nil(
0
- @response.body.index(' count="3"'), "expected 3 participants")
0
+ assert_not_nil(
0
+ @response.body.index(' count="3"'), "expected 3 participants")
0
 
0
- get_it "/participants?pname=toto"
0
+ get_it "/participants?pname=toto"
0
 
0
- assert_equal 200, @response.status
0
- assert_not_nil @response.body.index('toto')
0
- end
0
+ assert_equal 200, @response.status
0
+ assert_not_nil @response.body.index('toto')
0
+ end
0
 
0
 end
0
 
...
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
108
 
109
110
111
112
113
114
 
 
 
 
 
115
116
117
118
119
 
 
 
 
120
121
 
122
123
 
124
125
 
126
127
128
129
130
 
 
 
 
131
132
 
133
134
135
136
137
 
 
 
 
138
139
 
140
141
 
142
143
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
...
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
 
108
109
 
 
 
 
 
110
111
112
113
114
115
 
 
 
 
116
117
118
119
120
 
121
122
 
123
124
 
125
126
 
 
 
 
127
128
129
130
131
 
132
133
 
 
 
 
134
135
136
137
138
 
139
140
 
141
142
 
 
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
0
@@ -18,128 +18,153 @@ require 'testbase'
0
 
0
 class StProcessesTest < Test::Unit::TestCase
0
 
0
- include TestBase
0
+ include TestBase
0
 
0
- include Sinatra::Builder
0
- include Sinatra::RenderingHelpers
0
+ include Sinatra::Builder
0
+ include Sinatra::RenderingHelpers
0
 
0
 
0
- def test_0
0
+ def test_0
0
 
0
- get_it "/processes"
0
+ get_it "/processes"
0
 
0
- #p @response
0
+ #p @response
0
 
0
- assert_equal(
0
- "application/xml",
0
- @response.content_type)
0
+ assert_equal(
0
+ "application/xml",
0
+ @response.content_type)
0
 
0
- assert_equal(
0
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<processes count=\"0\">\n</processes>\n",
0
- @response.body)
0
- end
0
+ assert_equal(
0
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<processes count=\"0\">\n</processes>\n",
0
+ @response.body)
0
+ end
0
 
0
- def test_1
0
+ def test_1
0
 
0
- li = OpenWFE::LaunchItem.new <<-EOS
0
- class TestStProcesses < OpenWFE::ProcessDefinition
0
- sequence do
0
- alpha
0
- bravo
0
- end
0
- end
0
- EOS
0
- #li.attributes.merge!(
0
- # "customer" => "toto", "amount" => 5, "discount" => false )
0
- #puts
0
- #puts OpenWFE::Xml.launchitem_to_xml(li, 2)
0
- #puts
0
+ li = OpenWFE::LaunchItem.new <<-EOS
0
+ class TestStProcesses < OpenWFE::ProcessDefinition
0
+ sequence do
0
+ alpha
0
+ bravo
0
+ end
0
+ end
0
+ EOS
0
+ #li.attributes.merge!(
0
+ # "customer" => "toto", "amount" => 5, "discount" => false )
0
+ #puts
0
+ #puts OpenWFE::Xml.launchitem_to_xml(li, 2)
0
+ #puts
0
 
0
- post_it(
0
- "/processes",
0
- OpenWFE::Xml.launchitem_to_xml(li, 2),
0
- { "CONTENT_TYPE" => "application/xml" })
0
+ post_it(
0
+ "/processes",
0
+ OpenWFE::Xml.launchitem_to_xml(li, 2),
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- fei = OpenWFE::Xml.fei_from_xml @response.body
0
+ fei = OpenWFE::Xml.fei_from_xml @response.body
0
 
0
- assert_equal 201, @response.status
0
- assert_equal "TestStProcesses", fei.workflow_definition_name
0
- assert_not_nil @response["Location"]
0
+ assert_equal 201, @response.status
0
+ assert_equal "TestStProcesses", fei.workflow_definition_name
0
+ assert_not_nil @response["Location"]
0
 
0
- sleep 0.350
0
+ sleep 0.350
0
 
0
- get_it "/processes"
0
+ get_it "/processes"
0
 
0
- assert_not_nil @response.body.index(fei.wfid)
0
+ assert_not_nil @response.body.index(fei.wfid)
0
 
0
- get_it "/processes/#{fei.wfid}"
0
- #puts
0
- #puts @response.body
0
- #puts
0
+ get_it "/processes/#{fei.wfid}"
0
+ #puts
0
+ #puts @response.body
0
+ #puts
0
 
0
- assert_not_nil @response.body.index("<wfid>#{fei.wfid}</wfid>")
0
+ assert_not_nil @response.body.index("<wfid>#{fei.wfid}</wfid>")
0
 
0
- get_it "/processes/#{fei.wfid}/representation"
0
+ get_it "/processes/#{fei.wfid}/representation"
0
 
0
- js = JSON.parse(@response.body)
0
- assert_kind_of Array, js
0
- assert_equal "application/json", @response["Content-Type"]
0
+ js = JSON.parse(@response.body)
0
+ assert_kind_of Array, js
0
+ assert_equal "application/json", @response["Content-Type"]
0
 
0
- delete_it "/processes/#{fei.wfid}"
0
+ delete_it "/processes/#{fei.wfid}"
0
 
0
- assert_equal 303, @response.status
0
+ assert_equal 303, @response.status
0
 
0
- sleep 0.350
0
+ sleep 0.350
0
 
0
- get_it "/processes"
0
+ get_it "/processes"
0
 
0
- assert_not_nil @response.body.index('count="0"')
0
+ assert_not_nil @response.body.index('count="0"')
0
 
0
- get_it "/processes/#{fei.wfid}"
0
+ get_it "/processes/#{fei.wfid}"
0
 
0
- assert_equal 404, @response.status
0
- end
0
+ assert_equal 404, @response.status
0
+ end
0
 
0
- #
0
- # pause / resume
0
- #
0
- def test_2
0
+ #
0
+ # pause / resume
0
+ #
0
+ def test_2
0
 
0
- $engine.register_participant :alpha, OpenWFE::HashParticipant
0
+ $engine.register_participant :alpha, OpenWFE::HashParticipant
0
 
0
- li = OpenWFE::LaunchItem.new <<-EOS
0
- class TestStProcesses < OpenWFE::ProcessDefinition
0
- alpha
0
- end
0
- EOS
0
+ li = OpenWFE::LaunchItem.new <<-EOS
0
+ class TestStProcesses < OpenWFE::ProcessDefinition
0
+ alpha
0
+ end
0
+ EOS
0
 
0
- post_it(
0
- "/processes",
0
- OpenWFE::Xml.launchitem_to_xml(li, 2),
0
- { "CONTENT_TYPE" => "application/xml" })
0
+ post_it(
0
+ "/processes",
0
+ OpenWFE::Xml.launchitem_to_xml(li, 2),
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- fei = OpenWFE::Xml.fei_from_xml @response.body
0
+ fei = OpenWFE::Xml.fei_from_xml @response.body
0
 
0
- sleep 0.350
0
+ sleep 0.350
0
 
0
- get_it "/processes/#{fei.wfid}"
0
+ get_it "/processes/#{fei.wfid}"
0
 
0
- put_it(
0
- "/processes/#{fei.wfid}",
0
- "<process><paused>true</paused></process>",
0
- { "CONTENT_TYPE" => "application/xml" })
0
+ put_it(
0
+ "/processes/#{fei.wfid}",
0
+ "<process><paused>true</paused></process>",
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- assert_not_nil @response.body.index('<paused>true</paused>')
0
+ assert_not_nil @response.body.index('<paused>true</paused>')
0
 
0
- put_it(
0
- "/processes/#{fei.wfid}",
0
- "<process><paused>false</paused></process>",
0
- { "CONTENT_TYPE" => "application/xml" })
0
+ put_it(
0
+ "/processes/#{fei.wfid}",
0
+ "<process><paused>false</paused></process>",
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- assert_not_nil @response.body.index('<paused>false</paused>')
0
+ assert_not_nil @response.body.index('<paused>false</paused>')
0
 
0
- $engine.cancel_process fei
0
+ $engine.cancel_process fei
0
 
0
- sleep 0.350
0
- end
0
+ sleep 0.350
0
+ end
0
+
0
+ #
0
+ # schedules
0
+ #
0
+ def _test_3
0
+
0
+ $engine.register_participant :alpha, OpenWFE::HashParticipant
0
+
0
+ li = OpenWFE::LaunchItem.new <<-EOS
0
+ class TestStProcesses < OpenWFE::ProcessDefinition
0
+ alpha
0
+ end
0
+ EOS
0
+
0
+ post_it(
0
+ "/processes",
0
+ OpenWFE::Xml.launchitem_to_xml(li, 2),
0
+ { "CONTENT_TYPE" => "application/xml" })
0
+
0
+ fei = OpenWFE::Xml.fei_from_xml @response.body
0
+
0
+ sleep 0.350
0
+
0
+ get_it "/processes/#{fei.wfid}"
0
+ end
0
 end
...
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
108
 
109
110
 
111
112
 
 
113
114
115
116
 
 
 
 
 
 
 
117
118
119
...
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
108
109
 
 
 
110
111
112
113
114
115
116
117
118
119
0
@@ -21,99 +21,99 @@ require 'testbase'
0
 
0
 class StWorkitemsTest < Test::Unit::TestCase
0
 
0
- include TestBase
0
+ include TestBase
0
 
0
- include Sinatra::Builder
0
- include Sinatra::RenderingHelpers
0
-
0
+ include Sinatra::Builder
0
+ include Sinatra::RenderingHelpers
0
 
0
- def test_0
0
 
0
- fei = $engine.launch <<-EOS
0
- class Test0 < OpenWFE::ProcessDefinition
0
- sequence do
0
- alpha
0
- bravo
0
- end
0
- end
0
- EOS
0
+ def test_0
0
 
0
- sleep 0.200
0
+ fei = $engine.launch <<-EOS
0
+ class Test0 < OpenWFE::ProcessDefinition
0
+ sequence do
0
+ alpha
0
+ bravo
0
+ end
0
+ end
0
+ EOS
0
 
0
- assert_equal 1, OpenWFE::Extras::Workitem.find(:all).size
0
+ sleep 0.200
0
 
0
- get_it '/workitems'
0
+ assert_equal 1, OpenWFE::Extras::Workitem.find(:all).size
0
 
0
- #p @response.status
0
- #puts @response.body
0
+ get_it '/workitems'
0
 
0
- workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
+ #p @response.status
0
+ #puts @response.body
0
 
0
- assert_equal 1, workitems.size
0
+ workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
 
0
- get_it workitems.first._uri
0
+ assert_equal 1, workitems.size
0
 
0
- workitem = OpenWFE::Xml.workitem_from_xml @response.body
0
+ get_it workitems.first._uri
0
 
0
- assert_equal workitems.first._uri, workitem._uri
0
+ workitem = OpenWFE::Xml.workitem_from_xml @response.body
0
 
0
- #
0
- # get /workitems?wfid=x
0
+ assert_equal workitems.first._uri, workitem._uri
0
 
0
- get_it "/workitems?wfid=#{fei.wfid}"
0
+ #
0
+ # get /workitems?wfid=x
0
 
0
- workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
+ get_it "/workitems?wfid=#{fei.wfid}"
0
 
0
- assert_equal 1, workitems.size
0
+ workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
 
0
- get_it "/workitems?wfid=#{fei.wfid}nada"
0
+ assert_equal 1, workitems.size
0
 
0
- workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
+ get_it "/workitems?wfid=#{fei.wfid}nada"
0
 
0
- assert_equal 0, workitems.size
0
+ workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
 
0
- #
0
- # save workitem
0
+ assert_equal 0, workitems.size
0
 
0
- workitem.owner = "toto"
0
+ #
0
+ # save workitem
0
 
0
- put_it(
0
- workitem._uri,
0
- OpenWFE::Xml.workitem_to_xml(workitem),
0
- { "CONTENT_TYPE" => "application/xml" })
0
-
0
- get_it workitem._uri
0
+ workitem.owner = "toto"
0
 
0
- workitem = OpenWFE::Xml.workitem_from_xml @response.body
0
+ put_it(
0
+ workitem._uri,
0
+ OpenWFE::Xml.workitem_to_xml(workitem),
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- assert_equal "toto", workitem.owner
0
+ get_it workitem._uri
0
 
0
- #
0
- # proceed workitem
0
+ workitem = OpenWFE::Xml.workitem_from_xml @response.body
0
 
0
- workitem._state = "proceeded"
0
+ assert_equal "toto", workitem.owner
0
 
0
- put_it(
0
- workitem._uri,
0
- OpenWFE::Xml.workitem_to_xml(workitem),
0
- { "CONTENT_TYPE" => "application/xml" })
0
+ #
0
+ # proceed workitem
0
 
0
- sleep 0.350
0
+ workitem._state = "proceeded"
0
 
0
- get_it workitem._uri
0
+ put_it(
0
+ workitem._uri,
0
+ OpenWFE::Xml.workitem_to_xml(workitem),
0
+ { "CONTENT_TYPE" => "application/xml" })
0
 
0
- assert_equal 404, @response.status
0
+ sleep 0.350
0
 
0
- #
0
- # proceeded ?
0
+ get_it workitem._uri
0
 
0
- get_it '/workitems'
0
+ assert_equal 404, @response.status
0
 
0
- workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
+ #
0
+ # proceeded ?
0
 
0
- assert_equal 1, workitems.size
0
- assert_equal "bravo", workitems.first.participant_name
0
- end
0
+ get_it '/workitems'
0
+
0
+ workitems = OpenWFE::Xml.workitems_from_xml @response.body
0
+
0
+ assert_equal 1, workitems.size
0
+ assert_equal "bravo", workitems.first.participant_name
0
+ end
0
 
0
 end
0