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.
Files changed (68) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +1 -0
  3. data/.ruby-env +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +7 -1
  7. data/CHANGES.rdoc +49 -0
  8. data/README.rdoc +10 -8
  9. data/bin/t2-delete-runs +0 -3
  10. data/lib/t2-server-cli.rb +16 -9
  11. data/lib/t2-server/exceptions.rb +7 -19
  12. data/lib/t2-server/net/connection.rb +14 -6
  13. data/lib/t2-server/net/credentials.rb +12 -1
  14. data/lib/t2-server/net/parameters.rb +3 -3
  15. data/lib/t2-server/port.rb +12 -29
  16. data/lib/t2-server/run.rb +54 -35
  17. data/lib/t2-server/server.rb +3 -4
  18. data/lib/t2-server/xml.rb +0 -1
  19. data/lib/t2-server/xml/methods.rb +97 -4
  20. data/t2-server.gemspec +4 -1
  21. data/test/helpers/fake-run.rb +47 -0
  22. data/test/helpers/test-cache.rb +49 -0
  23. data/test/helpers/test-xml.rb +36 -0
  24. data/test/helpers/timezone.rb +39 -0
  25. data/test/mocked-server-responses/.gitattributes +1 -0
  26. data/test/mocked-server-responses/get-admin.raw +6 -0
  27. data/test/mocked-server-responses/get-rest-policy-runlimit.raw +6 -0
  28. data/test/mocked-server-responses/get-rest-policy.raw +6 -0
  29. data/test/mocked-server-responses/get-rest-run-input-expected.raw +6 -0
  30. data/test/mocked-server-responses/get-rest-run-input.raw +6 -0
  31. data/test/mocked-server-responses/get-rest-run-interaction-feed-0.raw +11 -0
  32. data/test/mocked-server-responses/get-rest-run-interaction-feed-1.raw +92 -0
  33. data/test/mocked-server-responses/get-rest-run-interaction-feed-2.raw +80 -0
  34. data/test/mocked-server-responses/get-rest-run-name.raw +6 -0
  35. data/test/mocked-server-responses/get-rest-run-output-list-errors.raw +6 -0
  36. data/test/mocked-server-responses/get-rest-run-output.raw +6 -0
  37. data/test/mocked-server-responses/get-rest-run-security-permissions.raw +6 -0
  38. data/test/mocked-server-responses/get-rest-run-security.raw +6 -0
  39. data/test/mocked-server-responses/get-rest-run.raw +6 -0
  40. data/test/mocked-server-responses/get-rest-runs.raw +6 -0
  41. data/test/mocked-server-responses/get-rest.raw +6 -0
  42. data/test/mocked-server-responses/log.txt +1 -0
  43. data/test/mocked-server-responses/mocks.rb +107 -0
  44. data/test/mocked-server-responses/options-admin-allownew.raw +7 -0
  45. data/test/tc_admin.rb +52 -24
  46. data/test/tc_admin_live.rb +66 -0
  47. data/test/tc_connection.rb +87 -0
  48. data/test/tc_connection_exceptions.rb +86 -0
  49. data/test/tc_credentials.rb +73 -0
  50. data/test/tc_interaction.rb +182 -0
  51. data/test/{tc_misc.rb → tc_misc_live.rb} +3 -1
  52. data/test/tc_params.rb +82 -4
  53. data/test/tc_perms.rb +54 -101
  54. data/test/tc_perms_live.rb +150 -0
  55. data/test/tc_ports.rb +192 -0
  56. data/test/tc_run.rb +333 -350
  57. data/test/tc_run_live.rb +453 -0
  58. data/test/{tc_secure.rb → tc_secure_live.rb} +30 -29
  59. data/test/tc_server.rb +115 -42
  60. data/test/tc_server_live.rb +92 -0
  61. data/test/tc_server_version.rb +19 -0
  62. data/test/tc_xml_messages.rb +201 -0
  63. data/test/ts_t2server.rb +37 -43
  64. data/test/workflows/secure/heater-pk.pem +24 -18
  65. data/test/workflows/secure/user-cert.p12 +0 -0
  66. data/version.yml +1 -1
  67. metadata +136 -29
  68. data/lib/t2-server/xml/fragments.rb +0 -78
