taverna-player 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/.gitignore +18 -0
  2. data/Gemfile +18 -0
  3. data/LICENCE.rdoc +29 -0
  4. data/README.rdoc +663 -0
  5. data/Rakefile +65 -0
  6. data/app/assets/javascripts/taverna_player/application.js +14 -0
  7. data/app/assets/javascripts/taverna_player/runs.js +42 -0
  8. data/app/assets/stylesheets/scaffold.css +56 -0
  9. data/app/assets/stylesheets/taverna_player/application.css +13 -0
  10. data/app/assets/stylesheets/taverna_player/coderay.css +120 -0
  11. data/app/controllers/taverna_player/application_controller.rb +16 -0
  12. data/app/controllers/taverna_player/runs_controller.rb +18 -0
  13. data/app/controllers/taverna_player/service_credentials_controller.rb +18 -0
  14. data/app/helpers/taverna_player/application_helper.rb +55 -0
  15. data/app/helpers/taverna_player/runs_helper.rb +84 -0
  16. data/app/models/taverna_player/interaction.rb +25 -0
  17. data/app/models/taverna_player/run.rb +117 -0
  18. data/app/models/taverna_player/run_port.rb +148 -0
  19. data/app/models/taverna_player/service_credential.rb +56 -0
  20. data/app/views/layouts/taverna_player/embedded.html.erb +27 -0
  21. data/app/views/taverna_player/runs/_button.html.erb +19 -0
  22. data/app/views/taverna_player/runs/_info.html.erb +56 -0
  23. data/app/views/taverna_player/runs/_info.json.jbuilder +2 -0
  24. data/app/views/taverna_player/runs/_inputs.html.erb +34 -0
  25. data/app/views/taverna_player/runs/_inputs.json.jbuilder +8 -0
  26. data/app/views/taverna_player/runs/_interaction.html.erb +68 -0
  27. data/app/views/taverna_player/runs/_outputs.html.erb +41 -0
  28. data/app/views/taverna_player/runs/_poll.html.erb +27 -0
  29. data/app/views/taverna_player/runs/create.json.jbuilder +3 -0
  30. data/app/views/taverna_player/runs/embedded/_button.html.erb +19 -0
  31. data/app/views/taverna_player/runs/embedded/_info.html.erb +25 -0
  32. data/app/views/taverna_player/runs/embedded/_inputs.html.erb +32 -0
  33. data/app/views/taverna_player/runs/embedded/_outputs.html.erb +32 -0
  34. data/app/views/taverna_player/runs/embedded/new.html.erb +58 -0
  35. data/app/views/taverna_player/runs/embedded/show.html.erb +39 -0
  36. data/app/views/taverna_player/runs/embedded/show.js.erb +35 -0
  37. data/app/views/taverna_player/runs/index.html.erb +40 -0
  38. data/app/views/taverna_player/runs/index.json.jbuilder +1 -0
  39. data/app/views/taverna_player/runs/new.html.erb +56 -0
  40. data/app/views/taverna_player/runs/new.json.jbuilder +1 -0
  41. data/app/views/taverna_player/runs/show.html.erb +29 -0
  42. data/app/views/taverna_player/runs/show.js.erb +25 -0
  43. data/app/views/taverna_player/runs/show.json.jbuilder +25 -0
  44. data/app/views/taverna_player/service_credentials/_form.html.erb +53 -0
  45. data/app/views/taverna_player/service_credentials/edit.html.erb +18 -0
  46. data/app/views/taverna_player/service_credentials/index.html.erb +41 -0
  47. data/app/views/taverna_player/service_credentials/new.html.erb +17 -0
  48. data/app/views/taverna_player/service_credentials/show.html.erb +36 -0
  49. data/config/routes.rb +34 -0
  50. data/db/migrate/20130313105546_create_taverna_player_runs.rb +16 -0
  51. data/db/migrate/20130315163019_create_taverna_player_run_ports.rb +15 -0
  52. data/db/migrate/20130318170744_add_attachment_file_to_taverna_player_run_ports.rb +6 -0
  53. data/db/migrate/20130319183634_create_delayed_jobs.rb +22 -0
  54. data/db/migrate/20130320102600_add_status_message_to_taverna_player_runs.rb +5 -0
  55. data/db/migrate/20130321100110_add_depth_and_metadata_to_taverna_player_run_ports.rb +6 -0
  56. data/db/migrate/20130704095504_add_attachment_results_to_taverna_player_runs.rb +5 -0
  57. data/db/migrate/20130705142704_add_embedded_to_taverna_player_runs.rb +5 -0
  58. data/db/migrate/20130714140911_create_taverna_player_interactions.rb +13 -0
  59. data/db/migrate/20130717083653_add_proxy_to_taverna_player_runs.rb +6 -0
  60. data/db/migrate/20130717155415_add_stop_to_taverna_player_runs.rb +5 -0
  61. data/db/migrate/20130811152840_add_attachment_log_to_taverna_player_runs.rb +5 -0
  62. data/db/migrate/20130811211725_change_taverna_player_runs_state_column.rb +5 -0
  63. data/db/migrate/20130812155839_add_name_to_taverna_player_runs.rb +5 -0
  64. data/db/migrate/20130918135348_create_taverna_player_service_credentials.rb +15 -0
  65. data/db/migrate/20130919154200_add_displayed_to_taverna_player_interactions.rb +5 -0
  66. data/db/migrate/20131007153209_add_job_ref_to_taverna_player_runs.rb +13 -0
  67. data/db/migrate/20131010094537_add_reply_caching_to_taverna_player_interactions.rb +19 -0
  68. data/db/migrate/20131017141514_add_failure_message_to_taverna_player_run.rb +5 -0
  69. data/db/migrate/20131018152940_add_serial_number_to_taverna_player_interactions.rb +5 -0
  70. data/db/migrate/20131018160715_add_parent_run_id_to_taverna_player_runs.rb +5 -0
  71. data/db/migrate/20131102113933_add_page_uri_to_taverna_player_interaction.rb +5 -0
  72. data/db/migrate/20131105115218_remove_proxy_from_taverna_player_runs.rb +11 -0
  73. data/db/migrate/20131105141934_change_taverna_player_interactions_output_value_column_name.rb +5 -0
  74. data/db/migrate/20131112165520_add_user_to_taverna_player_run.rb +5 -0
  75. data/lib/generators/taverna_player/callbacks_generator.rb +25 -0
  76. data/lib/generators/taverna_player/controllers_generator.rb +30 -0
  77. data/lib/generators/taverna_player/install_generator.rb +30 -0
  78. data/lib/generators/taverna_player/job_generator.rb +26 -0
  79. data/lib/generators/taverna_player/models_generator.rb +27 -0
  80. data/lib/generators/taverna_player/renderers_generator.rb +26 -0
  81. data/lib/generators/taverna_player/views_generator.rb +27 -0
  82. data/lib/generators/templates/ReadMe.txt +118 -0
  83. data/lib/generators/templates/callbacks/render_callbacks.rb +56 -0
  84. data/lib/generators/templates/callbacks/worker_callbacks.rb +31 -0
  85. data/lib/generators/templates/controllers/runs_controller.rb +20 -0
  86. data/lib/generators/templates/controllers/service_credentials_controller.rb +20 -0
  87. data/lib/generators/templates/initializer.rb +154 -0
  88. data/lib/generators/templates/models/run.rb +20 -0
  89. data/lib/tasks/delete-cancelled-runs.rake +26 -0
  90. data/lib/tasks/delete-old-embedded-runs.rake +26 -0
  91. data/lib/taverna-player.rb +139 -0
  92. data/lib/taverna_player/concerns/controllers/runs_controller.rb +281 -0
  93. data/lib/taverna_player/concerns/controllers/service_credentials_controller.rb +89 -0
  94. data/lib/taverna_player/concerns/models/run.rb +205 -0
  95. data/lib/taverna_player/engine.rb +23 -0
  96. data/lib/taverna_player/model_proxy.rb +51 -0
  97. data/lib/taverna_player/output_renderer.rb +96 -0
  98. data/lib/taverna_player/render_callbacks.rb +41 -0
  99. data/lib/taverna_player/version.rb +15 -0
  100. data/lib/taverna_player/worker.rb +325 -0
  101. data/script/delayed_job +5 -0
  102. data/script/rails +8 -0
  103. data/taverna_player.gemspec +46 -0
  104. data/test/dummy/Rakefile +7 -0
  105. data/test/dummy/app/assets/javascripts/application.js +16 -0
  106. data/test/dummy/app/assets/stylesheets/application.css +14 -0
  107. data/test/dummy/app/controllers/application_controller.rb +15 -0
  108. data/test/dummy/app/controllers/home_controller.rb +16 -0
  109. data/test/dummy/app/controllers/taverna_player/runs_controller.rb +25 -0
  110. data/test/dummy/app/controllers/taverna_player/service_credentials_controller.rb +25 -0
  111. data/test/dummy/app/controllers/workflows_controller.rb +17 -0
  112. data/test/dummy/app/models/user.rb +15 -0
  113. data/test/dummy/app/models/workflow.rb +32 -0
  114. data/test/dummy/app/views/home/index.html.erb +18 -0
  115. data/test/dummy/app/views/layouts/application.html.erb +43 -0
  116. data/test/dummy/app/views/workflows/index.html.erb +35 -0
  117. data/test/dummy/config.ru +4 -0
  118. data/test/dummy/config/application.rb +58 -0
  119. data/test/dummy/config/boot.rb +10 -0
  120. data/test/dummy/config/database.yml +25 -0
  121. data/test/dummy/config/environment.rb +5 -0
  122. data/test/dummy/config/environments/development.rb +37 -0
  123. data/test/dummy/config/environments/production.rb +67 -0
  124. data/test/dummy/config/environments/test.rb +37 -0
  125. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  126. data/test/dummy/config/initializers/inflections.rb +15 -0
  127. data/test/dummy/config/initializers/mime_types.rb +5 -0
  128. data/test/dummy/config/initializers/secret_token.rb +7 -0
  129. data/test/dummy/config/initializers/session_store.rb +8 -0
  130. data/test/dummy/config/initializers/taverna_player.example.rb +40 -0
  131. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  132. data/test/dummy/config/locales/en.yml +5 -0
  133. data/test/dummy/config/routes.rb +22 -0
  134. data/test/dummy/db/migrate/20130314103555_create_workflows.rb +12 -0
  135. data/test/dummy/db/migrate/20130318141557_create_taverna_player_runs.taverna_player.rb +17 -0
  136. data/test/dummy/db/migrate/20130318141558_create_taverna_player_run_ports.taverna_player.rb +16 -0
  137. data/test/dummy/db/migrate/20130318173013_add_attachment_file_to_taverna_player_run_ports.taverna_player.rb +7 -0
  138. data/test/dummy/db/migrate/20130319183816_create_delayed_jobs.taverna_player.rb +23 -0
  139. data/test/dummy/db/migrate/20130320102635_add_status_message_to_taverna_player_runs.taverna_player.rb +6 -0
  140. data/test/dummy/db/migrate/20130321161859_add_depth_and_metadata_to_taverna_player_run_ports.taverna_player.rb +7 -0
  141. data/test/dummy/db/migrate/20130704100146_add_attachment_results_to_taverna_player_runs.taverna_player.rb +6 -0
  142. data/test/dummy/db/migrate/20130705142816_add_embedded_to_taverna_player_runs.taverna_player.rb +6 -0
  143. data/test/dummy/db/migrate/20130714142144_create_taverna_player_interactions.taverna_player.rb +14 -0
  144. data/test/dummy/db/migrate/20130717084809_add_proxy_to_taverna_player_runs.taverna_player.rb +7 -0
  145. data/test/dummy/db/migrate/20130718102707_add_stop_to_taverna_player_runs.taverna_player.rb +6 -0
  146. data/test/dummy/db/migrate/20130811204449_add_attachment_log_to_taverna_player_runs.taverna_player.rb +6 -0
  147. data/test/dummy/db/migrate/20130811212709_change_taverna_player_runs_state_column.taverna_player.rb +6 -0
  148. data/test/dummy/db/migrate/20130812161152_add_name_to_taverna_player_runs.taverna_player.rb +6 -0
  149. data/test/dummy/db/migrate/20130918155525_create_taverna_player_service_credentials.taverna_player.rb +16 -0
  150. data/test/dummy/db/migrate/20130919155202_add_displayed_to_taverna_player_interactions.taverna_player.rb +6 -0
  151. data/test/dummy/db/migrate/20131007153659_add_job_ref_to_taverna_player_runs.taverna_player.rb +14 -0
  152. data/test/dummy/db/migrate/20131016123941_add_reply_caching_to_taverna_player_interactions.taverna_player.rb +20 -0
  153. data/test/dummy/db/migrate/20131017141614_add_failure_message_to_taverna_player_run.taverna_player.rb +6 -0
  154. data/test/dummy/db/migrate/20131018153316_add_serial_number_to_taverna_player_interactions.taverna_player.rb +6 -0
  155. data/test/dummy/db/migrate/20131018164614_add_parent_run_id_to_taverna_player_runs.taverna_player.rb +6 -0
  156. data/test/dummy/db/migrate/20131102114343_add_page_uri_to_taverna_player_interaction.taverna_player.rb +6 -0
  157. data/test/dummy/db/migrate/20131105115724_remove_proxy_from_taverna_player_runs.taverna_player.rb +12 -0
  158. data/test/dummy/db/migrate/20131105142417_change_taverna_player_interactions_output_value_column_name.taverna_player.rb +6 -0
  159. data/test/dummy/db/migrate/20131112165815_add_user_to_taverna_player_run.taverna_player.rb +6 -0
  160. data/test/dummy/db/migrate/20131114130937_create_users.rb +10 -0
  161. data/test/dummy/db/schema.rb +123 -0
  162. data/test/dummy/lib/callbacks.rb +35 -0
  163. data/test/dummy/log/.gitkeep +0 -0
  164. data/test/dummy/public/404.html +26 -0
  165. data/test/dummy/public/422.html +26 -0
  166. data/test/dummy/public/500.html +25 -0
  167. data/test/dummy/public/favicon.ico +0 -0
  168. data/test/dummy/script/delayed_job +5 -0
  169. data/test/dummy/script/rails +6 -0
  170. data/test/dummy/test/functional/home_controller_test.rb +28 -0
  171. data/test/dummy/test/functional/workflows_controller_test.rb +21 -0
  172. data/test/fixtures/files/crassostrea_gigas.csv +737 -0
  173. data/test/fixtures/taverna_player/interactions.yml +32 -0
  174. data/test/fixtures/taverna_player/run_ports.yml +54 -0
  175. data/test/fixtures/taverna_player/runs.yml +69 -0
  176. data/test/fixtures/taverna_player/service_credentials.yml +25 -0
  177. data/test/fixtures/users.yml +16 -0
  178. data/test/fixtures/workflows.yml +32 -0
  179. data/test/functional/taverna_player/runs_controller_test.rb +316 -0
  180. data/test/functional/taverna_player/service_credentials_controller_test.rb +99 -0
  181. data/test/taverna_player_test.rb +25 -0
  182. data/test/test_helper.rb +33 -0
  183. data/test/unit/helpers/taverna_player/application_helper_test.rb +70 -0
  184. data/test/unit/helpers/taverna_player/runs_helper_test.rb +45 -0
  185. data/test/unit/taverna_player/interaction_test.rb +47 -0
  186. data/test/unit/taverna_player/run_port_test.rb +309 -0
  187. data/test/unit/taverna_player/run_test.rb +196 -0
  188. data/test/unit/taverna_player/service_credential_test.rb +64 -0
  189. data/test/workflows/hello.t2flow +164 -0
  190. data/test/workflows/list_with_errors.t2flow +107 -0
  191. data/test/workflows/pass_through.t2flow +12 -0
  192. metadata +539 -0
