t2-server 1.1.0 → 1.2.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.
- 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
@@ -40,7 +40,6 @@ class TestSecurity < Test::Unit::TestCase
|
|
40
40
|
# User name and password for the test secure server.
|
41
41
|
USERNAME = "testuser"
|
42
42
|
PASSWORD = "testpasswd"
|
43
|
-
CERTPASS = "testcert"
|
44
43
|
|
45
44
|
# Various URIs required.
|
46
45
|
HEATER_HTTP = "http://heater.cs.man.ac.uk:7070/"
|
@@ -52,34 +51,36 @@ class TestSecurity < Test::Unit::TestCase
|
|
52
51
|
WS4 = "axis/services/HelloService-DigestPassword-Timestamp?wsdl"
|
53
52
|
|
54
53
|
# Workflows
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
WKF_BASIC_HTTP = File.read("test/workflows/secure/basic-http.t2flow")
|
55
|
+
WKF_DIGEST_HTTP = File.read("test/workflows/secure/digest-http.t2flow")
|
56
|
+
WKF_WS_HTTP = File.read("test/workflows/secure/ws-http.t2flow")
|
57
|
+
WKF_BASIC_HTTPS = File.read("test/workflows/secure/basic-https.t2flow")
|
58
|
+
WKF_DIGEST_HTTPS = File.read("test/workflows/secure/digest-https.t2flow")
|
59
|
+
WKF_WS_HTTPS = File.read("test/workflows/secure/ws-https.t2flow")
|
60
|
+
WKF_CLIENT_HTTPS = File.read("test/workflows/secure/client-https.t2flow")
|
62
61
|
|
63
62
|
# Server public key for HTTPS peer verification.
|
64
|
-
|
63
|
+
HEATER_PK = "test/workflows/secure/heater-pk.pem"
|
65
64
|
|
66
65
|
# Client private key for HTTPS authentication
|
67
|
-
|
66
|
+
USER_PK = "test/workflows/secure/user-cert.p12"
|
67
|
+
CERTNAME = "{492EB700-ADBA-44B9-A263-D7DF9F2E0F2B}"
|
68
|
+
CERTPASS = "testcert"
|
68
69
|
|
69
70
|
# HTTP Basic authentication
|
70
71
|
def test_basic_creds_http
|
71
|
-
T2Server::Run.create($uri,
|
72
|
+
T2Server::Run.create($uri, WKF_BASIC_HTTP, $creds, $conn_params) do |run|
|
72
73
|
run.add_password_credential(HEATER_HTTP, USERNAME, PASSWORD)
|
73
74
|
run.start
|
74
75
|
assert(run.running?)
|
75
76
|
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
76
77
|
assert(run.finished?)
|
77
|
-
|
78
|
+
refute(run.output_port("out").error?)
|
78
79
|
assert(run.delete)
|
79
80
|
end
|
80
81
|
|
81
82
|
# now test with no credential
|
82
|
-
T2Server::Run.create($uri,
|
83
|
+
T2Server::Run.create($uri, WKF_BASIC_HTTP, $creds, $conn_params) do |run|
|
83
84
|
run.start
|
84
85
|
assert(run.running?)
|
85
86
|
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
@@ -91,19 +92,19 @@ class TestSecurity < Test::Unit::TestCase
|
|
91
92
|
|
92
93
|
# HTTPS Basic authentication
|
93
94
|
def test_basic_creds_https
|
94
|
-
T2Server::Run.create($uri,
|
95
|
+
T2Server::Run.create($uri, WKF_BASIC_HTTPS, $creds, $conn_params) do |run|
|
95
96
|
run.add_password_credential(HEATER_HTTPS, USERNAME, PASSWORD)
|
96
|
-
run.add_trust(
|
97
|
+
run.add_trust(HEATER_PK)
|
97
98
|
run.start
|
98
99
|
assert(run.running?)
|
99
100
|
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
100
101
|
assert(run.finished?)
|
101
|
-
|
102
|
+
refute(run.output_port("out").error?)
|
102
103
|
assert(run.delete)
|
103
104
|
end
|
104
105
|
|
105
106
|
# now test with no server public key
|
106
|
-
T2Server::Run.create($uri,
|
107
|
+
T2Server::Run.create($uri, WKF_BASIC_HTTPS, $creds, $conn_params) do |run|
|
107
108
|
run.add_password_credential(HEATER_HTTPS, USERNAME, PASSWORD)
|
108
109
|
run.start
|
109
110
|
assert(run.running?)
|
@@ -116,34 +117,34 @@ class TestSecurity < Test::Unit::TestCase
|
|
116
117
|
|
117
118
|
# HTTP Digest authentication
|
118
119
|
def test_digest_creds_http
|
119
|
-
T2Server::Run.create($uri,
|
120
|
+
T2Server::Run.create($uri, WKF_DIGEST_HTTP, $creds, $conn_params) do |run|
|
120
121
|
run.add_password_credential(HEATER_HTTP, USERNAME, PASSWORD)
|
121
122
|
run.start
|
122
123
|
assert(run.running?)
|
123
124
|
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
124
125
|
assert(run.finished?)
|
125
|
-
|
126
|
+
refute(run.output_port("out").error?)
|
126
127
|
assert(run.delete)
|
127
128
|
end
|
128
129
|
end
|
129
130
|
|
130
131
|
# HTTPS Digest authentication
|
131
132
|
def test_digest_creds_https
|
132
|
-
T2Server::Run.create($uri,
|
133
|
+
T2Server::Run.create($uri, WKF_DIGEST_HTTPS, $creds, $conn_params) do |run|
|
133
134
|
run.add_password_credential(HEATER_HTTPS, USERNAME, PASSWORD)
|
134
|
-
run.add_trust(
|
135
|
+
run.add_trust(HEATER_PK)
|
135
136
|
run.start
|
136
137
|
assert(run.running?)
|
137
138
|
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
138
139
|
assert(run.finished?)
|
139
|
-
|
140
|
+
refute(run.output_port("out").error?)
|
140
141
|
assert(run.delete)
|
141
142
|
end
|
142
143
|
end
|
143
144
|
|
144
145
|
# HTTP WS-Security authentication
|
145
146
|
def test_ws_creds_http
|
146
|
-
T2Server::Run.create($uri,
|
147
|
+
T2Server::Run.create($uri, WKF_WS_HTTP, $creds, $conn_params) do |run|
|
147
148
|
run.add_password_credential(HEATER_HTTP + WS1, USERNAME, PASSWORD)
|
148
149
|
run.add_password_credential(HEATER_HTTP + WS2, USERNAME, PASSWORD)
|
149
150
|
run.add_password_credential(HEATER_HTTP + WS3, USERNAME, PASSWORD)
|
@@ -164,12 +165,12 @@ class TestSecurity < Test::Unit::TestCase
|
|
164
165
|
|
165
166
|
# HTTPS WS-Security authentication
|
166
167
|
def test_ws_creds_https
|
167
|
-
T2Server::Run.create($uri,
|
168
|
+
T2Server::Run.create($uri, WKF_WS_HTTPS, $creds, $conn_params) do |run|
|
168
169
|
run.add_password_credential(HEATER_HTTPS + WS1, USERNAME, PASSWORD)
|
169
170
|
run.add_password_credential(HEATER_HTTPS + WS2, USERNAME, PASSWORD)
|
170
171
|
run.add_password_credential(HEATER_HTTPS + WS3, USERNAME, PASSWORD)
|
171
172
|
run.add_password_credential(HEATER_HTTPS + WS4, USERNAME, PASSWORD)
|
172
|
-
run.add_trust(
|
173
|
+
run.add_trust(HEATER_PK)
|
173
174
|
run.start
|
174
175
|
assert(run.running?)
|
175
176
|
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
@@ -186,14 +187,14 @@ class TestSecurity < Test::Unit::TestCase
|
|
186
187
|
|
187
188
|
# HTTPS client certificate authentication
|
188
189
|
def test_client_cert_auth_https
|
189
|
-
T2Server::Run.create($uri,
|
190
|
-
run.add_keypair_credential(HEATER_CAUTH,
|
191
|
-
run.add_trust(
|
190
|
+
T2Server::Run.create($uri, WKF_CLIENT_HTTPS, $creds, $conn_params) do |run|
|
191
|
+
run.add_keypair_credential(HEATER_CAUTH, USER_PK, CERTPASS, CERTNAME)
|
192
|
+
run.add_trust(HEATER_PK)
|
192
193
|
run.start
|
193
194
|
assert(run.running?)
|
194
195
|
assert_nothing_raised(T2Server::RunStateError) { run.wait }
|
195
196
|
assert(run.finished?)
|
196
|
-
|
197
|
+
refute(run.output_port("out").error?)
|
197
198
|
assert(run.delete)
|
198
199
|
end
|
199
200
|
end
|
data/test/tc_server.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c)
|
1
|
+
# Copyright (c) 2014 The University of Manchester, UK.
|
2
2
|
#
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
@@ -30,61 +30,134 @@
|
|
30
30
|
#
|
31
31
|
# Author: Robert Haines
|
32
32
|
|
33
|
+
require 'mocked-server-responses/mocks'
|
33
34
|
require 't2-server'
|
34
35
|
|
35
36
|
class TestServer < Test::Unit::TestCase
|
37
|
+
include T2Server::Mocks
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
WKF_PASS = "test/workflows/pass_through.t2flow"
|
40
|
+
|
41
|
+
# Server version is baked into the recorded server responses.
|
42
|
+
SERVER_VERSION = "2.5.4"
|
43
|
+
|
44
|
+
# Need to lock down the run UUID so recorded server responses make sense.
|
45
|
+
RUN_UUID = "a341b87f-25cc-4dfd-be36-f5b073a6ba74"
|
46
|
+
|
47
|
+
def setup
|
48
|
+
@server = T2Server::Server.new($uri, $conn_params)
|
49
|
+
|
50
|
+
# Register common mocks.
|
51
|
+
@mock_rest = mock("/rest/", :accept => "application/xml",
|
52
|
+
:output => "get-rest.raw")
|
53
|
+
@mock_policy = mock("/rest/policy", :accept => "application/xml",
|
54
|
+
:output => "get-rest-policy.raw")
|
55
|
+
mock("/rest/runs", :method => :post, :credentials => $userinfo,
|
56
|
+
:status => 201,
|
57
|
+
:location => "https://localhost/taverna/rest/runs/#{RUN_UUID}")
|
58
|
+
end
|
59
|
+
|
60
|
+
# A simple check that the server version is correctly parsed out of the xml.
|
61
|
+
def test_server_version
|
62
|
+
assert_equal SERVER_VERSION, @server.version.to_s
|
63
|
+
|
64
|
+
assert_requested @mock_rest, :times => 1
|
65
|
+
assert_not_requested @mock_policy
|
41
66
|
end
|
42
67
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
68
|
+
def test_redirect
|
69
|
+
# Re-mock getting the rest endpoint so that it redirects.
|
70
|
+
mock("/rest/", :accept => "application/xml", :status => 302,
|
71
|
+
:location => "http://localhost/taverna/rest/")
|
72
|
+
|
73
|
+
# And now a webmock error should be triggered.
|
74
|
+
assert_raise(WebMock::NetConnectNotAllowedError) do
|
75
|
+
@server.run_limit($creds)
|
46
76
|
end
|
47
77
|
end
|
48
78
|
|
49
79
|
def test_run_creation
|
50
|
-
T2Server::
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
80
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
81
|
+
run = @server.create_run(WKF_PASS, $creds)
|
82
|
+
|
83
|
+
# Mock the deletion of this specific run.
|
84
|
+
mock("/rest/runs/#{run.id}", :method => :delete,
|
85
|
+
:credentials => $userinfo, :status => 204)
|
86
|
+
|
87
|
+
run.delete
|
55
88
|
end
|
89
|
+
|
90
|
+
# Make sure we don't keep fetching this information.
|
91
|
+
assert_requested @mock_rest, :times => 1
|
92
|
+
assert_requested @mock_policy, :times => 1
|
56
93
|
end
|
57
94
|
|
58
|
-
# Need to do these together so testing the limit is cleaned up!
|
59
95
|
def test_server_limits_delete_all
|
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
|
-
|
96
|
+
# Mock specific routes for these tests.
|
97
|
+
mock_limit = mock("/rest/policy/runLimit", :accept => "text/plain",
|
98
|
+
:credentials => $userinfo, :output => "get-rest-policy-runlimit.raw")
|
99
|
+
|
100
|
+
limit = @server.run_limit($creds)
|
101
|
+
assert_instance_of(Fixnum, limit)
|
102
|
+
|
103
|
+
# Mock creation of a run to work once then fail due to server capacity.
|
104
|
+
mock("/rest/runs", :method => :post, :credentials => $userinfo,
|
105
|
+
:status => [201, 503],
|
106
|
+
:location => "https://localhost/taverna/rest/runs/#{RUN_UUID}")
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
run = nil
|
111
|
+
assert_nothing_raised(T2Server::ServerAtCapacityError) do
|
112
|
+
run = @server.create_run(WKF_PASS, $creds)
|
113
|
+
end
|
114
|
+
assert_raise(T2Server::ServerAtCapacityError) do
|
115
|
+
@server.create_run(WKF_PASS, $creds)
|
116
|
+
end
|
117
|
+
|
118
|
+
assert_equal RUN_UUID, run.id
|
119
|
+
|
120
|
+
mock("/rest/runs", :accept => "application/xml",
|
121
|
+
:credentials => $userinfo, :output => "get-rest-runs.raw")
|
122
|
+
|
123
|
+
assert_equal 1, @server.runs($creds).length
|
124
|
+
|
125
|
+
# Mock for this specific run.
|
126
|
+
run_uri = "/rest/runs/#{run.id}"
|
127
|
+
mock_run = mock(run_uri, :accept => "application/xml",
|
128
|
+
:credentials => $userinfo, :output => "get-rest-run.raw")
|
129
|
+
mock("#{run_uri}/security", :accept => "application/xml",
|
130
|
+
:credentials => $userinfo, :output => "get-rest-run-security.raw")
|
131
|
+
mock_input = mock("#{run_uri}/input", :accept => "application/xml",
|
132
|
+
:credentials => $userinfo, :output => "get-rest-run-input.raw")
|
133
|
+
mock_status = mock("#{run_uri}/status", :accept => "text/plain",
|
134
|
+
:credentials => $userinfo, :body => "Initialized")
|
135
|
+
mock_input_exp = mock("#{run_uri}/input/expected",
|
136
|
+
:accept => "application/xml", :credentials => $userinfo,
|
137
|
+
:output => "get-rest-run-input-expected.raw")
|
138
|
+
|
139
|
+
# Mock starting a run to fail due to concurrent running limit.
|
140
|
+
mock_run_start = mock("#{run_uri}/status", :method => :put,
|
141
|
+
:status => 503, :credentials => $userinfo, :body => "Operating")
|
142
|
+
|
143
|
+
# Running limit reached: Run#start should return false and run should stay
|
144
|
+
# in the initialized state.
|
145
|
+
refute run.start
|
146
|
+
assert_equal :initialized, run.status
|
147
|
+
|
148
|
+
# Delete all runs but just need to mock deletion of the one run.
|
149
|
+
mock(run_uri, :method => :delete, :credentials => $userinfo,
|
150
|
+
:status => 204)
|
151
|
+
|
152
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
153
|
+
@server.delete_all_runs($creds)
|
88
154
|
end
|
155
|
+
|
156
|
+
# Make sure we don't keep fetching this information.
|
157
|
+
assert_requested @mock_rest, :times => 1
|
158
|
+
assert_requested @mock_policy, :times => 1
|
159
|
+
assert_requested mock_limit, :times => 1
|
160
|
+
assert_requested mock_run, :times => 1
|
89
161
|
end
|
162
|
+
|
90
163
|
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Copyright (c) 2010-2013 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 TestServer < Test::Unit::TestCase
|
36
|
+
|
37
|
+
WKF_PASS = "test/workflows/pass_through.t2flow"
|
38
|
+
|
39
|
+
def test_server_connection
|
40
|
+
assert_nothing_raised(T2Server::ConnectionError) do
|
41
|
+
T2Server::Server.new($uri, $conn_params)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_server_connection_no_params
|
46
|
+
assert_nothing_raised(T2Server::ConnectionError) do
|
47
|
+
T2Server::Server.new($uri)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_run_creation
|
52
|
+
T2Server::Server.new($uri, $conn_params) do |server|
|
53
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
54
|
+
run = server.create_run(WKF_PASS, $creds)
|
55
|
+
run.delete
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Need to do these together so testing the limit is cleaned up!
|
61
|
+
def test_server_limits_delete_all
|
62
|
+
T2Server::Server.new($uri, $conn_params) do |server|
|
63
|
+
limit = server.run_limit($creds)
|
64
|
+
max_runs = 0
|
65
|
+
assert_instance_of(Fixnum, limit)
|
66
|
+
assert_raise(T2Server::ServerAtCapacityError) do
|
67
|
+
# Detect the concurrent run limit and
|
68
|
+
# add 1 just in case there are no runs at this point
|
69
|
+
more = true
|
70
|
+
(limit + 1).times do
|
71
|
+
run = server.create_run(WKF_PASS, $creds)
|
72
|
+
if more
|
73
|
+
run.input_port("IN").value = "Hello"
|
74
|
+
more = run.start
|
75
|
+
if more
|
76
|
+
max_runs += 1
|
77
|
+
assert(run.running?)
|
78
|
+
else
|
79
|
+
assert(run.initialized?)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
assert(max_runs <= limit)
|
86
|
+
|
87
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
88
|
+
server.delete_all_runs($creds)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/test/tc_server_version.rb
CHANGED
@@ -68,6 +68,25 @@ class TestServerVersion < Test::Unit::TestCase
|
|
68
68
|
assert @v240 < @v241
|
69
69
|
assert @v251 > @v241
|
70
70
|
assert @v251 > @v250
|
71
|
+
assert @v24 <= @v240
|
72
|
+
assert @v240 <= @v241
|
73
|
+
assert @v250 >= @v241
|
74
|
+
assert @v250 >= @v250
|
75
|
+
assert @v250 != @v240
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_version_comparison_strings
|
79
|
+
assert @v24 == "2.4.0"
|
80
|
+
assert @v240 == "2.4"
|
81
|
+
assert @v240 < "2.4.1"
|
82
|
+
assert @v250 < "2.5.1"
|
83
|
+
assert @v250 > "2.4.10"
|
84
|
+
assert @v251 > "2.5"
|
85
|
+
assert @v240 <= "2.4"
|
86
|
+
assert @v240 <= "2.4.1"
|
87
|
+
assert @v250 >= "2.4.1"
|
88
|
+
assert @v251 >= "2.5"
|
89
|
+
assert @v251 != "2.5"
|
71
90
|
end
|
72
91
|
|
73
92
|
def test_version_components
|