@@ -0,0 +1,80 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/atom+xml; type=feed;charset=UTF-8
4
+ Transfer-Encoding: chunked
5
+
6
+ <?xml version='1.0' encoding='UTF-8'?>
7
+ <feed xmlns="http://www.w3.org/2005/Atom">
8
+ <title type="text">Interactions for Taverna Run "Multi_interactor"</title>
9
+ <link href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/interaction" rel="self"/>
10
+ <link href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74" rel="workflowrun"/>
11
+ <entry xmlns:thr="http://purl.org/syndication/thread/1.0">
12
+
13
+
14
+ <title type="text">"A reply to db4c26e742a14bba93356a473e314ce4"</title>
15
+
16
+
17
+ <id>urn:uuid:f6a2bc46-2779-4346-a237-208206f56a71</id>
18
+
19
+
20
+ <content type="text"/>
21
+
22
+
23
+ <interaction:run-id xmlns:interaction="http://ns.taverna.org.uk/2012/interaction">a341b87f-25cc-4dfd-be36-f5b073a6ba74</interaction:run-id>
24
+
25
+
26
+ <interaction:in-reply-to xmlns:interaction="http://ns.taverna.org.uk/2012/interaction">db4c26e742a14bba93356a473e314ce4</interaction:in-reply-to>
27
+
28
+
29
+ <interaction:result-status xmlns:interaction="http://ns.taverna.org.uk/2012/interaction">OK</interaction:result-status>
30
+
31
+ <link href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/interaction/entry_3" rel="self"/>
32
+
33
+ <link href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74" rel="workflowrun"/>
34
+
35
+ <updated>2014-05-25T15:14:12.727Z</updated>
36
+
37
+ <published>2014-05-25T15:14:12.727Z</published>
38
+ </entry>
39
+ <updated>2014-05-25T15:14:12.727Z</updated>
40
+ <entry xmlns:interaction="http://ns.taverna.org.uk/2012/interaction">
41
+
42
+ <id>urn:uuid:7eb364c8-3462-4299-afcf-8362a56e94f7</id>
43
+
44
+ <published>2014-05-25T15:09:13.894Z</published>
45
+
46
+ <updated>2014-05-25T15:09:13.894Z</updated>
47
+
48
+ <author>
49
+
50
+ <name>Taverna</name>
51
+ </author>
52
+
53
+ <title type="text">Interaction from Taverna for 966ac40e-6c2a-4650-b094-f6c14d893de6:facade0:Multi_interactor:Nested_workflow:invocation3:facade1:Workflow10:Interaction:invocation7</title>
54
+
55
+ <interaction:run-id>a341b87f-25cc-4dfd-be36-f5b073a6ba74</interaction:run-id>
56
+
57
+ <interaction:path>Nested_workflow:Interaction</interaction:path>
58
+
59
+ <interaction:count>0</interaction:count>
60
+
61
+ <interaction:id>d1dfbdb616ae42598d2987837ffaa332</interaction:id>
62
+
63
+ <link href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/interactions/interactiond1dfbdb616ae42598d2987837ffaa332.html" rel="presentation"/>
64
+
65
+ <content type="xhtml">
66
+
67
+ <div xmlns="http://www.w3.org/1999/xhtml">
68
+
69
+ <p>
70
+
71
+ <a href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/interactions/interactiond1dfbdb616ae42598d2987837ffaa332.html">Open: https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/interactions/interactiond1dfbdb616ae42598d2987837ffaa332.html</a>
72
+ </p>
73
+ </div>
74
+ </content>
75
+
76
+ <link href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/interaction/entry_2" rel="self"/>
77
+
78
+ <link href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74" rel="workflowrun"/>
79
+ </entry>
80
+ </feed>
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: text/plain
4
+ Content-Length: 9
5
+
6
+ Workflow1
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/xml
4
+ Transfer-Encoding: chunked
5
+
6
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><port:workflowOutputs xmlns:port="http://ns.taverna.org.uk/2010/port/" xmlns:run="http://ns.taverna.org.uk/2010/run/" xmlns:xlink="http://www.w3.org/1999/xlink" port:workflowId="" port:workflowRun="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74" port:workflowRunId="a341b87f-25cc-4dfd-be36-f5b073a6ba74"><port:output port:name="OUT" port:depth="1"><port:list port:length="40" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT"><port:value port:contentFile="/out/OUT/1" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/1"/><port:value port:contentFile="/out/OUT/2" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/2"/><port:value port:contentFile="/out/OUT/3" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/3"/><port:value port:contentFile="/out/OUT/4" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/4"/><port:error port:errorFile="/out/OUT/5.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/5.error"/><port:value port:contentFile="/out/OUT/6" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/6"/><port:value port:contentFile="/out/OUT/7" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/7"/><port:value port:contentFile="/out/OUT/8" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/8"/><port:value port:contentFile="/out/OUT/9" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/9"/><port:value port:contentFile="/out/OUT/10" port:contentType="text/plain" port:contentByteLength="7" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/10"/><port:error port:errorFile="/out/OUT/11.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/11.error"/><port:error port:errorFile="/out/OUT/12.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/12.error"/><port:value port:contentFile="/out/OUT/13" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/13"/><port:error port:errorFile="/out/OUT/14.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/14.error"/><port:value port:contentFile="/out/OUT/15" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/15"/><port:value port:contentFile="/out/OUT/16" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/16"/><port:value port:contentFile="/out/OUT/17" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/17"/><port:value port:contentFile="/out/OUT/18" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/18"/><port:error port:errorFile="/out/OUT/19.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/19.error"/><port:value port:contentFile="/out/OUT/20" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/20"/><port:error port:errorFile="/out/OUT/21.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/21.error"/><port:value port:contentFile="/out/OUT/22" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/22"/><port:value port:contentFile="/out/OUT/23" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/23"/><port:value port:contentFile="/out/OUT/24" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/24"/><port:value port:contentFile="/out/OUT/25" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/25"/><port:error port:errorFile="/out/OUT/26.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/26.error"/><port:value port:contentFile="/out/OUT/27" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/27"/><port:value port:contentFile="/out/OUT/28" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/28"/><port:value port:contentFile="/out/OUT/29" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/29"/><port:value port:contentFile="/out/OUT/30" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/30"/><port:value port:contentFile="/out/OUT/31" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/31"/><port:value port:contentFile="/out/OUT/32" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/32"/><port:value port:contentFile="/out/OUT/33" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/33"/><port:value port:contentFile="/out/OUT/34" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/34"/><port:value port:contentFile="/out/OUT/35" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/35"/><port:value port:contentFile="/out/OUT/36" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/36"/><port:value port:contentFile="/out/OUT/37" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/37"/><port:value port:contentFile="/out/OUT/38" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/38"/><port:value port:contentFile="/out/OUT/39" port:contentType="text/plain" port:contentByteLength="8" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/39"/><port:error port:errorFile="/out/OUT/40.error" port:errorByteLength="101" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT/40.error"/></port:list></port:output></port:workflowOutputs>
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/xml
4
+ Content-Length: 661
5
+
6
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><port:workflowOutputs xmlns:port="http://ns.taverna.org.uk/2010/port/" xmlns:run="http://ns.taverna.org.uk/2010/run/" xmlns:xlink="http://www.w3.org/1999/xlink" port:workflowId="" port:workflowRun="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74" port:workflowRunId="a341b87f-25cc-4dfd-be36-f5b073a6ba74"><port:output port:name="OUT" port:depth="0"><port:value port:contentFile="/out/OUT" port:contentType="text/plain" port:contentByteLength="5" xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd/out/OUT"/></port:output></port:workflowOutputs>
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/xml
4
+ Content-Length: 480
5
+
6
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ts-rest:permissionsDescriptor xmlns:ts="http://ns.taverna.org.uk/2010/xml/server/" xmlns:feed="http://ns.taverna.org.uk/2010/xml/server/feed/" xmlns:port="http://ns.taverna.org.uk/2010/port/" xmlns:ts-soap="http://ns.taverna.org.uk/2010/xml/server/soap/" xmlns:ts-rest="http://ns.taverna.org.uk/2010/xml/server/rest/" xmlns:admin="http://ns.taverna.org.uk/2010/xml/server/admin/" xmlns:xlink="http://www.w3.org/1999/xlink"/>
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/xml
4
+ Content-Length: 1098
5
+
6
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ts-rest:securityDescriptor xmlns:ts="http://ns.taverna.org.uk/2010/xml/server/" xmlns:feed="http://ns.taverna.org.uk/2010/xml/server/feed/" xmlns:port="http://ns.taverna.org.uk/2010/port/" xmlns:ts-soap="http://ns.taverna.org.uk/2010/xml/server/soap/" xmlns:ts-rest="http://ns.taverna.org.uk/2010/xml/server/rest/" xmlns:admin="http://ns.taverna.org.uk/2010/xml/server/admin/" xmlns:xlink="http://www.w3.org/1999/xlink" ts:serverVersion="2.5.4" ts:serverRevision="d285a5fbfa86b6e7e8e33baffb54830ecec256af (tag: jenkins-taverna-server-2.5-auto-263)" ts:serverBuildTimestamp="25.04.2014 @ 10:54:50 BST"><ts-rest:owner>test</ts-rest:owner><ts-rest:permissions xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/security/permissions"/><ts-rest:credentials xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/security/credentials"/><ts-rest:trusts xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/security/trusts"/></ts-rest:securityDescriptor>
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/xml
4
+ Content-Length: 3054
5
+
6
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ts-rest:runDescription xmlns:ts="http://ns.taverna.org.uk/2010/xml/server/" xmlns:feed="http://ns.taverna.org.uk/2010/xml/server/feed/" xmlns:port="http://ns.taverna.org.uk/2010/port/" xmlns:ts-soap="http://ns.taverna.org.uk/2010/xml/server/soap/" xmlns:ts-rest="http://ns.taverna.org.uk/2010/xml/server/rest/" xmlns:admin="http://ns.taverna.org.uk/2010/xml/server/admin/" xmlns:xlink="http://www.w3.org/1999/xlink" ts-rest:owner="test" ts:serverVersion="2.5.4" ts:serverRevision="d285a5fbfa86b6e7e8e33baffb54830ecec256af (tag: jenkins-taverna-server-2.5-auto-263)" ts:serverBuildTimestamp="25.04.2014 @ 10:54:50 BST"><ts-rest:expiry xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/expiry">20140501T203520.135+0100</ts-rest:expiry><ts-rest:creationWorkflow xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/workflow"/><ts-rest:createTime xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/createTime"/><ts-rest:startTime xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/startTime"/><ts-rest:finishTime xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/finishTime"/><ts-rest:status xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/status"/><ts-rest:workingDirectory xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/wd"/><ts-rest:inputs xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/input"/><ts-rest:output xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/output"/><ts-rest:securityContext xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/security"/><ts-rest:listeners xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/listeners"><ts-rest:listener xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/listeners/io"/></ts-rest:listeners><ts-rest:interaction xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/interaction"/><ts-rest:name xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/name"/><ts-rest:stdout xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/stdout"/><ts-rest:stderr xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/stderr"/><ts-rest:usage xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/usage"/><ts-rest:log xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/log"/><ts-rest:run-bundle xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/run-bundle"/><ts-rest:generate-provenance xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74/generate-provenance"/></ts-rest:runDescription>
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/xml
4
+ Content-Length: 657
5
+
6
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ts-rest:runList xmlns:ts="http://ns.taverna.org.uk/2010/xml/server/" xmlns:feed="http://ns.taverna.org.uk/2010/xml/server/feed/" xmlns:port="http://ns.taverna.org.uk/2010/port/" xmlns:ts-soap="http://ns.taverna.org.uk/2010/xml/server/soap/" xmlns:ts-rest="http://ns.taverna.org.uk/2010/xml/server/rest/" xmlns:admin="http://ns.taverna.org.uk/2010/xml/server/admin/" xmlns:xlink="http://www.w3.org/1999/xlink"><ts-rest:run xlink:href="https://localhost/taverna/rest/runs/a341b87f-25cc-4dfd-be36-f5b073a6ba74" ts:serverVersion="2.5.4">a341b87f-25cc-4dfd-be36-f5b073a6ba74</ts-rest:run></ts-rest:runList>
@@ -0,0 +1,6 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Content-Type: application/xml
4
+ Content-Length: 875
5
+
6
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ts-rest:serverDescription xmlns:ts="http://ns.taverna.org.uk/2010/xml/server/" xmlns:feed="http://ns.taverna.org.uk/2010/xml/server/feed/" xmlns:port="http://ns.taverna.org.uk/2010/port/" xmlns:ts-soap="http://ns.taverna.org.uk/2010/xml/server/soap/" xmlns:ts-rest="http://ns.taverna.org.uk/2010/xml/server/rest/" xmlns:admin="http://ns.taverna.org.uk/2010/xml/server/admin/" xmlns:xlink="http://www.w3.org/1999/xlink" ts:serverVersion="2.5.4" ts:serverRevision="d285a5fbfa86b6e7e8e33baffb54830ecec256af (tag: jenkins-taverna-server-2.5-auto-263)" ts:serverBuildTimestamp="25.04.2014 @ 10:54:50 BST"><ts-rest:runs xlink:href="https://localhost/taverna/rest/runs"/><ts-rest:policy xlink:href="https://localhost/taverna/rest/policy"/><ts-rest:feed xlink:href="https://localhost/taverna/feed"/></ts-rest:serverDescription>
@@ -0,0 +1 @@
1
+ A fake log message with 39 characters.
@@ -0,0 +1,107 @@
1
+ # Copyright (c) 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 'webmock/test_unit'
34
+
35
+ module T2Server
36
+ module Mocks
37
+
38
+ def mock(path, options = {})
39
+ options = { :method => :get, :accept => "*/*" }.merge(options)
40
+
41
+ with = { :headers => { "Accept" => options[:accept] } }
42
+ if options[:body] && (options[:method] == :post || options[:method] == :put)
43
+ with[:body] = options[:body]
44
+ end
45
+
46
+ output =
47
+ if options[:output]
48
+ mocked_file(options[:output])
49
+ else
50
+ out = options[:status] ? add_to_hash(:status, options[:status]) : []
51
+
52
+ if options[:body] && options[:method] == :get
53
+ out = add_to_hash(:body, options[:body], out)
54
+ unless options[:body].instance_of?(File)
55
+ out = add_to_hash("Content-Length", options[:body].length, out)
56
+ end
57
+ end
58
+
59
+ out = add_to_hash("Location", options[:location], out, true) if options[:location]
60
+ out
61
+ end
62
+
63
+ stub = stub_request(options[:method], uri(options[:credentials]) + path).
64
+ with(with)
65
+ stub = stub.to_return(output) unless output == []
66
+ stub = stub.to_raise(options[:raise]) if options[:raise]
67
+ options[:timeout] ? stub.to_timeout : stub
68
+ end
69
+
70
+ def mocked_file(name)
71
+ File.new(File.join(File.dirname(__FILE__), name))
72
+ end
73
+
74
+ private
75
+
76
+ def add_to_hash(param, values, hash = [], headers = false)
77
+ values = [*values]
78
+
79
+ hi = 0
80
+ values.each do |v|
81
+ hash[hi] ||= {}
82
+
83
+ if headers
84
+ hash[hi][:headers] ||= {}
85
+ hash[hi][:headers][param] = v
86
+ else
87
+ hash[hi][param] = v
88
+ end
89
+
90
+ hi += 1
91
+ end
92
+
93
+ hash
94
+ end
95
+
96
+ def uri(credentials)
97
+ if credentials.nil?
98
+ $uri.to_s
99
+ else
100
+ u = $uri.dup
101
+ u.userinfo = credentials
102
+ u.to_s
103
+ end
104
+ end
105
+
106
+ end
107
+ end
@@ -0,0 +1,7 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Allow: GET,PUT,HEAD,OPTIONS
4
+ Date: Tue, 10 Jun 2014 15:53:35 GMT
5
+ Content-Type: application/octet-stream
6
+ Content-Length: 0
7
+
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2012 The University of Manchester, UK.
1
+ # Copyright (c) 2014 The University of Manchester, UK.
2
2
  #