@@ -0,0 +1,99 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Taverna Player was developed in the BioVeL project, funded by the European
7
+ # Commission 7th Framework Programme (FP7), through grant agreement
8
+ # number 283359.
9
+ #
10
+ # Author: Robert Haines
11
+ #------------------------------------------------------------------------------
12
+
13
+ require 'test_helper'
14
+
15
+ module TavernaPlayer
16
+ class ServiceCredentialsControllerTest < ActionController::TestCase
17
+ setup do
18
+ @sc1 = taverna_player_service_credentials(:one)
19
+ @sc2 = taverna_player_service_credentials(:two)
20
+ @routes = TavernaPlayer::Engine.routes
21
+ end
22
+
23
+ test "should route to service credentials" do
24
+ assert_routing "/service_credentials",
25
+ { :controller => "taverna_player/service_credentials",
26
+ :action => "index" }, {}, {}, "Did not route correctly"
27
+ end
28
+
29
+ test "should route to a service credential" do
30
+ assert_routing "/service_credentials/1",
31
+ { :controller => "taverna_player/service_credentials",
32
+ :action => "show", :id => "1" }, {}, {}, "Did not route correctly"
33
+ end
34
+
35
+ test "should get index and be overridden" do
36
+ get :index
37
+ assert_response :success
38
+ assert_not_nil assigns(:service_credentials)
39
+ assert_not_nil assigns(:override)
40
+ assert_template "application", "Did not render with the correct layout"
41
+ end
42
+
43
+ test "should get new" do
44
+ get :new
45
+ assert_response :success
46
+ assert_not_nil assigns(:service_credential)
47
+ assert_template "application", "Did not render with the correct layout"
48
+ end
49
+
50
+ test "should create service_credential" do
51
+ assert_difference('ServiceCredential.count') do
52
+ post :create, :service_credential => {
53
+ :description => @sc1.description,
54
+ :login => @sc1.login,
55
+ :name => @sc1.name,
56
+ :password => @sc1.password,
57
+ :password_confirmation => @sc1.password,
58
+ :uri => @sc1.uri
59
+ }
60
+ end
61
+
62
+ assert_redirected_to service_credential_path(assigns(:service_credential))
63
+ end
64
+
65
+ test "should show service_credential and not be overridden" do
66
+ get :show, :id => @sc1
67
+ assert_response :success
68
+ refute assigns(:override)
69
+ assert_template "application", "Did not render with the correct layout"
70
+ end
71
+
72
+ test "should get edit" do
73
+ get :edit, :id => @sc1
74
+ assert_response :success
75
+ end
76
+
77
+ test "should update service_credential" do
78
+ put :update, :id => @sc1, :service_credential => {
79
+ :description => @sc1.description,
80
+ :login => @sc1.login,
81
+ :name => @sc1.name,
82
+ :password => @sc1.password,
83
+ :password_confirmation => @sc1.password,
84
+ :uri => @sc1.uri
85
+ }
86
+
87
+ assert_redirected_to service_credential_path(assigns(:service_credential))
88
+ end
89
+
90
+ test "should destroy service_credential" do
91
+ assert_difference('ServiceCredential.count', -1) do
92
+ delete :destroy, :id => @sc1
93
+ end
94
+
95
+ assert_response :redirect, "Response was not a redirect"
96
+ assert_redirected_to service_credentials_path
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,25 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Taverna Player was developed in the BioVeL project, funded by the European
7
+ # Commission 7th Framework Programme (FP7), through grant agreement
8
+ # number 283359.
9
+ #
10
+ # Author: Robert Haines
11
+ #------------------------------------------------------------------------------
12
+
13
+ require 'test_helper'
14
+
15
+ class TavernaPlayerTest < ActiveSupport::TestCase
16
+ test "truth" do
17
+ assert_kind_of Module, TavernaPlayer
18
+ end
19
+
20
+ test "extra mime types present" do
21
+ ["application/x-error", "application/x-empty", "inode/x-empty"].each do |type|
22
+ assert_not_empty MIME::Types[type], "MIME type '#{type}' missing"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,33 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Taverna Player was developed in the BioVeL project, funded by the European
7
+ # Commission 7th Framework Programme (FP7), through grant agreement
8
+ # number 283359.
9
+ #
10
+ # Author: Robert Haines
11
+ #------------------------------------------------------------------------------
12
+
13
+ # Configure Rails Environment
14
+ ENV["RAILS_ENV"] = "test"
15
+
16
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
17
+ require "rails/test_help"
18
+
19
+ Rails.backtrace_cleaner.remove_silencers!
20
+
21
+ # Load support files
22
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
23
+
24
+ # Load fixtures from the engine
25
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
26
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
27
+ end
28
+
29
+ class ActiveSupport::TestCase
30
+ include TavernaPlayer::Engine.routes.url_helpers
31
+ include ActionDispatch::TestProcess
32
+ fixtures :all
33
+ end
@@ -0,0 +1,70 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Taverna Player was developed in the BioVeL project, funded by the European
7
+ # Commission 7th Framework Programme (FP7), through grant agreement
8
+ # number 283359.
9
+ #
10
+ # Author: Robert Haines
11
+ #------------------------------------------------------------------------------
12
+
13
+ require 'test_helper'
14
+
15
+ module TavernaPlayer
16
+ class ApplicationHelperTest < ActionView::TestCase
17
+ setup do
18
+ @run = taverna_player_runs(:one)
19
+ @workflow = workflows(:one)
20
+ end
21
+
22
+ test "should output embedded run path from id" do
23
+ id = 2
24
+ path = new_embedded_run_path(id)
25
+ assert path.include?("embedded=true"), "Path missing 'embedded=true'"
26
+ assert path.include?("workflow_id=#{id}"), "Path missing workflow_id"
27
+ refute path.include?("http://"), "Path should not have a URI scheme"
28
+ end
29
+
30
+ test "should output embedded run path from run" do
31
+ id = @run.workflow_id
32
+ path = new_embedded_run_path(@run)
33
+ assert path.include?("embedded=true"), "Path missing 'embedded=true'"
34
+ assert path.include?("workflow_id=#{id}"), "Path missing workflow_id"
35
+ refute path.include?("http://"), "Path should not have a URI scheme"
36
+ end
37
+
38
+ test "should output embedded run path from workflow" do
39
+ id = @workflow.id
40
+ path = new_embedded_run_path(@workflow)
41
+ assert path.include?("embedded=true"), "Path missing 'embedded=true'"
42
+ assert path.include?("workflow_id=#{id}"), "Path missing workflow_id"
43
+ refute path.include?("http://"), "Path should not have a URI scheme"
44
+ end
45
+
46
+ test "should output embedded run url from id" do
47
+ id = 2
48
+ path = new_embedded_run_url(id)
49
+ assert path.include?("embedded=true"), "Path missing 'embedded=true'"
50
+ assert path.include?("workflow_id=#{id}"), "Path missing workflow_id"
51
+ assert path.include?("http://"), "Path missing a URI scheme"
52
+ end
53
+
54
+ test "should output embedded run url from run" do
55
+ id = @run.workflow_id
56
+ path = new_embedded_run_url(@run)
57
+ assert path.include?("embedded=true"), "Path missing 'embedded=true'"
58
+ assert path.include?("workflow_id=#{id}"), "Path missing workflow_id"
59
+ assert path.include?("http://"), "Path missing a URI scheme"
60
+ end
61
+
62
+ test "should output embedded run url from workflow" do
63
+ id = @workflow.id
64
+ path = new_embedded_run_url(@workflow)
65
+ assert path.include?("embedded=true"), "Path missing 'embedded=true'"
66
+ assert path.include?("workflow_id=#{id}"), "Path missing workflow_id"
67
+ assert path.include?("http://"), "Path missing a URI scheme"
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,45 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Taverna Player was developed in the BioVeL project, funded by the European
7
+ # Commission 7th Framework Programme (FP7), through grant agreement
8
+ # number 283359.
9
+ #
10
+ # Author: Robert Haines
11
+ #------------------------------------------------------------------------------
12
+
13
+ require 'test_helper'
14
+
15
+ module TavernaPlayer
16
+ class RunsHelperTest < ActionView::TestCase
17
+ setup do
18
+ @run1 = taverna_player_runs(:one)
19
+ @port1 = taverna_player_run_ports(:one)
20
+
21
+ @run2 = taverna_player_runs(:three)
22
+ @port2 = taverna_player_run_ports(:four)
23
+
24
+ @run3 = taverna_player_runs(:four)
25
+ @port3 = taverna_player_run_ports(:five)
26
+ end
27
+
28
+ test "should show text outputs" do
29
+ assert_equal "Hello, World!", @port1.value, "Unexpected workflow output"
30
+ assert show_output(@run1, @port1).include?("<pre>Hello, World!</pre>"),
31
+ "Workflow output not formatted correctly"
32
+
33
+ assert_equal "Rob", @port2.value, "Unexpected workflow output"
34
+ assert show_output(@run2, @port2).include?("<pre>Rob</pre>"),
35
+ "Workflow output not formatted correctly"
36
+ end
37
+
38
+ test "should autolink text output" do
39
+ assert_equal "(http://example.com/path?query=1)", @port3.value,
40
+ "Unexpected workflow output"
41
+ assert show_output(@run3, @port3).include?("(<a href=\"http://example.com/path?query=1\" target=\"_blank\">http://example.com/path?query=1</a>)"),
42
+ "Workflow output not formatted correctly"
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,47 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Taverna Player was developed in the BioVeL project, funded by the European
7
+ # Commission 7th Framework Programme (FP7), through grant agreement
8
+ # number 283359.
9
+ #
10
+ # Author: Robert Haines
11
+ #------------------------------------------------------------------------------
12
+
13
+ require 'test_helper'
14
+
15
+ module TavernaPlayer
16
+ class InteractionTest < ActiveSupport::TestCase
17
+ test "should not save interaction without a unique_id" do
18
+ int = Interaction.new
19
+ int.serial = "ask0"
20
+ refute int.save, "Saved the interaction without a unique_id"
21
+ end
22
+
23
+ test "should not save interaction without a serial number" do
24
+ int = Interaction.new
25
+ int.unique_id = "af19046f-4614-44a7-ad83-f940cea63c4a"
26
+ refute int.save, "Saved the interaction without a serial number"
27
+ end
28
+
29
+ test "should not allow two identical serial numbers for the same run" do
30
+ int = Interaction.new
31
+ int.unique_id = "fdb30aed-96ac-4499-b8b6-0a11cf82ccee"
32
+ int.serial = "ask0"
33
+ int.run_id = 4
34
+ refute int.save, "Saved the interaction with a non-unique serial number"
35
+ end
36
+
37
+ test "replied defaults to false" do
38
+ int = Interaction.new
39
+ refute int.replied, "Interaction#replied did not default to false"
40
+ end
41
+
42
+ test "displayed defaults to false" do
43
+ int = Interaction.new
44
+ refute int.displayed, "Interaction#displayed did not default to false"
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,309 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2013 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Taverna Player was developed in the BioVeL project, funded by the European
7
+ # Commission 7th Framework Programme (FP7), through grant agreement
8
+ # number 283359.
9
+ #
10
+ # Author: Robert Haines
11
+ #------------------------------------------------------------------------------
12
+
13
+ require 'test_helper'
14
+
15
+ module TavernaPlayer
16
+ class RunIoTest < ActiveSupport::TestCase
17
+ setup do
18
+ @port1 = taverna_player_run_ports(:one)
19
+ @port2 = taverna_player_run_ports(:two)
20
+ @port3 = taverna_player_run_ports(:three)
21
+ @port5 = taverna_player_run_ports(:five)
22
+ end
23
+
24
+ test "run port inheritance types" do
25
+ in_port = RunPort::Input.new
26
+ assert_equal "TavernaPlayer::RunPort::Input", in_port.port_type,
27
+ "Input does not inherit as TavernaPlayer::RunPort::Input"
28
+
29
+ out_port = RunPort::Output.new
30
+ assert_equal "TavernaPlayer::RunPort::Output", out_port.port_type,
31
+ "Output does not inherit as TavernaPlayer::RunPort::Output"
32
+ end
33
+
34
+ test "should not save run ports without name" do
35
+ in_port = RunPort::Input.new
36
+ assert !in_port.save, "Saved the run input port without a name"
37
+
38
+ out_port = RunPort::Output.new
39
+ assert !out_port.save, "Saved the run output port without a name"
40
+ end
41
+
42
+ test "should not save small input values in a file" do
43
+ test_value =
44
+ "01234567890123456789012345678901234567890123456789"\
45
+ "01234567890123456789012345678901234567890123456789"\
46
+ "01234567890123456789012345678901234567890123456789"\
47
+ "01234567890123456789012345678901234567890123456789"\
48
+ "01234567890123456789012345678901234567890123456789"
49
+
50
+ port = RunPort::Input.create(:name => "test_port")
51
+ port.value = test_value
52
+ assert port.save, "Port did not save"
53
+ assert_equal port.value_preview, port.value, "Value and preview differ"
54
+ assert_nil port.file.path, "File present"
55
+ assert_equal test_value, port.value, "Saved value does not match test"
56
+ end
57
+
58
+ test "should not save small output values in a file" do
59
+ test_value =
60
+ "01234567890123456789012345678901234567890123456789"\
61
+ "01234567890123456789012345678901234567890123456789"\
62
+ "01234567890123456789012345678901234567890123456789"\
63
+ "01234567890123456789012345678901234567890123456789"\
64
+ "01234567890123456789012345678901234567890123456789"
65
+
66
+ port = RunPort::Output.create(:name => "test_port")
67
+ port.value = test_value
68
+ assert port.save, "Port did not save"
69
+ assert_equal port.value_preview, port.value, "Value and preview differ"
70
+ assert_nil port.file.path, "File present"
71
+ assert_equal test_value, port.value, "Saved value does not match test"
72
+ end
73
+
74
+ test "should save large input values in a file" do
75
+ test_value =
76
+ "01234567890123456789012345678901234567890123456789"\
77
+ "01234567890123456789012345678901234567890123456789"\
78
+ "01234567890123456789012345678901234567890123456789"\
79
+ "01234567890123456789012345678901234567890123456789"\
80
+ "01234567890123456789012345678901234567890123456789"\
81
+ "01234567890123456789012345678901234567890123456789"
82
+
83
+ port = RunPort::Input.create(:name => "test_port")
84
+ port.value = test_value
85
+ assert port.save, "Port did not save"
86
+ assert_not_nil port.file.path, "File not present"
87
+ assert port.read_attribute(:value).size == 255, "Port value size != 255"
88
+ assert_equal test_value, port.value, "Saved value does not match test"
89
+ assert_not_equal port.value_preview, port.value, "Value and preview same"
90
+
91
+ port.value = "small"
92
+ assert port.save, "Port did not save"
93
+ assert_nil port.file.path, "File present"
94
+ end
95
+
96
+ test "should save large output values in a file" do
97
+ test_value =
98
+ "01234567890123456789012345678901234567890123456789"\
99
+ "01234567890123456789012345678901234567890123456789"\
100
+ "01234567890123456789012345678901234567890123456789"\
101
+ "01234567890123456789012345678901234567890123456789"\
102
+ "01234567890123456789012345678901234567890123456789"\
103
+ "01234567890123456789012345678901234567890123456789"
104
+
105
+ port = RunPort::Output.create(:name => "test_port")
106
+ port.value = test_value
107
+ assert port.save, "Port did not save"
108
+ assert_not_nil port.file.path, "File not present"
109
+ assert port.read_attribute(:value).size == 255, "Port value size != 255"
110
+ assert_equal test_value, port.value, "Saved value does not match test"
111
+ assert_not_equal port.value_preview, port.value, "Value and preview same"
112
+
113
+ port.value = "small"
114
+ assert port.save, "Port did not save"
115
+ assert_nil port.file.path, "File present"
116
+ end
117
+
118
+ test "should handle non ascii/utf-8 characters in large input values" do
119
+ test_value =
120
+ "\xC2"\
121
+ "01234567890123456789012345678901234567890123456789"\
122
+ "01234567890123456789012345678901234567890123456789"\
123
+ "01234567890123456789012345678901234567890123456789"\
124
+ "01234567890123456789012345678901234567890123456789"\
125
+ "01234567890123456789012345678901234567890123456789"\
126
+ "01234567890123456789012345678901234567890123456789"\
127
+ "\xC2"
128
+
129
+ port = RunPort::Input.create(:name => "test_port")
130
+ port.value = test_value
131
+ assert port.save, "Port did not save"
132
+ assert_not_nil port.file.path, "File not present"
133
+ assert_equal test_value, port.value, "Saved value does not match test"
134
+ assert_not_equal port.value_preview, port.value, "Value and preview same"
135
+ end
136
+
137
+ test "should handle non ascii/utf-8 characters in large output values" do
138
+ test_value =
139
+ "\xC2"\
140
+ "01234567890123456789012345678901234567890123456789"\
141
+ "01234567890123456789012345678901234567890123456789"\
142
+ "01234567890123456789012345678901234567890123456789"\
143
+ "01234567890123456789012345678901234567890123456789"\
144
+ "01234567890123456789012345678901234567890123456789"\
145
+ "01234567890123456789012345678901234567890123456789"\
146
+ "\xC2"
147
+
148
+ port = RunPort::Output.create(:name => "test_port")
149
+ port.value = test_value
150
+ assert port.save, "Port did not save"
151
+ assert_not_nil port.file.path, "File not present"
152
+ assert_equal test_value, port.value, "Saved value does not match test"
153
+ assert_not_equal port.value_preview, port.value, "Value and preview same"
154
+ end
155
+
156
+ test "should display port names correctly" do
157
+ assert_equal @port1.name, @port1.display_name,
158
+ "Name with no spaces should not be changed"
159
+ assert_equal @port2.name, @port2.display_name,
160
+ "Name with no spaces should not be changed"
161
+ assert_not_equal @port3.name, @port3.display_name,
162
+ "Name with spaces should not be unchanged"
163
+ refute @port3.display_name.include?('_'),
164
+ "Display name should not have any underscores"
165
+ refute @port5.display_name.include?('_'),
166
+ "Display name should not have any underscores"
167
+ assert_equal @port3.name.gsub('_', ' '), @port3.display_name,
168
+ "Only underscores should be changed"
169
+ assert_equal @port5.name.gsub('_', ' '), @port5.display_name,
170
+ "Only underscores should be changed"
171
+ end
172
+
173
+ test "should not allow both file and value on create input" do
174
+ file = fixture_file_upload "/files/crassostrea_gigas.csv"
175
+ port = RunPort::Input.create(:name => "test_port", :value => "test",
176
+ :file => file)
177
+
178
+ assert port.value.blank?, "Value should be blank"
179
+ refute port.file.blank?, "File should be present"
180
+ end
181
+
182
+ test "should not allow both file and value on create output" do
183
+ file = fixture_file_upload "/files/crassostrea_gigas.csv"
184
+ port = RunPort::Output.create(:name => "test_port", :value => "test",
185
+ :file => file)
186
+
187
+ assert port.value.blank?, "Value should be blank"
188
+ refute port.file.blank?, "File should be present"
189
+ end
190
+
191
+ test "should not allow both file and value on update input" do
192
+ file = fixture_file_upload "/files/crassostrea_gigas.csv"
193
+ port = RunPort::Input.create(:name => "test_port")
194
+
195
+ port.file = file
196
+ port.value = "test"
197
+ port.save
198
+
199
+ assert port.value.blank?, "Value should be blank"
200
+ refute port.file.blank?, "File should be present"
201
+ end
202
+
203
+ test "should not allow both file and value on update output" do
204
+ file = fixture_file_upload "/files/crassostrea_gigas.csv"
205
+ port = RunPort::Output.create(:name => "test_port")
206
+
207
+ port.file = file
208
+ port.value = "test"
209
+ port.save
210
+
211
+ assert port.value.blank?, "Value should be blank"
212
+ refute port.file.blank?, "File should be present"
213
+ end
214
+
215
+ test "should change large input value correctly" do
216
+ orig_value =
217
+ "01234567890123456789012345678901234567890123456789"\
218
+ "01234567890123456789012345678901234567890123456789"\
219
+ "01234567890123456789012345678901234567890123456789"\
220
+ "01234567890123456789012345678901234567890123456789"\
221
+ "01234567890123456789012345678901234567890123456789"\
222
+ "01234567890123456789012345678901234567890123456789"
223
+
224
+ new_value =
225
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
226
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
227
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
228
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
229
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
230
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
231
+
232
+ port = RunPort::Input.create(:name => "test_port", :value => orig_value)
233
+ refute port.value.blank?, "Value is empty"
234
+ refute port.file.blank?, "File not present"
235
+
236
+ port.value = new_value
237
+ port.save
238
+ refute port.value.blank?, "Value is empty"
239
+ refute port.file.blank?, "File not present"
240
+ assert_not_equal orig_value, port.value, "Port still has old value"
241
+ end
242
+
243
+ test "should change large output value correctly" do
244
+ orig_value =
245
+ "01234567890123456789012345678901234567890123456789"\
246
+ "01234567890123456789012345678901234567890123456789"\
247
+ "01234567890123456789012345678901234567890123456789"\
248
+ "01234567890123456789012345678901234567890123456789"\
249
+ "01234567890123456789012345678901234567890123456789"\
250
+ "01234567890123456789012345678901234567890123456789"
251
+
252
+ new_value =
253
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
254
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
255
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
256
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
257
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"\
258
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
259
+
260
+ port = RunPort::Output.create(:name => "test_port", :value => orig_value)
261
+ refute port.value.blank?, "Value is empty"
262
+ refute port.file.blank?, "File not present"
263
+
264
+ port.value = new_value
265
+ port.save
266
+ refute port.value.blank?, "Value is empty"
267
+ refute port.file.blank?, "File not present"
268
+ assert_not_equal orig_value, port.value, "Port still has old value"
269
+ end
270
+
271
+ test "should blank out large value if file changed" do
272
+ orig_value =
273
+ "01234567890123456789012345678901234567890123456789"\
274
+ "01234567890123456789012345678901234567890123456789"\
275
+ "01234567890123456789012345678901234567890123456789"\
276
+ "01234567890123456789012345678901234567890123456789"\
277
+ "01234567890123456789012345678901234567890123456789"\
278
+ "01234567890123456789012345678901234567890123456789"
279
+
280
+ port = RunPort::Input.create(:name => "test_port", :value => orig_value)
281
+ refute port.value.blank?, "Value is empty"
282
+ refute port.file.blank?, "File not present"
283
+
284
+ port.file = fixture_file_upload "/files/crassostrea_gigas.csv"
285
+ port.save
286
+ assert_nil port.value, "Port value not nil"
287
+ refute port.file.blank?, "File not present"
288
+ end
289
+
290
+ test "should blank out large value if file removed" do
291
+ orig_value =
292
+ "01234567890123456789012345678901234567890123456789"\
293
+ "01234567890123456789012345678901234567890123456789"\
294
+ "01234567890123456789012345678901234567890123456789"\
295
+ "01234567890123456789012345678901234567890123456789"\
296
+ "01234567890123456789012345678901234567890123456789"\
297
+ "01234567890123456789012345678901234567890123456789"
298
+
299
+ port = RunPort::Input.create(:name => "test_port", :value => orig_value)
300
+ refute port.value.blank?, "Value is empty"
301
+ refute port.file.blank?, "File not present"
302
+
303
+ port.file = nil
304
+ port.save
305
+ assert_nil port.value, "Port value not nil"
306
+ assert port.file.blank?, "File not present"
307
+ end
308
+ end
309
+ end