taverna-player 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.travis.yml +6 -0
- data/CHANGES.rdoc +28 -0
- data/CITATION +20 -0
- data/Gemfile +0 -12
- data/README.rdoc +30 -16
- data/Rakefile +1 -0
- data/app/controllers/taverna_player/workflows_controller.rb +18 -0
- data/app/helpers/taverna_player/application_helper.rb +2 -2
- data/app/models/taverna_player/run.rb +35 -3
- data/app/models/taverna_player/workflow.rb +41 -0
- data/app/views/taverna_player/workflows/_info.json.jbuilder +1 -0
- data/{test/dummy/app/views → app/views/taverna_player}/workflows/index.html.erb +1 -1
- data/app/views/taverna_player/workflows/index.json.jbuilder +1 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20140917165505_create_taverna_player_workflows.rb +12 -0
- data/lib/generators/taverna_player/controllers_generator.rb +5 -6
- data/lib/generators/taverna_player/models_generator.rb +3 -3
- data/lib/generators/templates/callbacks/worker_callbacks.rb +5 -5
- data/{test/dummy/app → lib/generators/templates}/controllers/workflows_controller.rb +7 -4
- data/{test/dummy/test/functional/workflows_controller_test.rb → lib/generators/templates/models/workflow.rb} +6 -7
- data/lib/generators/templates/player_initializer.rb +5 -4
- data/lib/taverna-player.rb +11 -1
- data/lib/taverna_player/concerns/controllers/runs_controller.rb +1 -1
- data/lib/taverna_player/concerns/controllers/workflows_controller.rb +41 -0
- data/lib/taverna_player/concerns/models/run.rb +42 -14
- data/lib/taverna_player/concerns/models/run_port.rb +2 -1
- data/lib/taverna_player/concerns/models/workflow.rb +44 -0
- data/lib/taverna_player/model_proxy.rb +14 -8
- data/lib/taverna_player/version.rb +1 -1
- data/taverna_player.gemspec +1 -0
- data/test/dummy/app/views/layouts/application.html.erb +1 -1
- data/test/dummy/config/initializers/taverna_player.rb +1 -4
- data/test/dummy/config/routes.rb +1 -7
- data/test/dummy/db/migrate/20140917165846_drop_workflows.rb +9 -0
- data/test/dummy/db/migrate/20140917170017_create_taverna_player_workflows.taverna_player.rb +13 -0
- data/test/dummy/db/schema.rb +9 -9
- data/test/dummy/lib/callbacks.rb +4 -4
- data/test/fixtures/delayed_jobs.yml +45 -0
- data/test/fixtures/taverna_player/interactions.yml +3 -3
- data/test/fixtures/taverna_player/run_ports.yml +7 -12
- data/test/fixtures/taverna_player/runs.yml +43 -13
- data/test/fixtures/{workflows.yml → taverna_player/workflows.yml} +1 -4
- data/test/fixtures/users.yml +2 -3
- data/test/functional/taverna_player/runs_controller_test.rb +42 -15
- data/test/functional/taverna_player/workflows_controller_test.rb +37 -0
- data/test/unit/helpers/taverna_player/application_helper_test.rb +1 -1
- data/test/unit/taverna_player/interaction_test.rb +2 -2
- data/test/unit/taverna_player/model_proxy_test.rb +58 -0
- data/test/unit/taverna_player/run_test.rb +103 -23
- data/test/unit/taverna_player/worker_test.rb +2 -0
- metadata +39 -12
- data/test/dummy/app/models/workflow.rb +0 -32
@@ -0,0 +1,13 @@
|
|
1
|
+
# This migration comes from taverna_player (originally 20140917165505)
|
2
|
+
class CreateTavernaPlayerWorkflows < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :taverna_player_workflows do |t|
|
5
|
+
t.string :title
|
6
|
+
t.string :author
|
7
|
+
t.text :description
|
8
|
+
t.string :file
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20140917170017) do
|
15
15
|
|
16
16
|
create_table "delayed_jobs", :force => true do |t|
|
17
17
|
t.integer "priority", :default => 0
|
@@ -103,14 +103,7 @@ ActiveRecord::Schema.define(:version => 20140226143013) do
|
|
103
103
|
|
104
104
|
add_index "taverna_player_service_credentials", ["uri"], :name => "index_taverna_player_service_credentials_on_uri"
|
105
105
|
|
106
|
-
create_table "
|
107
|
-
t.string "name"
|
108
|
-
t.string "email"
|
109
|
-
t.datetime "created_at", :null => false
|
110
|
-
t.datetime "updated_at", :null => false
|
111
|
-
end
|
112
|
-
|
113
|
-
create_table "workflows", :force => true do |t|
|
106
|
+
create_table "taverna_player_workflows", :force => true do |t|
|
114
107
|
t.string "title"
|
115
108
|
t.string "author"
|
116
109
|
t.text "description"
|
@@ -119,4 +112,11 @@ ActiveRecord::Schema.define(:version => 20140226143013) do
|
|
119
112
|
t.datetime "updated_at", :null => false
|
120
113
|
end
|
121
114
|
|
115
|
+
create_table "users", :force => true do |t|
|
116
|
+
t.string "name"
|
117
|
+
t.string "email"
|
118
|
+
t.datetime "created_at", :null => false
|
119
|
+
t.datetime "updated_at", :null => false
|
120
|
+
end
|
121
|
+
|
122
122
|
end
|
data/test/dummy/lib/callbacks.rb
CHANGED
@@ -11,21 +11,21 @@
|
|
11
11
|
#------------------------------------------------------------------------------
|
12
12
|
|
13
13
|
def player_pre_run_callback(run)
|
14
|
-
w = Workflow.find(run.workflow_id)
|
14
|
+
w = TavernaPlayer::Workflow.find(run.workflow_id)
|
15
15
|
puts "Pre-run callback called for run '#{run.name}' of workflow '#{w.id}'"
|
16
16
|
end
|
17
17
|
|
18
18
|
def player_post_run_callback(run)
|
19
|
-
w = Workflow.find(run.workflow_id)
|
19
|
+
w = TavernaPlayer::Workflow.find(run.workflow_id)
|
20
20
|
puts "Post-run callback called for run '#{run.name}' of workflow '#{w.id}'"
|
21
21
|
end
|
22
22
|
|
23
23
|
def player_run_cancelled_callback(run)
|
24
|
-
w = Workflow.find(run.workflow_id)
|
24
|
+
w = TavernaPlayer::Workflow.find(run.workflow_id)
|
25
25
|
puts "Run-cancelled callback called for run '#{run.name}' of workflow '#{w.id}'"
|
26
26
|
end
|
27
27
|
|
28
28
|
def player_run_failed_callback(run)
|
29
|
-
w = Workflow.find(run.workflow_id)
|
29
|
+
w = TavernaPlayer::Workflow.find(run.workflow_id)
|
30
30
|
puts "Run-failed callback called for run '#{run.name}' of workflow '#{w.id}'"
|
31
31
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#------------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2014 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
|
+
# For some reason we can't use autogenerated IDs and we have to explicitly set
|
14
|
+
# the created_at and updated_at fields otherwise we get database errors for
|
15
|
+
# every test. Does DJ do something odd?
|
16
|
+
|
17
|
+
one:
|
18
|
+
id: 1
|
19
|
+
run_at: 2014-07-21 18:20:00
|
20
|
+
created_at: 2014-07-21 18:20:00
|
21
|
+
updated_at: 2014-07-21 18:20:00
|
22
|
+
|
23
|
+
two:
|
24
|
+
id: 2
|
25
|
+
run_at: 2014-07-21 18:20:00
|
26
|
+
failed_at: 2014-07-21 18:22:00
|
27
|
+
created_at: 2014-07-21 18:20:00
|
28
|
+
updated_at: 2014-07-21 18:22:00
|
29
|
+
|
30
|
+
three:
|
31
|
+
id: 3
|
32
|
+
run_at: 2014-07-21 18:20:00
|
33
|
+
locked_at: 2014-07-21 18:21:00
|
34
|
+
locked_by: worker.0
|
35
|
+
failed_at: 2014-07-21 18:22:00
|
36
|
+
created_at: 2014-07-21 18:20:00
|
37
|
+
updated_at: 2014-07-21 18:22:00
|
38
|
+
|
39
|
+
four:
|
40
|
+
id: 4
|
41
|
+
run_at: 2014-07-21 18:20:00
|
42
|
+
locked_at: 2014-07-21 18:21:00
|
43
|
+
locked_by: worker.0
|
44
|
+
created_at: 2014-07-21 18:20:00
|
45
|
+
updated_at: 2014-07-21 18:21:00
|
@@ -14,19 +14,19 @@ one:
|
|
14
14
|
serial: ask0
|
15
15
|
replied: false
|
16
16
|
displayed: false
|
17
|
-
|
17
|
+
run: four
|
18
18
|
page_uri: ""
|
19
19
|
|
20
20
|
two:
|
21
21
|
serial: Nested_workflow:Interaction0
|
22
22
|
replied: true
|
23
23
|
displayed: true
|
24
|
-
|
24
|
+
run: three
|
25
25
|
page_uri: "http://www.example.com/interactions/1.html"
|
26
26
|
|
27
27
|
three:
|
28
28
|
serial: Nested_workflow:Interaction0
|
29
29
|
replied: false
|
30
30
|
displayed: true
|
31
|
-
|
31
|
+
run: five
|
32
32
|
page_uri: "http://www.example.com/interactions/2.html"
|
@@ -11,59 +11,54 @@
|
|
11
11
|
#------------------------------------------------------------------------------
|
12
12
|
|
13
13
|
one:
|
14
|
-
id: 1
|
15
14
|
name: Message
|
16
15
|
value: Hello, World!
|
17
16
|
port_type: TavernaPlayer::RunPort::Output
|
18
|
-
|
17
|
+
run: one
|
19
18
|
depth: 0
|
20
19
|
metadata: "---\n:size: 13\n:type: text/plain"
|
21
20
|
|
22
21
|
two:
|
23
|
-
id: 2
|
24
22
|
name: OUT
|
25
23
|
port_type: TavernaPlayer::RunPort::Output
|
26
|
-
|
24
|
+
run: two
|
27
25
|
depth: 1
|
28
26
|
metadata: "---\n:size:\n- 7\n- 7\n- 974\n- 974\n- 7\n:type:\n- text/plain\n- text/plain\n- application/x-error\n- application/x-error\n- text/plain"
|
29
27
|
|
30
28
|
three:
|
31
|
-
id: 3
|
32
29
|
name: IN_Value
|
33
30
|
value: Rob
|
34
31
|
port_type: TavernaPlayer::RunPort::Input
|
35
|
-
|
32
|
+
run: three
|
36
33
|
depth: 0
|
37
34
|
metadata: "---\n:size: 3\n:type: text/plain"
|
38
35
|
|
39
36
|
four:
|
40
|
-
id: 4
|
41
37
|
name: OUT
|
42
38
|
value: Rob
|
43
39
|
port_type: TavernaPlayer::RunPort::Output
|
44
|
-
|
40
|
+
run: three
|
45
41
|
depth: 0
|
46
42
|
metadata: "---\n:size: 3\n:type: text/plain"
|
47
43
|
|
48
44
|
five:
|
49
|
-
id: 5
|
50
45
|
name: Long_N_unnecessary_Name_OUT
|
51
46
|
value: (http://example.com/path?query=1)
|
52
47
|
port_type: TavernaPlayer::RunPort::Output
|
53
|
-
|
48
|
+
run: four
|
54
49
|
depth: 0
|
55
50
|
metadata: "---\n:size: 33\n:type: text/plain"
|
56
51
|
|
57
52
|
six:
|
58
53
|
name: Output
|
59
54
|
port_type: TavernaPlayer::RunPort::Output
|
60
|
-
|
55
|
+
run: two
|
61
56
|
depth: 2
|
62
57
|
metadata: "---\n:size:\n- - 15\n - 20\n- - 17\n - 22\n- - 19\n - 24\n:type:\n- - text/plain\n - text/plain\n- - text/plain\n - text/plain\n- - text/plain\n - text/plain\n"
|
63
58
|
|
64
59
|
seven:
|
65
60
|
name: OUT_Error
|
66
61
|
port_type: TavernaPlayer::RunPort::Output
|
67
|
-
|
62
|
+
run: two
|
68
63
|
depth: 0
|
69
64
|
metadata: "---\n:size: 718\n:type: application/x-error"
|
@@ -11,64 +11,94 @@
|
|
11
11
|
#------------------------------------------------------------------------------
|
12
12
|
|
13
13
|
one:
|
14
|
-
id: 1
|
15
14
|
run_id: 9dcfbaf1-4c55-40f0-9853-baa7f8410879
|
16
15
|
name: Test run 1
|
17
16
|
saved_state: pending
|
18
17
|
create_time: 2013-03-13 10:55:46
|
19
18
|
start_time: 2013-03-13 10:56:00
|
20
19
|
finish_time: 2013-03-13 10:56:32
|
21
|
-
|
20
|
+
workflow: one
|
22
21
|
|
23
22
|
two:
|
24
|
-
id: 2
|
25
23
|
run_id: 13246c77-ffa3-449f-9b18-0f085717f8eb
|
26
24
|
name: Test run 2
|
27
25
|
saved_state: running
|
28
26
|
create_time: 2013-03-13 10:55:46
|
29
27
|
start_time: 2013-03-13 10:55:55
|
30
28
|
finish_time: 2013-03-13 10:57:07
|
31
|
-
|
29
|
+
workflow: two
|
32
30
|
|
33
31
|
three:
|
34
|
-
id: 3
|
35
32
|
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
36
33
|
name: Test run 3
|
37
34
|
saved_state: finished
|
38
35
|
create_time: 2013-03-13 10:55:46
|
39
36
|
start_time: 2013-03-13 10:55:48
|
40
37
|
finish_time: 2013-03-13 10:58:22
|
41
|
-
|
38
|
+
workflow: three
|
42
39
|
embedded: true
|
43
40
|
|
44
41
|
four:
|
45
|
-
id: 4
|
46
42
|
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
47
43
|
name: Test run 4
|
48
44
|
saved_state: running
|
49
45
|
create_time: 2013-03-13 10:55:46
|
50
46
|
start_time: 2013-03-13 10:55:48
|
51
|
-
|
47
|
+
workflow: one
|
52
48
|
|
53
49
|
five:
|
54
|
-
id: 5
|
55
50
|
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
56
51
|
name: Test run 5
|
57
52
|
saved_state: running
|
58
53
|
create_time: 2013-03-13 10:55:46
|
59
54
|
start_time: 2013-03-13 10:55:48
|
60
|
-
|
55
|
+
workflow: one
|
61
56
|
|
62
57
|
six:
|
63
|
-
id: 6
|
64
58
|
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
65
59
|
name: Test run 6
|
66
60
|
saved_state: failed
|
67
61
|
create_time: 2013-03-13 10:55:46
|
68
62
|
start_time: 2013-03-13 10:55:48
|
69
|
-
|
63
|
+
workflow: one
|
70
64
|
|
71
65
|
seven:
|
72
66
|
name: Test run 7
|
73
67
|
saved_state: pending
|
74
|
-
|
68
|
+
workflow: one
|
69
|
+
|
70
|
+
eight:
|
71
|
+
name: Test run 8
|
72
|
+
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
73
|
+
saved_state: initialized
|
74
|
+
create_time: 2013-03-13 10:55:46
|
75
|
+
start_time: 2013-03-13 10:55:48
|
76
|
+
workflow: one
|
77
|
+
delayed_job_id: 1
|
78
|
+
|
79
|
+
nine:
|
80
|
+
name: Test run 9
|
81
|
+
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
82
|
+
saved_state: pending
|
83
|
+
create_time: 2013-03-13 10:55:46
|
84
|
+
start_time: 2013-03-13 10:55:48
|
85
|
+
workflow: one
|
86
|
+
delayed_job_id: 2
|
87
|
+
|
88
|
+
ten:
|
89
|
+
name: Test run 10
|
90
|
+
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
91
|
+
saved_state: running
|
92
|
+
create_time: 2013-03-13 10:55:46
|
93
|
+
start_time: 2013-03-13 10:55:48
|
94
|
+
workflow: one
|
95
|
+
delayed_job_id: 3
|
96
|
+
|
97
|
+
eleven:
|
98
|
+
name: Test run 11
|
99
|
+
run_id: f8250afc-09c1-4129-ab28-e889a284594f
|
100
|
+
saved_state: running
|
101
|
+
create_time: 2013-03-13 10:55:46
|
102
|
+
start_time: 2013-03-13 10:55:48
|
103
|
+
workflow: one
|
104
|
+
delayed_job_id: 4
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#------------------------------------------------------------------------------
|
2
|
-
# Copyright (c) 2013 The University of Manchester, UK.
|
2
|
+
# Copyright (c) 2013, 2014 The University of Manchester, UK.
|
3
3
|
#
|
4
4
|
# BSD Licenced. See LICENCE.rdoc for details.
|
5
5
|
#
|
@@ -11,21 +11,18 @@
|
|
11
11
|
#------------------------------------------------------------------------------
|
12
12
|
|
13
13
|
one:
|
14
|
-
id: 1
|
15
14
|
title: Hello, World!
|
16
15
|
author: Robert Haines
|
17
16
|
description: Say "Hello, World!"
|
18
17
|
file: test/workflows/hello.t2flow
|
19
18
|
|
20
19
|
two:
|
21
|
-
id: 2
|
22
20
|
title: List of Fail
|
23
21
|
author: Robert Haines
|
24
22
|
description: Produce a list littered with errors
|
25
23
|
file: test/workflows/list_with_errors.t2flow
|
26
24
|
|
27
25
|
three:
|
28
|
-
id: 3
|
29
26
|
title: Pass Through
|
30
27
|
author: Robert Haines
|
31
28
|
description: Pass the input straight through to the output
|
data/test/fixtures/users.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#------------------------------------------------------------------------------
|
2
|
-
# Copyright (c) 2013 The University of Manchester, UK.
|
2
|
+
# Copyright (c) 2013, 2014 The University of Manchester, UK.
|
3
3
|
#
|
4
4
|
# BSD Licenced. See LICENCE.rdoc for details.
|
5
5
|
#
|
@@ -10,7 +10,6 @@
|
|
10
10
|
# Author: Robert Haines
|
11
11
|
#------------------------------------------------------------------------------
|
12
12
|
|
13
|
-
|
14
|
-
id: 1
|
13
|
+
test_user:
|
15
14
|
name: Rob
|
16
15
|
email: rob@example.com
|
@@ -20,8 +20,11 @@ module TavernaPlayer
|
|
20
20
|
@run3 = taverna_player_runs(:three)
|
21
21
|
@run4 = taverna_player_runs(:four)
|
22
22
|
@run5 = taverna_player_runs(:five)
|
23
|
+
@run8 = taverna_player_runs(:eight)
|
24
|
+
@run9 = taverna_player_runs(:nine)
|
23
25
|
@int = taverna_player_interactions(:one)
|
24
|
-
@
|
26
|
+
@workflow1 = taverna_player_workflows(:one)
|
27
|
+
@workflow3 = taverna_player_workflows(:three)
|
25
28
|
@routes = TavernaPlayer::Engine.routes
|
26
29
|
end
|
27
30
|
|
@@ -40,25 +43,25 @@ module TavernaPlayer
|
|
40
43
|
test "should route to a run output" do
|
41
44
|
assert_routing @run2.outputs[0].path,
|
42
45
|
{ :controller => "taverna_player/runs", :action => "output",
|
43
|
-
:id => "
|
46
|
+
:id => "#{@run2.id}", :port => "OUT" }, {}, {}, "Did not route correctly"
|
44
47
|
end
|
45
48
|
|
46
49
|
test "should route to a deep run output" do
|
47
50
|
assert_routing @run2.outputs[0].path(0, 0),
|
48
51
|
{ :controller => "taverna_player/runs", :action => "output",
|
49
|
-
:id => "
|
52
|
+
:id => "#{@run2.id}", :port => "OUT", :path => "0/0" }, {}, {},
|
50
53
|
"Did not route correctly"
|
51
54
|
|
52
55
|
assert_routing @run2.outputs[0].path([1, 2]),
|
53
56
|
{ :controller => "taverna_player/runs", :action => "output",
|
54
|
-
:id => "
|
57
|
+
:id => "#{@run2.id}", :port => "OUT", :path => "1/2" }, {}, {},
|
55
58
|
"Did not route correctly"
|
56
59
|
end
|
57
60
|
|
58
61
|
test "should route to a run input" do
|
59
62
|
assert_routing @run3.inputs[0].path,
|
60
63
|
{ :controller => "taverna_player/runs", :action => "input",
|
61
|
-
:id => "
|
64
|
+
:id => "#{@run3.id}", :port => "IN_Value" }, {}, {}, "Did not route correctly"
|
62
65
|
end
|
63
66
|
|
64
67
|
test "should route to cancel on a run" do
|
@@ -115,14 +118,14 @@ module TavernaPlayer
|
|
115
118
|
end
|
116
119
|
|
117
120
|
test "should get new and not be overridden" do
|
118
|
-
get :new, :workflow_id =>
|
121
|
+
get :new, :workflow_id => @workflow1, :use_route => :taverna_player
|
119
122
|
assert_response :success, "Response was not success"
|
120
123
|
refute assigns(:override)
|
121
124
|
assert_template "application", "Did not render with the correct layout"
|
122
125
|
end
|
123
126
|
|
124
127
|
test "should get new embedded" do
|
125
|
-
get :new, :workflow_id =>
|
128
|
+
get :new, :workflow_id => @workflow1, :embedded => "true",
|
126
129
|
:use_route => :taverna_player
|
127
130
|
assert_response :success, "Response was not success"
|
128
131
|
assert_template "taverna_player/embedded",
|
@@ -163,7 +166,7 @@ module TavernaPlayer
|
|
163
166
|
|
164
167
|
test "should fail to create run via browser" do
|
165
168
|
assert_no_difference("Run.count") do
|
166
|
-
post :create, :run => { :workflow_id => @
|
169
|
+
post :create, :run => { :workflow_id => @workflow1.id, :name => nil }
|
167
170
|
end
|
168
171
|
|
169
172
|
assert_equal "Run was not successfully created.", flash[:alert],
|
@@ -172,7 +175,7 @@ module TavernaPlayer
|
|
172
175
|
|
173
176
|
test "should create run via browser" do
|
174
177
|
assert_difference("Run.count") do
|
175
|
-
post :create, :run => { :workflow_id => @
|
178
|
+
post :create, :run => { :workflow_id => @workflow1.id }
|
176
179
|
end
|
177
180
|
|
178
181
|
assert_redirected_to run_path(assigns(:run)),
|
@@ -186,7 +189,7 @@ module TavernaPlayer
|
|
186
189
|
test "should create inputs along with run" do
|
187
190
|
assert_difference("Run.count") do
|
188
191
|
assert_difference("RunPort.count") do
|
189
|
-
post :create, :run => { :workflow_id =>
|
192
|
+
post :create, :run => { :workflow_id => @workflow3.id,
|
190
193
|
:inputs_attributes => [{:value => 'test', :name => 'IN'}]
|
191
194
|
}
|
192
195
|
end
|
@@ -206,7 +209,7 @@ module TavernaPlayer
|
|
206
209
|
test "should create embedded run via browser" do
|
207
210
|
assert_difference("Run.count") do
|
208
211
|
post :create,
|
209
|
-
:run => { :workflow_id => @
|
212
|
+
:run => { :workflow_id => @workflow1.id, :embedded => "true" }
|
210
213
|
end
|
211
214
|
|
212
215
|
assert_redirected_to run_path(assigns(:run)),
|
@@ -220,7 +223,7 @@ module TavernaPlayer
|
|
220
223
|
|
221
224
|
test "should create run via json" do
|
222
225
|
assert_difference("Run.count") do
|
223
|
-
post :create, :run => { :workflow_id => @
|
226
|
+
post :create, :run => { :workflow_id => @workflow1.id },
|
224
227
|
:format => :json
|
225
228
|
end
|
226
229
|
|
@@ -234,7 +237,7 @@ module TavernaPlayer
|
|
234
237
|
test "should create embedded run via json" do
|
235
238
|
assert_difference("Run.count") do
|
236
239
|
post :create,
|
237
|
-
:run => { :workflow_id => @
|
240
|
+
:run => { :workflow_id => @workflow1.id, :embedded => "true" },
|
238
241
|
:format => :json
|
239
242
|
end
|
240
243
|
|
@@ -270,6 +273,30 @@ module TavernaPlayer
|
|
270
273
|
assert_response :forbidden, "Response was not forbidden"
|
271
274
|
end
|
272
275
|
|
276
|
+
test "should not destroy running run with running delayed job" do
|
277
|
+
@request.env["HTTP_REFERER"] = "/runs"
|
278
|
+
assert_no_difference(["Run.count", "Delayed::Job.count"],
|
279
|
+
"Run and Delayed::Job count changed") do
|
280
|
+
delete :destroy, :id => @run8, :use_route => :taverna_player
|
281
|
+
end
|
282
|
+
|
283
|
+
assert_equal "Run must be cancelled before deletion.", flash[:alert],
|
284
|
+
"Incorrect or missing flash notice"
|
285
|
+
assert_response :redirect, "Response was not a redirect"
|
286
|
+
assert_redirected_to runs_path, "Did not redirect correctly"
|
287
|
+
end
|
288
|
+
|
289
|
+
test "should destroy running run with failed delayed job" do
|
290
|
+
@request.env["HTTP_REFERER"] = "/runs"
|
291
|
+
assert_difference(["Run.count", "Delayed::Job.count"], -1,
|
292
|
+
"Run and Delayed::Job count did not reduce") do
|
293
|
+
delete :destroy, :id => @run9, :use_route => :taverna_player
|
294
|
+
end
|
295
|
+
|
296
|
+
assert_response :redirect, "Response was not a redirect"
|
297
|
+
assert_redirected_to runs_path, "Did not redirect correctly"
|
298
|
+
end
|
299
|
+
|
273
300
|
test "should cancel run and redirect to index via browser" do
|
274
301
|
@request.env["HTTP_REFERER"] = "/runs"
|
275
302
|
put :cancel, :id => @run1, :use_route => :taverna_player
|
@@ -279,7 +306,7 @@ module TavernaPlayer
|
|
279
306
|
end
|
280
307
|
|
281
308
|
test "should cancel run and redirect to show via browser" do
|
282
|
-
@request.env["HTTP_REFERER"] = "/runs
|
309
|
+
@request.env["HTTP_REFERER"] = "/runs/#{@run1.id}"
|
283
310
|
put :cancel, :id => @run1, :use_route => :taverna_player
|
284
311
|
|
285
312
|
assert_response :redirect, "Response was not a redirect"
|
@@ -304,7 +331,7 @@ module TavernaPlayer
|
|
304
331
|
end
|
305
332
|
|
306
333
|
test "should only return runs from workflow id 1" do
|
307
|
-
get :index, :workflow_id => @
|
334
|
+
get :index, :workflow_id => @workflow1
|
308
335
|
assert_response :success, "Response was not success"
|
309
336
|
assert_not_nil assigns(:runs), "Did not assign a valid runs instance"
|
310
337
|
assert_not_nil assigns(:override)
|