3
3
  # All rights reserved.
4
4
  #
@@ -30,37 +30,65 @@
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 TestAdmin < Test::Unit::TestCase
37
+ include T2Server::Mocks
36
38
 
37
- def test_admin
38
- T2Server::Server.new($uri, $conn_params) do |server|
39
+ def setup
40
+ @server = T2Server::Server.new($uri, $conn_params)
39
41
 
40
- # Test for a user that we know isn't configured on the server.
41
- assert_raise(T2Server::AuthorizationError) do
42
- server.administrator(T2Server::HttpBasic.new("u", "p"))
43
- end
42
+ mock("/admin", :accept => "application/xml", :output => "get-admin.raw",
43
+ :credentials => $userinfo)
44
+ mock("/admin/allowNew", :method => :options, :credentials => $userinfo,
45
+ :output => "options-admin-allownew.raw")
46
+ end
47
+
48
+ def test_admin_init
49
+ @server.administrator($creds) do |admin|
50
+ assert_not_nil admin["allowNew"]
51
+ assert_nil admin["__not-here__"]
52
+ end
53
+ end
44
54
 
45
- # Test for a user that is in the system but may or may not be a
46
- # superuser. If the user is not a superuser then don't perform any more
47
- # tests on the admin resource.
48
- begin
49
- server.administrator($creds)
50
- rescue T2Server::AccessForbiddenError => e
51
- # ignore, just don't run more tests
52
- return
53
- end
55
+ def test_admin_resource
56
+ @server.administrator($creds) do |admin|
57
+ resource = admin["allownew"]
58
+
59
+ assert_not_nil resource
60
+ assert_equal "allowNew", resource.name
61
+ assert resource.writable?
62
+ assert resource.respond_to?(:value=)
63
+
64
+ rEsOuRcE = admin["AlLOwnEW"]
65
+ assert_not_nil rEsOuRcE
66
+ assert_same resource, rEsOuRcE
67
+ end
68
+ end
69
+
70
+ def test_admin_read
71
+ value = ["true", "false"]
72
+ mock("/admin/allowNew", :credentials => $userinfo, :accept => "text/plain",
73
+ :body => value)
74
+
75
+ @server.administrator($creds) do |admin|
76
+ resource = admin["allownew"]
77
+
78
+ # Test that the value is fetched from the server each time.
79
+ assert_equal value[0], resource.value
80
+ assert_equal value[1], resource.value
81
+ end
82
+ end
54
83
 
