t2-server 0.6.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rvmrc +1 -0
- data/CHANGES.rdoc +48 -0
- data/LICENCE.rdoc +2 -2
- data/README.rdoc +245 -10
- data/Rakefile +108 -0
- data/bin/t2-delete-runs +21 -34
- data/bin/t2-get-output +134 -0
- data/bin/t2-run-workflow +121 -109
- data/bin/t2-server-admin +128 -0
- data/bin/t2-server-info +25 -38
- data/lib/t2-server-cli.rb +116 -0
- data/lib/t2-server.rb +16 -27
- data/lib/t2-server/admin.rb +147 -0
- data/lib/t2-server/connection-parameters.rb +144 -0
- data/lib/t2-server/connection.rb +352 -0
- data/lib/t2-server/credentials.rb +84 -0
- data/lib/t2-server/exceptions.rb +42 -21
- data/lib/t2-server/port.rb +472 -0
- data/lib/t2-server/run.rb +822 -227
- data/lib/t2-server/server.rb +313 -317
- data/lib/t2-server/util.rb +71 -0
- data/lib/t2-server/xml/libxml.rb +87 -0
- data/lib/t2-server/xml/nokogiri.rb +85 -0
- data/lib/t2-server/xml/rexml.rb +85 -0
- data/lib/t2-server/xml/xml.rb +111 -0
- data/lib/t2server.rb +4 -1
- data/t2-server.gemspec +112 -0
- data/test/tc_admin.rb +63 -0
- data/test/{tc_paths.rb → tc_params.rb} +11 -25
- data/test/tc_perms.rb +132 -0
- data/test/tc_run.rb +200 -67
- data/test/tc_secure.rb +191 -0
- data/test/tc_server.rb +25 -23
- data/test/tc_util.rb +74 -0
- data/test/ts_t2server.rb +57 -12
- data/test/workflows/always_fail.t2flow +69 -0
- data/test/workflows/list_and_value.t2flow +12 -0
- data/test/workflows/list_with_errors.t2flow +107 -0
- data/test/workflows/secure/basic-http.t2flow +74 -0
- data/test/workflows/secure/basic-https.t2flow +74 -0
- data/test/workflows/secure/client-https.t2flow +162 -0
- data/test/workflows/secure/digest-http.t2flow +129 -0
- data/test/workflows/secure/digest-https.t2flow +107 -0
- data/test/workflows/secure/heater-pk.pem +20 -0
- data/test/workflows/secure/user-cert.p12 +0 -0
- data/test/workflows/secure/ws-http.t2flow +180 -0
- data/test/workflows/secure/ws-https.t2flow +180 -0
- data/test/workflows/strings.txt +10 -0
- data/test/workflows/xml_xpath.t2flow +136 -136
- data/version.yml +4 -0
- metadata +132 -34
- data/lib/t2-server/xml.rb +0 -86
data/test/tc_secure.rb
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
# Copyright (c) 2010-2012 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
|
+
class TestSecurity < Test::Unit::TestCase
|
36
|
+
|
37
|
+
# Details on secure tests for Taverna are here:
|
38
|
+
# http://www.mygrid.org.uk/dev/wiki/display/story/Taverna+2.x+test+secure+services+and+workflows
|
39
|
+
|
40
|
+
# User name and password for the test secure server.
|
41
|
+
USERNAME = "testuser"
|
42
|
+
PASSWORD = "testpasswd"
|
43
|
+
CERTPASS = "testcert"
|
44
|
+
|
45
|
+
# Various URIs required.
|
46
|
+
HEATER_HTTP = "http://heater.cs.man.ac.uk:7070/"
|
47
|
+
HEATER_HTTPS = "https://heater.cs.man.ac.uk:7443/"
|
48
|
+
HEATER_CAUTH = "https://heater.cs.man.ac.uk:7444/"
|
49
|
+
WS1 = "axis/services/HelloService-PlaintextPassword?wsdl"
|
50
|
+
WS2 = "axis/services/HelloService-DigestPassword?wsdl"
|
51
|
+
WS3 = "axis/services/HelloService-PlaintextPassword-Timestamp?wsdl"
|
52
|
+
WS4 = "axis/services/HelloService-DigestPassword-Timestamp?wsdl"
|
53
|
+
|
54
|
+
# Workflows
|
55
|
+
$wkf_basic_http = File.read("test/workflows/secure/basic-http.t2flow")
|
56
|
+
$wkf_digest_http = File.read("test/workflows/secure/digest-http.t2flow")
|
57
|
+
$wkf_ws_http = File.read("test/workflows/secure/ws-http.t2flow")
|
58
|
+
$wkf_basic_https = File.read("test/workflows/secure/basic-https.t2flow")
|
59
|
+
$wkf_digest_https = File.read("test/workflows/secure/digest-https.t2flow")
|
60
|
+
$wkf_ws_https = File.read("test/workflows/secure/ws-https.t2flow")
|
61
|
+
$wkf_client_https = File.read("test/workflows/secure/client-https.t2flow")
|
62
|
+
|
63
|
+
# Server public key for HTTPS peer verification.
|
64
|
+
$heater_pk = "test/workflows/secure/heater-pk.pem"
|
65
|
+
|
66
|
+
# Client private key for HTTPS authentication
|
67
|
+
$user_pk = "test/workflows/secure/user-cert.p12"
|
68
|
+
|
69
|
+
# HTTP Basic authentication
|
70
|
+
def test_basic_creds_http
|
71
|
+
T2Server::Run.create($uri, $wkf_basic_http, $creds, $conn_params) do |run|
|
72
|
+
run.add_password_credential(HEATER_HTTP, USERNAME, PASSWORD)
|
73
|
+
run.start
|
74
|
+
assert(run.running?)
|
75
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
76
|
+
assert(run.finished?)
|
77
|
+
assert_not_nil(run.output_port("out").value)
|
78
|
+
end
|
79
|
+
|
80
|
+
# now test with no credential
|
81
|
+
T2Server::Run.create($uri, $wkf_basic_http, $creds, $conn_params) do |run|
|
82
|
+
run.start
|
83
|
+
assert(run.running?)
|
84
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
85
|
+
assert(run.finished?)
|
86
|
+
assert_nil(run.output_port("out").value)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# HTTPS Basic authentication
|
91
|
+
def test_basic_creds_https
|
92
|
+
T2Server::Run.create($uri, $wkf_basic_https, $creds, $conn_params) do |run|
|
93
|
+
run.add_password_credential(HEATER_HTTPS, USERNAME, PASSWORD)
|
94
|
+
run.add_trust($heater_pk)
|
95
|
+
run.start
|
96
|
+
assert(run.running?)
|
97
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
98
|
+
assert(run.finished?)
|
99
|
+
assert_not_nil(run.output_port("out").value)
|
100
|
+
end
|
101
|
+
|
102
|
+
# now test with no server public key
|
103
|
+
T2Server::Run.create($uri, $wkf_basic_https, $creds, $conn_params) do |run|
|
104
|
+
run.add_password_credential(HEATER_HTTPS, USERNAME, PASSWORD)
|
105
|
+
run.start
|
106
|
+
assert(run.running?)
|
107
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
108
|
+
assert(run.finished?)
|
109
|
+
assert_nil(run.output_port("out").value)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# HTTP Digest authentication
|
114
|
+
def test_digest_creds_http
|
115
|
+
T2Server::Run.create($uri, $wkf_digest_http, $creds, $conn_params) do |run|
|
116
|
+
run.add_password_credential(HEATER_HTTP, USERNAME, PASSWORD)
|
117
|
+
run.start
|
118
|
+
assert(run.running?)
|
119
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
120
|
+
assert(run.finished?)
|
121
|
+
assert_not_nil(run.output_port("out").value)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# HTTPS Digest authentication
|
126
|
+
def test_digest_creds_https
|
127
|
+
T2Server::Run.create($uri, $wkf_digest_https, $creds, $conn_params) do |run|
|
128
|
+
run.add_password_credential(HEATER_HTTPS, USERNAME, PASSWORD)
|
129
|
+
run.add_trust($heater_pk)
|
130
|
+
run.start
|
131
|
+
assert(run.running?)
|
132
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
133
|
+
assert(run.finished?)
|
134
|
+
assert_not_nil(run.output_port("out").value)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# HTTP WS-Security authentication
|
139
|
+
def test_ws_creds_http
|
140
|
+
T2Server::Run.create($uri, $wkf_ws_http, $creds, $conn_params) do |run|
|
141
|
+
run.add_password_credential(HEATER_HTTP + WS1, USERNAME, PASSWORD)
|
142
|
+
run.add_password_credential(HEATER_HTTP + WS2, USERNAME, PASSWORD)
|
143
|
+
run.add_password_credential(HEATER_HTTP + WS3, USERNAME, PASSWORD)
|
144
|
+
run.add_password_credential(HEATER_HTTP + WS4, USERNAME, PASSWORD)
|
145
|
+
run.start
|
146
|
+
assert(run.running?)
|
147
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
148
|
+
assert(run.finished?)
|
149
|
+
assert_equal(run.output_port("out_plaintext").value, "Hello Alan!")
|
150
|
+
assert_equal(run.output_port("out_digest").value, "Hello Stian!")
|
151
|
+
assert_equal(run.output_port("out_plaintext_timestamp").value,
|
152
|
+
"Hello Alex!")
|
153
|
+
assert_equal(run.output_port("out_digest_timestamp").value,
|
154
|
+
"Hello David!")
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# HTTPS WS-Security authentication
|
159
|
+
def test_ws_creds_https
|
160
|
+
T2Server::Run.create($uri, $wkf_ws_https, $creds, $conn_params) do |run|
|
161
|
+
run.add_password_credential(HEATER_HTTPS + WS1, USERNAME, PASSWORD)
|
162
|
+
run.add_password_credential(HEATER_HTTPS + WS2, USERNAME, PASSWORD)
|
163
|
+
run.add_password_credential(HEATER_HTTPS + WS3, USERNAME, PASSWORD)
|
164
|
+
run.add_password_credential(HEATER_HTTPS + WS4, USERNAME, PASSWORD)
|
165
|
+
run.add_trust($heater_pk)
|
166
|
+
run.start
|
167
|
+
assert(run.running?)
|
168
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
169
|
+
assert(run.finished?)
|
170
|
+
assert_equal(run.output_port("out_plaintext").value, "Hello Alan!")
|
171
|
+
assert_equal(run.output_port("out_digest").value, "Hello Stian!")
|
172
|
+
assert_equal(run.output_port("out_plaintext_timestamp").value,
|
173
|
+
"Hello Alex!")
|
174
|
+
assert_equal(run.output_port("out_digest_timestamp").value,
|
175
|
+
"Hello David!")
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# HTTPS client certificate authentication
|
180
|
+
def test_client_cert_auth_https
|
181
|
+
T2Server::Run.create($uri, $wkf_client_https, $creds, $conn_params) do |run|
|
182
|
+
run.add_keypair_credential(HEATER_CAUTH, $user_pk, CERTPASS)
|
183
|
+
run.add_trust($heater_pk)
|
184
|
+
run.start
|
185
|
+
assert(run.running?)
|
186
|
+
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
187
|
+
assert(run.finished?)
|
188
|
+
assert_not_nil(run.output_port("out").value)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
data/test/tc_server.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010
|
1
|
+
# Copyright (c) 2010-2012 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -14,7 +14,7 @@
|
|
14
14
|
#
|
15
15
|
# * Neither the names of The University of Manchester nor the names of its
|
16
16
|
# contributors may be used to endorse or promote products derived from this
|
17
|
-
# software without specific prior written permission.
|
17
|
+
# software without specific prior written permission.
|
18
18
|
#
|
19
19
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
20
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
@@ -34,34 +34,36 @@ require 't2-server'
|
|
34
34
|
|
35
35
|
class TestServer < Test::Unit::TestCase
|
36
36
|
|
37
|
-
def
|
38
|
-
# connection
|
37
|
+
def test_server_connection
|
39
38
|
assert_nothing_raised(T2Server::ConnectionError) do
|
40
|
-
|
39
|
+
T2Server::Server.new($uri, $conn_params)
|
41
40
|
end
|
42
|
-
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
def test_run_creation_deletion
|
44
|
+
T2Server::Server.new($uri, $conn_params) do |server|
|
45
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
46
|
+
run = server.create_run($wkf_pass, $creds)
|
47
|
+
server.delete_run(run, $creds)
|
48
|
+
end
|
47
49
|
end
|
50
|
+
end
|
48
51
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
limit
|
54
|
-
|
52
|
+
# Need to do these together so testing the limit is cleaned up!
|
53
|
+
def test_server_limits_delete_all
|
54
|
+
T2Server::Server.new($uri, $conn_params) do |server|
|
55
|
+
limit = server.run_limit($creds)
|
56
|
+
assert_instance_of(Fixnum, limit)
|
57
|
+
assert_raise(T2Server::ServerAtCapacityError) do
|
58
|
+
# add 1 just in case there are no runs at this point
|
59
|
+
(limit + 1).times do
|
60
|
+
server.create_run($wkf_pass, $creds)
|
61
|
+
end
|
55
62
|
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# deleting
|
59
|
-
assert_nothing_raised(T2Server::T2ServerError) do
|
60
|
-
@run.delete
|
61
|
-
end
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
65
|
+
server.delete_all_runs($creds)
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
67
69
|
end
|
data/test/tc_util.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Copyright (c) 2010-2012 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
|
+
require 'test/unit'
|
35
|
+
|
36
|
+
class TestFilePaths < Test::Unit::TestCase
|
37
|
+
def test_path_stripping
|
38
|
+
assert_equal("dir/with/child",
|
39
|
+
T2Server::Util.strip_path_slashes("dir/with/child"))
|
40
|
+
assert_equal("dir/with/child",
|
41
|
+
T2Server::Util.strip_path_slashes("/dir/with/child"))
|
42
|
+
assert_equal("dir/with/child",
|
43
|
+
T2Server::Util.strip_path_slashes("dir/with/child/"))
|
44
|
+
assert_equal("dir/with/child",
|
45
|
+
T2Server::Util.strip_path_slashes("/dir/with/child/"))
|
46
|
+
|
47
|
+
# only remove one slash from each end
|
48
|
+
assert_equal("/dir/with/child/",
|
49
|
+
T2Server::Util.strip_path_slashes("//dir/with/child//"))
|
50
|
+
|
51
|
+
# leave double slashes in the middle of paths
|
52
|
+
assert_equal("dir/with//child",
|
53
|
+
T2Server::Util.strip_path_slashes("/dir/with//child/"))
|
54
|
+
|
55
|
+
# prove it is not stripping in place
|
56
|
+
dir = "/dir/with/child/"
|
57
|
+
T2Server::Util.strip_path_slashes(dir)
|
58
|
+
assert_equal("/dir/with/child/", dir)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class TestUriStripping < Test::Unit::TestCase
|
63
|
+
def test_uri
|
64
|
+
uri = "http://%swww.example.com:8000/path/to/something"
|
65
|
+
username = "username"
|
66
|
+
password = "password"
|
67
|
+
address = uri % "#{username}:#{password}@"
|
68
|
+
|
69
|
+
r_uri, r_creds = T2Server::Util.strip_uri_credentials(address)
|
70
|
+
|
71
|
+
assert_equal(uri % "", r_uri.to_s())
|
72
|
+
assert_equal(username, r_creds.username)
|
73
|
+
end
|
74
|
+
end
|
data/test/ts_t2server.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010
|
1
|
+
# Copyright (c) 2010-2012 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -14,7 +14,7 @@
|
|
14
14
|
#
|
15
15
|
# * Neither the names of The University of Manchester nor the names of its
|
16
16
|
# contributors may be used to endorse or promote products derived from this
|
17
|
-
# software without specific prior written permission.
|
17
|
+
# software without specific prior written permission.
|
18
18
|
#
|
19
19
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
20
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
@@ -33,10 +33,23 @@
|
|
33
33
|
require 'test/unit'
|
34
34
|
require 't2-server'
|
35
35
|
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# Check for a server address and user credentials passed through on the
|
37
|
+
# command line.
|
38
|
+
if ARGV.size != 0
|
39
|
+
address = ARGV[0]
|
40
|
+
|
41
|
+
unless ARGV[1].nil?
|
42
|
+
user1, pass1 = ARGV[1].split(":")
|
43
|
+
user1 = nil if pass1.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
unless ARGV[2].nil?
|
47
|
+
user2, pass2 = ARGV[2].split(":")
|
48
|
+
user2 = nil if pass2.nil?
|
49
|
+
end
|
50
|
+
|
51
|
+
puts "Using server at: #{address}"
|
52
|
+
puts " With user(s): #{user1} #{user2}" if user1
|
40
53
|
else
|
41
54
|
# get a server address to test - 30 second timeout
|
42
55
|
print "\nPlease supply a valid Taverna 2 Server address.\n\nNOTE that " +
|
@@ -45,22 +58,54 @@ else
|
|
45
58
|
"runs will be deleted!\n(leave blank to skip tests): "
|
46
59
|
$stdout.flush
|
47
60
|
if select([$stdin], [], [], 30)
|
48
|
-
|
61
|
+
address = $stdin.gets.chomp
|
49
62
|
else
|
50
63
|
puts "\nSkipping tests that require a Taverna 2 Server instance..."
|
51
|
-
|
64
|
+
address = ""
|
52
65
|
end
|
53
66
|
end
|
54
67
|
|
55
68
|
# the testcases to run
|
56
|
-
require '
|
57
|
-
|
69
|
+
require 'tc_util'
|
70
|
+
require 'tc_params'
|
71
|
+
if address != ""
|
72
|
+
$uri, $creds = T2Server::Util.strip_uri_credentials(address)
|
73
|
+
|
74
|
+
# override creds if passed in on the command line
|
75
|
+
$creds = T2Server::HttpBasic.new(user1, pass1) if user1
|
76
|
+
$creds1 = T2Server::HttpBasic.new(user2, pass2) if user2
|
77
|
+
|
58
78
|
$wkf_pass = File.read("test/workflows/pass_through.t2flow")
|
59
79
|
$wkf_lists = File.read("test/workflows/empty_list.t2flow")
|
80
|
+
$wkf_l_v = File.read("test/workflows/list_and_value.t2flow")
|
60
81
|
$wkf_xml = File.read("test/workflows/xml_xpath.t2flow")
|
82
|
+
$wkf_fail = File.read("test/workflows/always_fail.t2flow")
|
83
|
+
$wkf_errors = File.read("test/workflows/list_with_errors.t2flow")
|
61
84
|
$list_input = "test/workflows/empty_list_input.baclava"
|
62
85
|
$file_input = "test/workflows/in.txt"
|
86
|
+
$file_strs = "test/workflows/strings.txt"
|
63
87
|
|
64
|
-
|
65
|
-
|
88
|
+
if $uri.scheme == "http"
|
89
|
+
$conn_params = T2Server::DefaultConnectionParameters.new
|
90
|
+
else
|
91
|
+
$conn_params = T2Server::InsecureSSLConnectionParameters.new
|
92
|
+
end
|
93
|
+
|
94
|
+
# We only support version 2.3 server and onwards now...
|
95
|
+
begin
|
96
|
+
# This will drop out before further tests are run
|
97
|
+
T2Server::Server.new($uri, $conn_params)
|
98
|
+
|
99
|
+
require 'tc_server'
|
100
|
+
require 'tc_run'
|
101
|
+
require 'tc_admin'
|
102
|
+
require 'tc_secure'
|
103
|
+
|
104
|
+
# if we have two sets of credentials we can run permissions tests
|
105
|
+
if $creds1
|
106
|
+
require 'tc_perms'
|
107
|
+
end
|
108
|
+
rescue RuntimeError => e
|
109
|
+
puts "!!!\nNo tests on the remote server could be run.\n#{e.message}\n!!!"
|
110
|
+
end
|
66
111
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="taverna-2.2.0"><dataflow id="1f06bc1a-a18e-4948-ad93-937343dbb881" role="top"><name>Workflow1</name><inputPorts /><outputPorts><port><name>OUT</name><annotations /></port></outputPorts><processors><processor><name>Always_Fails</name><inputPorts /><outputPorts><port><name>urgle</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>localworker-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap><map from="urgle" to="urgle" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
|
2
|
+
<localworkerName>org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor</localworkerName>
|
3
|
+
<script>throw new Exception("This script fails");</script>
|
4
|
+
<dependencies />
|
5
|
+
<classLoaderSharing>workflow</classLoaderSharing>
|
6
|
+
<localDependencies />
|
7
|
+
<artifactDependencies />
|
8
|
+
<inputs>
|
9
|
+
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
|
10
|
+
<handledReferenceSchemes />
|
11
|
+
<translatedElementType>java.lang.String</translatedElementType>
|
12
|
+
<allowsLiteralValues>true</allowsLiteralValues>
|
13
|
+
<name>foo</name>
|
14
|
+
<depth>0</depth>
|
15
|
+
<mimeTypes>
|
16
|
+
<string>'text/plain'</string>
|
17
|
+
</mimeTypes>
|
18
|
+
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
|
19
|
+
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
|
20
|
+
<handledReferenceSchemes />
|
21
|
+
<translatedElementType>java.lang.String</translatedElementType>
|
22
|
+
<allowsLiteralValues>true</allowsLiteralValues>
|
23
|
+
<name>bar</name>
|
24
|
+
<depth>0</depth>
|
25
|
+
<mimeTypes>
|
26
|
+
<string>'text/plain'</string>
|
27
|
+
</mimeTypes>
|
28
|
+
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
|
29
|
+
</inputs>
|
30
|
+
<outputs>
|
31
|
+
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
|
32
|
+
<granularDepth>0</granularDepth>
|
33
|
+
<name>urgle</name>
|
34
|
+
<depth>0</depth>
|
35
|
+
<mimeTypes>
|
36
|
+
<string>'text/plain'</string>
|
37
|
+
</mimeTypes>
|
38
|
+
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
|
39
|
+
</outputs>
|
40
|
+
</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean><annotations /></activity></activities><dispatchStack><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig xmlns="">
|
41
|
+
<maxJobs>1</maxJobs>
|
42
|
+
</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry</class><configBean encoding="xstream"><net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig xmlns="">
|
43
|
+
<backoffFactor>1.0</backoffFactor>
|
44
|
+
<initialDelay>1000</initialDelay>
|
45
|
+
<maxDelay>5000</maxDelay>
|
46
|
+
<maxRetries>0</maxRetries>
|
47
|
+
</net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig></configBean></dispatchLayer><dispatchLayer><raven><group>net.sf.taverna.t2.core</group><artifact>workflowmodel-impl</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke</class><configBean encoding="xstream"><null xmlns="" /></configBean></dispatchLayer></dispatchStack><iterationStrategyStack><iteration><strategy /></iteration></iterationStrategyStack></processor></processors><conditions /><datalinks><datalink><sink type="dataflow"><port>OUT</port></sink><source type="processor"><processor>Always_Fails</processor><port>urgle</port></source></datalink></datalinks><annotations><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
|
48
|
+
<annotationAssertions>
|
49
|
+
<net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
50
|
+
<annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
|
51
|
+
<identification>1f06bc1a-a18e-4948-ad93-937343dbb881</identification>
|
52
|
+
</annotationBean>
|
53
|
+
<date>2011-07-21 16:36:32.689 BST</date>
|
54
|
+
<creators />
|
55
|
+
<curationEventList />
|
56
|
+
</net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
57
|
+
</annotationAssertions>
|
58
|
+
</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
|
59
|
+
<annotationAssertions>
|
60
|
+
<net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
61
|
+
<annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
|
62
|
+
<identification>74165e6a-282b-448a-9dd2-3bd16dce41a1</identification>
|
63
|
+
</annotationBean>
|
64
|
+
<date>2011-07-21 16:35:32.443 BST</date>
|
65
|
+
<creators />
|
66
|
+
<curationEventList />
|
67
|
+
</net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
68
|
+
</annotationAssertions>
|
69
|
+
</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></dataflow></workflow>
|