t2-server 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +1 -0
- data/.ruby-env +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -1
- data/CHANGES.rdoc +49 -0
- data/README.rdoc +10 -8
- data/bin/t2-delete-runs +0 -3
- data/lib/t2-server-cli.rb +16 -9
- data/lib/t2-server/exceptions.rb +7 -19
- data/lib/t2-server/net/connection.rb +14 -6
- data/lib/t2-server/net/credentials.rb +12 -1
- data/lib/t2-server/net/parameters.rb +3 -3
- data/lib/t2-server/port.rb +12 -29
- data/lib/t2-server/run.rb +54 -35
- data/lib/t2-server/server.rb +3 -4
- data/lib/t2-server/xml.rb +0 -1
- data/lib/t2-server/xml/methods.rb +97 -4
- data/t2-server.gemspec +4 -1
- data/test/helpers/fake-run.rb +47 -0
- data/test/helpers/test-cache.rb +49 -0
- data/test/helpers/test-xml.rb +36 -0
- data/test/helpers/timezone.rb +39 -0
- data/test/mocked-server-responses/.gitattributes +1 -0
- data/test/mocked-server-responses/get-admin.raw +6 -0
- data/test/mocked-server-responses/get-rest-policy-runlimit.raw +6 -0
- data/test/mocked-server-responses/get-rest-policy.raw +6 -0
- data/test/mocked-server-responses/get-rest-run-input-expected.raw +6 -0
- data/test/mocked-server-responses/get-rest-run-input.raw +6 -0
- data/test/mocked-server-responses/get-rest-run-interaction-feed-0.raw +11 -0
- data/test/mocked-server-responses/get-rest-run-interaction-feed-1.raw +92 -0
- data/test/mocked-server-responses/get-rest-run-interaction-feed-2.raw +80 -0
- data/test/mocked-server-responses/get-rest-run-name.raw +6 -0
- data/test/mocked-server-responses/get-rest-run-output-list-errors.raw +6 -0
- data/test/mocked-server-responses/get-rest-run-output.raw +6 -0
- data/test/mocked-server-responses/get-rest-run-security-permissions.raw +6 -0
- data/test/mocked-server-responses/get-rest-run-security.raw +6 -0
- data/test/mocked-server-responses/get-rest-run.raw +6 -0
- data/test/mocked-server-responses/get-rest-runs.raw +6 -0
- data/test/mocked-server-responses/get-rest.raw +6 -0
- data/test/mocked-server-responses/log.txt +1 -0
- data/test/mocked-server-responses/mocks.rb +107 -0
- data/test/mocked-server-responses/options-admin-allownew.raw +7 -0
- data/test/tc_admin.rb +52 -24
- data/test/tc_admin_live.rb +66 -0
- data/test/tc_connection.rb +87 -0
- data/test/tc_connection_exceptions.rb +86 -0
- data/test/tc_credentials.rb +73 -0
- data/test/tc_interaction.rb +182 -0
- data/test/{tc_misc.rb → tc_misc_live.rb} +3 -1
- data/test/tc_params.rb +82 -4
- data/test/tc_perms.rb +54 -101
- data/test/tc_perms_live.rb +150 -0
- data/test/tc_ports.rb +192 -0
- data/test/tc_run.rb +333 -350
- data/test/tc_run_live.rb +453 -0
- data/test/{tc_secure.rb → tc_secure_live.rb} +30 -29
- data/test/tc_server.rb +115 -42
- data/test/tc_server_live.rb +92 -0
- data/test/tc_server_version.rb +19 -0
- data/test/tc_xml_messages.rb +201 -0
- data/test/ts_t2server.rb +37 -43
- data/test/workflows/secure/heater-pk.pem +24 -18
- data/test/workflows/secure/user-cert.p12 +0 -0
- data/version.yml +1 -1
- metadata +136 -29
- data/lib/t2-server/xml/fragments.rb +0 -78
data/test/tc_run_live.rb
ADDED
@@ -0,0 +1,453 @@
|
|
1
|
+
# Copyright (c) 2010-2014 The University of Manchester, UK.
|
2
|
+
#
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
# this list of conditions and the following disclaimer in the documentation
|
13
|
+
# and/or other materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# * Neither the names of The University of Manchester nor the names of its
|
16
|
+
# contributors may be used to endorse or promote products derived from this
|
17
|
+
# software without specific prior written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
23
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
24
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
#
|
31
|
+
# Author: Robert Haines
|
32
|
+
|
33
|
+
require 't2-server'
|
34
|
+
|
35
|
+
require 'helpers/test-cache'
|
36
|
+
|
37
|
+
class TestRun < Test::Unit::TestCase
|
38
|
+
|
39
|
+
WKF_PASS = "test/workflows/pass_through.t2flow"
|
40
|
+
WKF_LISTS = "test/workflows/empty_list.t2flow"
|
41
|
+
WKF_L_V = "test/workflows/list_and_value.t2flow"
|
42
|
+
WKF_XML = "test/workflows/xml_xpath.t2flow"
|
43
|
+
WKF_FAIL = "test/workflows/always_fail.t2flow"
|
44
|
+
WKF_ERRORS = "test/workflows/list_with_errors.t2flow"
|
45
|
+
WKF_NO_IO = "test/workflows/no-ports.t2flow"
|
46
|
+
|
47
|
+
LIST_INPUT = "test/workflows/empty_list_input.baclava"
|
48
|
+
FILE_INPUT = "test/workflows/in.txt"
|
49
|
+
FILE_STRS = "test/workflows/strings.txt"
|
50
|
+
|
51
|
+
# Test run connection
|
52
|
+
def test_run_create_and_delete
|
53
|
+
assert_nothing_raised(T2Server::ConnectionError) do
|
54
|
+
run = T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params)
|
55
|
+
assert_equal(run.status, :initialized)
|
56
|
+
assert(run.delete)
|
57
|
+
assert(run.deleted?)
|
58
|
+
assert_equal(run.status, :deleted)
|
59
|
+
assert_nothing_raised(T2Server::AttributeNotFoundError) do
|
60
|
+
assert(run.delete) # Should still return true, not raise 404
|
61
|
+
end
|
62
|
+
assert(run.delete) # Should still return true
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Test misc run functions
|
67
|
+
def test_status_codes
|
68
|
+
T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params) do |run|
|
69
|
+
|
70
|
+
# test mkdir
|
71
|
+
assert(run.mkdir("test"))
|
72
|
+
|
73
|
+
# set input, start, check state and wait
|
74
|
+
assert_nothing_raised(T2Server::AttributeNotFoundError) do
|
75
|
+
run.input_port("IN").value = "Hello, World!"
|
76
|
+
end
|
77
|
+
assert_equal(run.input_port("IN").value, "Hello, World!")
|
78
|
+
|
79
|
+
# test correct/incorrect status codes
|
80
|
+
assert_equal(run.status, :initialized)
|
81
|
+
assert_raise(T2Server::RunStateError) { run.wait }
|
82
|
+
assert_nothing_raised(T2Server::RunStateError) { run.start }
|
83
|
+
assert(run.running?)
|
84
|
+
assert_equal(run.status, :running)
|
85
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
86
|
+
assert_equal(run.status, :finished)
|
87
|
+
assert_raise(T2Server::RunStateError) { run.start }
|
88
|
+
|
89
|
+
# exitcode and output
|
90
|
+
assert_instance_of(Fixnum, run.exitcode)
|
91
|
+
assert_equal(run.output_port("OUT").value, "Hello, World!")
|
92
|
+
assert_equal(run.output_port("wrong!"), nil)
|
93
|
+
|
94
|
+
# get zip file
|
95
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
96
|
+
zip_out = run.zip_output
|
97
|
+
assert_not_equal(zip_out, "")
|
98
|
+
end
|
99
|
+
|
100
|
+
# test streaming zip data
|
101
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
102
|
+
zip_cache = TestCache.new
|
103
|
+
run.zip_output(zip_cache)
|
104
|
+
end
|
105
|
+
|
106
|
+
# show getting a zip file of a singleton port does nothing
|
107
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
108
|
+
assert_nil(run.output_port("OUT").zip)
|
109
|
+
|
110
|
+
zip_cache = TestCache.new
|
111
|
+
run.output_port("OUT").zip(zip_cache)
|
112
|
+
assert_equal(zip_cache.data, "")
|
113
|
+
end
|
114
|
+
|
115
|
+
# deletion
|
116
|
+
assert(run.delete)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Test run naming. This is different for different versions of server.
|
121
|
+
def test_run_naming
|
122
|
+
T2Server::Server.new($uri, $conn_params) do |server|
|
123
|
+
server.create_run(WKF_NO_IO, $creds) do |run|
|
124
|
+
if server.version >= "2.5.0"
|
125
|
+
# Read initial name.
|
126
|
+
assert(run.name.length > 0)
|
127
|
+
assert_equal("Workflow1", run.name[0...9])
|
128
|
+
|
129
|
+
# Set a new name and test.
|
130
|
+
name = "No input or output"
|
131
|
+
assert(run.name = name)
|
132
|
+
assert(run.name.length == 18)
|
133
|
+
assert_equal(name, run.name)
|
134
|
+
|
135
|
+
# Set a name that is too long
|
136
|
+
long_name = "0123456789012345678901234567890123456789ABCDEFGHIJ"
|
137
|
+
assert(run.name = long_name)
|
138
|
+
assert(run.name.length == 48)
|
139
|
+
assert_equal(long_name[0...48], run.name)
|
140
|
+
else
|
141
|
+
# Read initial name.
|
142
|
+
assert(run.name.length == 0)
|
143
|
+
assert_equal("", run.name)
|
144
|
+
|
145
|
+
# "Set" a new name and test.
|
146
|
+
assert(run.name = "test")
|
147
|
+
assert(run.name.length == 0)
|
148
|
+
assert_equal("", run.name)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# Test run with no input or output. Also, pre-load workflow into a String.
|
155
|
+
def test_run_no_ports
|
156
|
+
workflow = File.read(WKF_NO_IO)
|
157
|
+
|
158
|
+
T2Server::Run.create($uri, workflow, $creds, $conn_params) do |run|
|
159
|
+
assert_nothing_raised { run.input_ports }
|
160
|
+
assert_nothing_raised { run.start }
|
161
|
+
assert(run.running?)
|
162
|
+
run.wait
|
163
|
+
assert_nothing_raised { run.output_ports }
|
164
|
+
assert(run.delete)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Test run with list inputs
|
169
|
+
def test_run_list_input
|
170
|
+
T2Server::Run.create($uri, WKF_LISTS, $creds, $conn_params) do |run|
|
171
|
+
many = [[["boo"]], [["", "Hello"]], [], [[], ["test"], []]]
|
172
|
+
single = [1, 2, 3, 4, 5]
|
173
|
+
single_out = single.map { |v| v.to_s } # Taverna outputs strings!
|
174
|
+
|
175
|
+
run.input_port("SINGLE_IN").value = single
|
176
|
+
run.input_port("MANY_IN").value = many
|
177
|
+
assert_nothing_raised { run.start }
|
178
|
+
assert(run.running?)
|
179
|
+
run.wait
|
180
|
+
|
181
|
+
assert_equal(run.output_port("MANY").value, many)
|
182
|
+
assert_equal(run.output_port("SINGLE").value, single_out)
|
183
|
+
|
184
|
+
# get zip file of a single port and test streaming
|
185
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
186
|
+
zip_out = run.output_port("MANY").zip
|
187
|
+
assert_not_equal(zip_out, "")
|
188
|
+
end
|
189
|
+
|
190
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
191
|
+
zip_cache = TestCache.new
|
192
|
+
run.output_port("MANY").zip(zip_cache)
|
193
|
+
end
|
194
|
+
|
195
|
+
assert(run.delete)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
# Test run with a list and file input, and check that provenance is not on
|
200
|
+
def test_run_list_and_file
|
201
|
+
T2Server::Run.create($uri, WKF_L_V, $creds, $conn_params) do |run|
|
202
|
+
list = ["one", 2, :three]
|
203
|
+
list_out = list.map { |v| v.to_s }
|
204
|
+
|
205
|
+
run.input_port("list_in").value = list
|
206
|
+
run.input_port("singleton_in").file = FILE_INPUT
|
207
|
+
assert_nothing_raised { run.start }
|
208
|
+
assert(run.running?)
|
209
|
+
run.wait
|
210
|
+
|
211
|
+
assert_equal(run.output_port("list_out").value, list_out)
|
212
|
+
assert_equal(run.output_port("singleton_out").value, "Hello, World!")
|
213
|
+
|
214
|
+
# Get the log file
|
215
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
216
|
+
assert_not_equal(run.log, "")
|
217
|
+
end
|
218
|
+
|
219
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
220
|
+
log_cache = TestCache.new
|
221
|
+
run.log(log_cache)
|
222
|
+
assert_not_equal(log_cache.size, 0)
|
223
|
+
end
|
224
|
+
|
225
|
+
assert_raise(T2Server::AccessForbiddenError) do
|
226
|
+
run.provenance
|
227
|
+
end
|
228
|
+
|
229
|
+
assert(run.delete)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# Test run with xml input
|
234
|
+
def test_run_xml_input
|
235
|
+
T2Server::Run.create($uri, WKF_XML, $creds, $conn_params) do |run|
|
236
|
+
run.input_port("xml").value =
|
237
|
+
"<hello><yes>hello</yes><no>everybody</no><yes>world</yes></hello>"
|
238
|
+
run.input_port("xpath").value = "//yes"
|
239
|
+
run.start
|
240
|
+
run.wait
|
241
|
+
assert_equal(run.output_port("nodes").value, ["hello", "world"])
|
242
|
+
assert(run.delete)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
# Test run with file input. Also pass workflow as File object. Also test
|
247
|
+
# toggling provenance on and then off again.
|
248
|
+
def test_run_file_input
|
249
|
+
workflow = File.open(WKF_PASS, "r")
|
250
|
+
|
251
|
+
T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params) do |run|
|
252
|
+
|
253
|
+
assert_nothing_raised(T2Server::AttributeNotFoundError) do
|
254
|
+
run.input_port("IN").file = FILE_INPUT
|
255
|
+
run.generate_provenance
|
256
|
+
run.generate_provenance(false)
|
257
|
+
end
|
258
|
+
refute run.generate_provenance?
|
259
|
+
|
260
|
+
run.start
|
261
|
+
assert(run.running?)
|
262
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
263
|
+
assert_equal(run.output_port("OUT").value, "Hello, World!")
|
264
|
+
|
265
|
+
assert_raise(T2Server::AccessForbiddenError) do
|
266
|
+
run.provenance
|
267
|
+
end
|
268
|
+
|
269
|
+
assert(run.delete)
|
270
|
+
end
|
271
|
+
|
272
|
+
workflow.close
|
273
|
+
end
|
274
|
+
|
275
|
+
# Test run that returns list of lists, some empty, using baclava for input
|
276
|
+
# Also test provenance output works with baclava input
|
277
|
+
def test_baclava_input
|
278
|
+
T2Server::Run.create($uri, WKF_LISTS, $creds, $conn_params) do |run|
|
279
|
+
assert_nothing_raised(T2Server::AttributeNotFoundError) do
|
280
|
+
run.baclava_input = LIST_INPUT
|
281
|
+
run.generate_provenance
|
282
|
+
end
|
283
|
+
|
284
|
+
if run.server.version >= "2.5.4"
|
285
|
+
assert(run.generate_provenance?)
|
286
|
+
else
|
287
|
+
refute(run.generate_provenance?)
|
288
|
+
end
|
289
|
+
|
290
|
+
assert_equal(run.input_ports.keys.sort, ["MANY_IN", "SINGLE_IN"])
|
291
|
+
assert_equal(run.input_port("MANY_IN").depth, 3)
|
292
|
+
assert_equal(run.input_port("SINGLE_IN").depth, 1)
|
293
|
+
assert(run.baclava_input?)
|
294
|
+
assert(run.input_port("SINGLE_IN").baclava?)
|
295
|
+
assert(run.input_port("SINGLE_IN").set?)
|
296
|
+
|
297
|
+
run.start
|
298
|
+
assert(run.running?)
|
299
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
300
|
+
assert_equal(run.output_ports.keys.sort, ["MANY", "SINGLE"])
|
301
|
+
assert_equal(run.output_port("SINGLE").value, [])
|
302
|
+
assert(!run.output_port("SINGLE").empty?)
|
303
|
+
assert_equal(run.output_port("MANY").value,
|
304
|
+
[[["boo"]], [["", "Hello"]], [], [[], ["test"], []]])
|
305
|
+
assert_equal(run.output_port("MANY").total_size, 12)
|
306
|
+
assert(run.output_port("MANY")[1][0][0].empty?)
|
307
|
+
assert_equal(run.output_port("MANY")[1][0][1].value(1..3), "ell")
|
308
|
+
assert_raise(NoMethodError) { run.output_port("SINGLE")[0].value }
|
309
|
+
|
310
|
+
# Grab provenance
|
311
|
+
if run.server.version >= "2.5.4"
|
312
|
+
assert_nothing_raised(T2Server::AccessForbiddenError) do
|
313
|
+
prov = run.provenance
|
314
|
+
assert_not_equal(prov, "")
|
315
|
+
end
|
316
|
+
else
|
317
|
+
assert_raise(T2Server::AccessForbiddenError) do
|
318
|
+
prov = run.provenance
|
319
|
+
assert_equal(prov, "")
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
assert(run.delete)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
# Test run with baclava output
|
328
|
+
def test_baclava_output
|
329
|
+
T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params) do |run|
|
330
|
+
run.input_port("IN").value = "Some input..."
|
331
|
+
assert_nothing_raised(T2Server::AttributeNotFoundError) do
|
332
|
+
run.generate_baclava_output
|
333
|
+
end
|
334
|
+
assert(run.generate_baclava_output?)
|
335
|
+
|
336
|
+
run.start
|
337
|
+
assert(run.running?)
|
338
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
339
|
+
|
340
|
+
# Test normal and streamed output
|
341
|
+
assert_nothing_raised(T2Server::AccessForbiddenError) do
|
342
|
+
output = run.baclava_output
|
343
|
+
|
344
|
+
out_stream = ""
|
345
|
+
run.baclava_output do |chunk|
|
346
|
+
out_stream += chunk
|
347
|
+
end
|
348
|
+
assert_equal(output, out_stream)
|
349
|
+
end
|
350
|
+
|
351
|
+
assert(run.delete)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# Test partial result download and provenance streaming
|
356
|
+
def test_result_download
|
357
|
+
T2Server::Run.create($uri, WKF_PASS, $creds, $conn_params) do |run|
|
358
|
+
assert_nothing_raised(T2Server::AttributeNotFoundError) do
|
359
|
+
file = run.upload_file(FILE_STRS)
|
360
|
+
run.input_port("IN").remote_file = file
|
361
|
+
run.generate_provenance(true)
|
362
|
+
end
|
363
|
+
|
364
|
+
if run.server.version >= "2.5.4"
|
365
|
+
assert(run.generate_provenance?)
|
366
|
+
else
|
367
|
+
refute(run.generate_provenance?)
|
368
|
+
end
|
369
|
+
|
370
|
+
run.start
|
371
|
+
run.wait
|
372
|
+
|
373
|
+
# Get total data size (without downloading the data).
|
374
|
+
assert_equal(run.output_port("OUT").total_size, 100)
|
375
|
+
assert_equal(run.output_port("OUT").size, 100)
|
376
|
+
|
377
|
+
# Stream just the first 10 bytes.
|
378
|
+
stream = ""
|
379
|
+
run.output_port("OUT").value(0...10) do |chunk|
|
380
|
+
stream += chunk
|
381
|
+
end
|
382
|
+
assert_equal(stream, "123456789\n")
|
383
|
+
|
384
|
+
# Get just the second 10 bytes.
|
385
|
+
assert_equal(run.output_port("OUT").value(10...20),
|
386
|
+
"223456789\n")
|
387
|
+
|
388
|
+
# Stream the first 20 bytes.
|
389
|
+
stream = ""
|
390
|
+
run.output_port("OUT").value(0...20) do |chunk|
|
391
|
+
stream += chunk
|
392
|
+
end
|
393
|
+
assert_equal(stream, "123456789\n223456789\n")
|
394
|
+
|
395
|
+
# Get a bad range - should return the first 10 bytes.
|
396
|
+
assert_equal(run.output_port("OUT").value(-10...10),
|
397
|
+
"123456789\n")
|
398
|
+
|
399
|
+
# Stream the lot and check total length. There should be two chunks.
|
400
|
+
stream = ""
|
401
|
+
run.output_port("OUT").value do |chunk|
|
402
|
+
stream += chunk
|
403
|
+
end
|
404
|
+
assert_equal(stream.length, 100)
|
405
|
+
|
406
|
+
# Now get the lot and check its size.
|
407
|
+
out = run.output_port("OUT").value
|
408
|
+
assert_equal(out.length, 100)
|
409
|
+
|
410
|
+
# test streaming provenance data
|
411
|
+
if run.server.version >= "2.5.4"
|
412
|
+
assert_nothing_raised(T2Server::AccessForbiddenError) do
|
413
|
+
prov_cache = TestCache.new
|
414
|
+
prov_size = run.provenance(prov_cache)
|
415
|
+
assert_not_equal(prov_size, 0)
|
416
|
+
assert_not_equal(prov_cache.data, "")
|
417
|
+
end
|
418
|
+
else
|
419
|
+
assert_raise(T2Server::AccessForbiddenError) do
|
420
|
+
prov_cache = TestCache.new
|
421
|
+
prov_size = run.provenance(prov_cache)
|
422
|
+
assert_equal(prov_size, 0)
|
423
|
+
assert_equal(prov_cache.data, "")
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
assert(run.delete)
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
431
|
+
# test error handling
|
432
|
+
def test_always_fail
|
433
|
+
T2Server::Run.create($uri, WKF_FAIL, $creds, $conn_params) do |run|
|
434
|
+
run.start
|
435
|
+
run.wait
|
436
|
+
assert_not_nil(run.output_port("OUT").value)
|
437
|
+
assert(run.output_port("OUT").error?)
|
438
|
+
assert(run.delete)
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
def test_errors
|
443
|
+
T2Server::Run.create($uri, WKF_ERRORS, $creds, $conn_params) do |run|
|
444
|
+
run.start
|
445
|
+
assert(!run.error?)
|
446
|
+
run.wait
|
447
|
+
assert_not_nil(run.output_port("OUT").value)
|
448
|
+
assert(run.output_port("OUT").error?)
|
449
|
+
assert(run.error?)
|
450
|
+
assert(run.delete)
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|