55
- server.administrator($creds) do |admin|
56
- assert_equal(admin["allownew"].name, "allowNew")
84
+ def test_admin_write
85
+ value = false
86
+ mock("/admin/allowNew", :method => :put, :credentials => $userinfo,
87
+ :body => value.to_s, :status => 200)
57
88
 
58
- save = admin["allownew"].value
59
- admin["allownew"].value = false
60
- assert_equal(admin["allownew"].value, "false")
61
- admin["allownew"].value = save
62
- assert_equal(admin["allownew"].value, save)
63
- end
89
+ @server.administrator($creds) do |admin|
90
+ resource = admin["allownew"]
91
+ resource.value = value
64
92
  end
65
93
  end
66
94
  end
@@ -0,0 +1,66 @@
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 TestAdmin < Test::Unit::TestCase
36
+
37
+ def test_admin
38
+ T2Server::Server.new($uri, $conn_params) do |server|
39
+
40
+ # Test for a user that we know isn't configured on the server.
41
+ assert_raise(T2Server::AuthorizationError) do
42
+ server.administrator(T2Server::HttpBasic.new("u", "p"))
43
+ end
44
+
45
+ # Test for a user that is in the system but may or may not be a
46
+ # superuser. If the user is not a superuser then don't perform any more
47
+ # tests on the admin resource.
48
+ begin
49
+ server.administrator($creds)
50
+ rescue T2Server::AccessForbiddenError => e
51
+ # ignore, just don't run more tests
52
+ return
53
+ end
54
+
55
+ server.administrator($creds) do |admin|
56
+ assert_equal(admin["allownew"].name, "allowNew")
57
+
58
+ save = admin["allownew"].value
59
+ admin["allownew"].value = false
60
+ assert_equal(admin["allownew"].value, "false")
61
+ admin["allownew"].value = save
62
+ assert_equal(admin["allownew"].value, save)
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,87 @@
1
+ # Copyright (c) 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
+ class TestConnection < Test::Unit::TestCase
36
+
37
+ # Test URIs.
38
+ EXAMPLE_COM = "http://example.com"
39
+ EXAMPLE_COM_S = "https://example.com"
40
+ EXAMPLE_URI = URI.parse(EXAMPLE_COM)
41
+ EXAMPLE_URI_S = URI.parse(EXAMPLE_COM_S)
42
+
43
+ def test_bad_connection_addresses
44
+ # Should only pass in URI objects for the address.
45
+ assert_raise(URI::InvalidURIError) do
46
+ T2Server::ConnectionFactory.connect(EXAMPLE_COM, $conn_params)
47
+ end
48
+
49
+ # Should only try and handle http(s) schemes.
50
+ bad_scheme = URI.parse("httpx://example.com")
51
+ assert_raise(URI::InvalidURIError) do
52
+ T2Server::ConnectionFactory.connect(bad_scheme, $conn_params)
53
+ end
54
+ end
55
+
56
+ def test_bad_connection_params
57
+ assert_raise(ArgumentError) do
58
+ T2Server::ConnectionFactory.connect(EXAMPLE_URI, "wrong")
59
+ end
60
+ end
61
+
62
+ def test_no_connection_params
63
+ assert_nothing_raised(ArgumentError) do
64
+ T2Server::ConnectionFactory.connect(EXAMPLE_URI)
65
+ end
66
+ end
67
+
68
+ def test_return_same_connection_for_same_address
69
+ conn1 = T2Server::ConnectionFactory.connect(EXAMPLE_URI, $conn_params)
70
+ conn2 = T2Server::ConnectionFactory.connect(EXAMPLE_URI, $conn_params)
71
+ conn3 = T2Server::ConnectionFactory.connect(EXAMPLE_URI_S, $conn_params)
72
+ conn4 = T2Server::ConnectionFactory.connect(EXAMPLE_URI_S, $conn_params)
73
+
74
+ assert_same conn1, conn2
75
+ assert_same conn3, conn4
76
+ assert_not_same conn1, conn3
77
+ assert_not_same conn2, conn4
78
+ end
79
+
80
+ def test_return_different_connection_for_different_address
81
+ conn1 = T2Server::ConnectionFactory.connect(EXAMPLE_URI, $conn_params)
82
+ conn2 = T2Server::ConnectionFactory.connect(EXAMPLE_URI_S, $conn_params)
83
+
84
+ assert_not_same conn1, conn2
85
+ end
86
+
87
+ end