t2-server 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +9 -2
- data/bin/delete_all_runs +6 -1
- data/bin/run_workflow +18 -9
- data/bin/server_info +14 -9
- data/lib/t2server.rb +31 -0
- data/lib/t2server/exceptions.rb +153 -0
- data/lib/t2server/run.rb +215 -31
- data/lib/t2server/server.rb +175 -95
- data/test/tc_paths.rb +60 -0
- data/test/tc_run.rb +72 -0
- data/test/tc_server.rb +71 -0
- data/test/ts_t2server.rb +52 -0
- data/test/workflows/hello.t2flow +21 -0
- metadata +27 -8
data/test/tc_run.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Copyright (c) 2010, 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 't2server'
|
34
|
+
|
35
|
+
class TestRun < Test::Unit::TestCase
|
36
|
+
|
37
|
+
def test_run
|
38
|
+
# connection
|
39
|
+
assert_nothing_raised(T2Server::ConnectionError) do
|
40
|
+
@run = T2Server::Run.create($address, $wkf)
|
41
|
+
end
|
42
|
+
|
43
|
+
# test bad state code
|
44
|
+
assert_raise(T2Server::RunStateError) do
|
45
|
+
@run.get_output("out")
|
46
|
+
end
|
47
|
+
assert_raise(T2Server::RunStateError) do
|
48
|
+
@run.wait
|
49
|
+
end
|
50
|
+
|
51
|
+
# test mkdir and ls
|
52
|
+
assert(@run.mkdir("test"))
|
53
|
+
assert_equal(@run.ls, [["test"], []])
|
54
|
+
|
55
|
+
# start, state and wait
|
56
|
+
@run.start
|
57
|
+
assert(@run.running?)
|
58
|
+
assert_nothing_raised(T2Server::RunStateError) do
|
59
|
+
@run.wait
|
60
|
+
end
|
61
|
+
|
62
|
+
# exitcode and output
|
63
|
+
assert_instance_of(Fixnum, @run.exitcode)
|
64
|
+
assert_equal(@run.get_output("Message"), "Hello, World!")
|
65
|
+
assert_raise(T2Server::AccessForbiddenError) do
|
66
|
+
@run.get_output("wrong!")
|
67
|
+
end
|
68
|
+
|
69
|
+
# deletion
|
70
|
+
assert(@run.delete)
|
71
|
+
end
|
72
|
+
end
|
data/test/tc_server.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Copyright (c) 2010, 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 't2server'
|
34
|
+
|
35
|
+
class TestServer < Test::Unit::TestCase
|
36
|
+
|
37
|
+
def test_server
|
38
|
+
# connection
|
39
|
+
assert_nothing_raised(T2Server::ConnectionError) do
|
40
|
+
@server = T2Server::Server.connect($address)
|
41
|
+
end
|
42
|
+
assert_not_nil(@server)
|
43
|
+
assert_raise(T2Server::ConnectionError) do
|
44
|
+
uri = URI.parse($address)
|
45
|
+
T2Server::Server.connect("http://#{uri.host}:22")
|
46
|
+
end
|
47
|
+
|
48
|
+
# run creation
|
49
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
50
|
+
@run = @server.create_run($wkf)
|
51
|
+
end
|
52
|
+
|
53
|
+
# capacity
|
54
|
+
limit = @server.run_limit
|
55
|
+
assert_instance_of(Fixnum, limit)
|
56
|
+
assert_raise(T2Server::ServerAtCapacityError) do
|
57
|
+
limit.times do
|
58
|
+
@server.create_run($wkf)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# deleting
|
63
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
64
|
+
@run.delete
|
65
|
+
end
|
66
|
+
|
67
|
+
assert_nothing_raised(T2Server::T2ServerError) do
|
68
|
+
@server.delete_all_runs
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/test/ts_t2server.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Copyright (c) 2010, 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 'test/unit'
|
34
|
+
require 't2server'
|
35
|
+
|
36
|
+
# get a server address to test - 30 second timeout
|
37
|
+
print "\nPlease supply a valid Taverna 2 Server address (leave blank to skip tests): "
|
38
|
+
$stdout.flush
|
39
|
+
if select([$stdin], [], [], 30)
|
40
|
+
$address = $stdin.gets.chomp
|
41
|
+
else
|
42
|
+
puts "\nSkipping tests that require a Taverna 2 Server instance..."
|
43
|
+
$address = ""
|
44
|
+
end
|
45
|
+
$wkf = File.read("test/workflows/hello.t2flow")
|
46
|
+
|
47
|
+
# the testcases to run
|
48
|
+
require 'tc_paths'
|
49
|
+
if $address != ""
|
50
|
+
require 'tc_server'
|
51
|
+
require 'tc_run'
|
52
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<workflow xmlns="http://taverna.sf.net/2008/xml/t2flow" version="1" producedBy="taverna-2.2.0"><dataflow id="b9556b39-8656-4a17-bf5c-37de30fe7df3" role="top"><name>Workflow1</name><inputPorts /><outputPorts><port><name>Message</name><annotations /></port></outputPorts><processors><processor><name>Hello</name><inputPorts /><outputPorts><port><name>value</name><depth>0</depth><granularDepth>0</granularDepth></port></outputPorts><annotations /><activities><activity><raven><group>net.sf.taverna.t2.activities</group><artifact>stringconstant-activity</artifact><version>1.2</version></raven><class>net.sf.taverna.t2.activities.stringconstant.StringConstantActivity</class><inputMap /><outputMap><map from="value" to="value" /></outputMap><configBean encoding="xstream"><net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean xmlns="">
|
2
|
+
<value>Hello, World!</value>
|
3
|
+
</net.sf.taverna.t2.activities.stringconstant.StringConstantConfigurationBean></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="">
|
4
|
+
<maxJobs>1</maxJobs>
|
5
|
+
</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="">
|
6
|
+
<backoffFactor>1.0</backoffFactor>
|
7
|
+
<initialDelay>1000</initialDelay>
|
8
|
+
<maxDelay>5000</maxDelay>
|
9
|
+
<maxRetries>0</maxRetries>
|
10
|
+
</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>Message</port></sink><source type="processor"><processor>Hello</processor><port>value</port></source></datalink></datalinks><annotations><annotation_chain_2_2 encoding="xstream"><net.sf.taverna.t2.annotation.AnnotationChainImpl xmlns="">
|
11
|
+
<annotationAssertions>
|
12
|
+
<net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
13
|
+
<annotationBean class="net.sf.taverna.t2.annotation.annotationbeans.IdentificationAssertion">
|
14
|
+
<identification>b9556b39-8656-4a17-bf5c-37de30fe7df3</identification>
|
15
|
+
</annotationBean>
|
16
|
+
<date>2010-07-09 15:01:39.283 BST</date>
|
17
|
+
<creators />
|
18
|
+
<curationEventList />
|
19
|
+
</net.sf.taverna.t2.annotation.AnnotationAssertionImpl>
|
20
|
+
</annotationAssertions>
|
21
|
+
</net.sf.taverna.t2.annotation.AnnotationChainImpl></annotation_chain_2_2></annotations></dataflow></workflow>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t2-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.4
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robert Haines
|
@@ -15,10 +15,23 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-02 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rake
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
22
35
|
description: This gem provides access to the Taverna 2 Server REST interface from Ruby.
|
23
36
|
email: rhaines@manchester.ac.uk
|
24
37
|
executables: []
|
@@ -34,8 +47,14 @@ files:
|
|
34
47
|
- bin/delete_all_runs
|
35
48
|
- lib/t2server.rb
|
36
49
|
- lib/t2server/server.rb
|
50
|
+
- lib/t2server/exceptions.rb
|
37
51
|
- lib/t2server/xml.rb
|
38
52
|
- lib/t2server/run.rb
|
53
|
+
- test/tc_server.rb
|
54
|
+
- test/tc_paths.rb
|
55
|
+
- test/tc_run.rb
|
56
|
+
- test/workflows/hello.t2flow
|
57
|
+
- test/ts_t2server.rb
|
39
58
|
- README.rdoc
|
40
59
|
- LICENCE
|
41
60
|
has_rdoc: true
|
@@ -72,5 +91,5 @@ rubygems_version: 1.3.7
|
|
72
91
|
signing_key:
|
73
92
|
specification_version: 3
|
74
93
|
summary: Support for interacting with Taverna 2 Server.
|
75
|
-
test_files:
|
76
|
-
|
94
|
+
test_files:
|
95
|
+
- test/ts_t2server.rb
|