qa_server 0.1.99 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/indexing_bug.md +11 -0
- data/.github/ISSUE_TEMPLATE/new_dataset_request.md +22 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +18 -0
- data/.rubocop_fixme.yml +10 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +21 -15
- data/README.md +4 -0
- data/Rakefile +2 -1
- data/app/assets/stylesheets/qa_server/_home-page.scss +2 -2
- data/app/assets/stylesheets/qa_server/_styles.scss +4 -0
- data/app/controllers/qa_server/authority_list_controller.rb +3 -3
- data/app/controllers/qa_server/authority_validation_controller.rb +11 -12
- data/app/controllers/qa_server/check_status_controller.rb +6 -6
- data/app/controllers/qa_server/homepage_controller.rb +2 -2
- data/app/controllers/qa_server/monitor_status_controller.rb +32 -48
- data/app/controllers/qa_server/usage_controller.rb +2 -2
- data/app/loggers/qa_server/scenario_logger.rb +38 -42
- data/app/models/qa_server/authority_scenario.rb +1 -1
- data/app/models/qa_server/authority_status.rb +1 -0
- data/app/models/qa_server/authority_status_failure.rb +1 -0
- data/app/models/qa_server/scenario_run_history.rb +189 -0
- data/app/models/qa_server/scenario_run_registry.rb +34 -0
- data/app/models/qa_server/scenario_run_summary.rb +44 -0
- data/app/models/qa_server/scenarios.rb +15 -17
- data/app/models/qa_server/search_scenario.rb +4 -4
- data/app/models/qa_server/term_scenario.rb +2 -1
- data/app/presenters/qa_server/authority_list_presenter.rb +7 -6
- data/app/presenters/qa_server/check_status_presenter.rb +26 -16
- data/app/presenters/qa_server/monitor_status_presenter.rb +94 -38
- data/app/services/qa_server/authority_lister_service.rb +9 -9
- data/app/services/qa_server/authority_loader_service.rb +16 -15
- data/app/services/qa_server/authority_validator_service.rb +13 -13
- data/app/services/qa_server/database_migrator.rb +1 -0
- data/app/services/qa_server/scenarios_loader_service.rb +29 -27
- data/app/validators/qa_server/scenario_validator.rb +25 -35
- data/app/validators/qa_server/search_scenario_validator.rb +25 -18
- data/app/validators/qa_server/term_scenario_validator.rb +2 -1
- data/app/views/qa_server/check_status/index.html.erb +1 -1
- data/app/views/qa_server/homepage/index.html.erb +3 -3
- data/app/views/qa_server/monitor_status/index.html.erb +15 -10
- data/app/views/qa_server/usage/index.html.erb +4 -4
- data/app/views/shared/_footer.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/lib/generators/qa_server/assets_generator.rb +1 -0
- data/lib/generators/qa_server/config_generator.rb +6 -0
- data/lib/generators/qa_server/install_generator.rb +1 -0
- data/lib/generators/qa_server/models_generator.rb +1 -0
- data/lib/generators/qa_server/templates/config/initializers/qa_server.rb +4 -0
- data/lib/generators/qa_server/templates/config/locales/qa_server.en.yml +1 -1
- data/lib/generators/qa_server/templates/db/migrate/20180807045549_create_scenario_run_registry.rb.erb +7 -0
- data/lib/generators/qa_server/templates/db/migrate/20180807045552_create_scenario_run_history.rb.erb +16 -0
- data/lib/generators/qa_server/templates/db/migrate/20180807045554_drop_unused_tables.rb.erb +6 -0
- data/lib/generators/qa_server/templates/db/migrate/20180809045552_add_indices_to_scenario_run_history.rb.erb +8 -0
- data/lib/qa_server/configuration.rb +6 -0
- data/lib/qa_server/engine.rb +10 -1
- data/lib/qa_server/version.rb +2 -1
- data/lib/qa_server.rb +19 -1
- data/lib/tasks/install.rake +1 -0
- data/lib/tasks/qa_server_tasks.rake +1 -0
- data/qa_server.gemspec +8 -5
- data/spec/rails_helper.rb +1 -0
- data/spec/spec_helper.rb +98 -98
- data/spec/test_app_templates/Gemfile.extra +2 -1
- data/tasks/qa_server_dev.rake +1 -0
- metadata +49 -7
@@ -0,0 +1,189 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Provide access to the scenario_results_history database table which tracks specific scenario runs over time.
|
3
|
+
module QaServer
|
4
|
+
class ScenarioRunHistory < ActiveRecord::Base
|
5
|
+
self.table_name = 'scenario_run_history'
|
6
|
+
belongs_to :scenario_run_registry
|
7
|
+
enum scenario_type: [:connection, :accuracy, :performance], _suffix: :type
|
8
|
+
enum status: [:good, :bad, :unknown], _suffix: true
|
9
|
+
|
10
|
+
GOOD_MARKER = '√'
|
11
|
+
BAD_MARKER = 'X'
|
12
|
+
UNKNOWN_MARKER = '?'
|
13
|
+
|
14
|
+
class_attribute :summary_class
|
15
|
+
|
16
|
+
self.summary_class = QaServer::ScenarioRunSummary
|
17
|
+
|
18
|
+
# Save a scenario result
|
19
|
+
# @param run_id [Integer] the run on which to gather statistics
|
20
|
+
# @param result [Hash] the scenario result to be saved
|
21
|
+
def self.save_result(run_id:, scenario_result:)
|
22
|
+
QaServer::ScenarioRunHistory.create(scenario_run_registry_id: run_id,
|
23
|
+
status: scenario_result[:status],
|
24
|
+
authority_name: scenario_result[:authority_name],
|
25
|
+
subauthority_name: scenario_result[:subauthority_name],
|
26
|
+
service: scenario_result[:service],
|
27
|
+
action: scenario_result[:action],
|
28
|
+
url: scenario_result[:url],
|
29
|
+
err_message: scenario_result[:err_message],
|
30
|
+
run_time: scenario_result[:run_time])
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get a summary of passing/failing tests for a run.
|
34
|
+
# @param scenario_run [ScenarioRunRegistry] the run on which to gather statistics
|
35
|
+
# @returns [Hash] statistics on the requested run
|
36
|
+
# @example
|
37
|
+
# { run_id: 14,
|
38
|
+
# failing_count: 3,
|
39
|
+
# passing_count: 156,
|
40
|
+
# total_count: 159,
|
41
|
+
# authority_count: 22,
|
42
|
+
# failing_authority_count: 1 }
|
43
|
+
def self.run_summary(scenario_run:)
|
44
|
+
return nil unless scenario_run&.id
|
45
|
+
status = status_counts_in_run(run_id: scenario_run.id)
|
46
|
+
summary_class.new(run_id: scenario_run.id,
|
47
|
+
run_dt_stamp: scenario_run.dt_stamp,
|
48
|
+
authority_count: authorities_in_run(run_id: scenario_run.id).count,
|
49
|
+
failing_authority_count: authorities_with_failures_in_run(run_id: scenario_run.id).count,
|
50
|
+
passing_scenario_count: status['good'],
|
51
|
+
failing_scenario_count: status['bad'] + status['unknown'])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Get set of all scenario results for a run.
|
55
|
+
# @param run_id [Integer] the run on which to gather statistics
|
56
|
+
# @param authority_name [String] limit results to those for the authority with this name
|
57
|
+
# @param status [Array<Symbol> | Symbol] :good, :bad, :unknown, or any of these in an array to select multiple status
|
58
|
+
# @param url [String] limit results to a specific scenario URL
|
59
|
+
# @returns [Array<ScenarioRunHistory>] scenario details for all scenarios in the run
|
60
|
+
# @example
|
61
|
+
# [ { status: :bad,
|
62
|
+
# authority_name: "geonames_ld4l_cache",
|
63
|
+
# subauthority_name: "area",
|
64
|
+
# service: "ld4l_cache",
|
65
|
+
# action: "search",
|
66
|
+
# url: "/qa/search/linked_data/geonames_ld4l_cache/area?q=France&maxRecords=4",
|
67
|
+
# err_message: "Unable to connect to authority",
|
68
|
+
# scenario_type: :connection
|
69
|
+
# run_time: 11.2 },
|
70
|
+
# { status: :good,
|
71
|
+
# authority_name: "oclcfast_ld4l_cache",
|
72
|
+
# subauthority_name: "Organization",
|
73
|
+
# service: "ld4l_cache",
|
74
|
+
# action: "search",
|
75
|
+
# url: "/qa/search/linked_data/oclcfast_ld4l_cache/organization?q=mark twain&maxRecords=4",
|
76
|
+
# err_message: "",
|
77
|
+
# scenario_type: :connection
|
78
|
+
# run_time: 0.131 },
|
79
|
+
# { status: :unknown,
|
80
|
+
# authority_name: "oclcfast_ld4l_cache",
|
81
|
+
# subauthority_name: "Person",
|
82
|
+
# service: "ld4l_cache",
|
83
|
+
# action: "search",
|
84
|
+
# url: "/qa/search/linked_data/oclcfast_ld4l_cache/person?q=mark twain&maxRecords=4",
|
85
|
+
# err_message: "Not enough search results returned",
|
86
|
+
# scenario_type: :connection
|
87
|
+
# run_time: 0.123 } ]
|
88
|
+
def self.run_results(run_id:, authority_name: nil, status: nil, url: nil)
|
89
|
+
return [] unless run_id
|
90
|
+
where = {}
|
91
|
+
where[:scenario_run_registry_id] = run_id
|
92
|
+
where[:authority_name] = authority_name if authority_name.present?
|
93
|
+
where[:status] = status if status.present?
|
94
|
+
where[:url] = url if url.present?
|
95
|
+
QaServer::ScenarioRunHistory.where(where).to_a
|
96
|
+
end
|
97
|
+
|
98
|
+
# Get set of failures for a run, if any.
|
99
|
+
# @param run_id [Integer] the run on which to gather statistics
|
100
|
+
# @returns [Array<Hash>] scenario details for any failing scenarios in the run
|
101
|
+
# @example
|
102
|
+
# [ { status: :bad,
|
103
|
+
# authority_name: "geonames_ld4l_cache",
|
104
|
+
# subauthority_name: "area",
|
105
|
+
# service: "ld4l_cache",
|
106
|
+
# action: "search",
|
107
|
+
# url: "/qa/search/linked_data/geonames_ld4l_cache/area?q=France&maxRecords=4",
|
108
|
+
# err_message: "Unable to connect to authority",
|
109
|
+
# scenario_type: :connection
|
110
|
+
# run_time: 11.2 },
|
111
|
+
# { status: :unknown,
|
112
|
+
# authority_name: "oclcfast_ld4l_cache",
|
113
|
+
# subauthority_name: "Person",
|
114
|
+
# service: "ld4l_cache",
|
115
|
+
# action: "search",
|
116
|
+
# url: "/qa/search/linked_data/oclcfast_ld4l_cache/person?q=mark twain&maxRecords=4",
|
117
|
+
# err_message: "Not enough search results returned",
|
118
|
+
# scenario_type: :connection
|
119
|
+
# run_time: 0.123 } ]
|
120
|
+
def self.run_failures(run_id:)
|
121
|
+
return [] unless run_id
|
122
|
+
QaServer::ScenarioRunHistory.where(scenario_run_registry_id: run_id).where.not(status: :good).to_a
|
123
|
+
end
|
124
|
+
|
125
|
+
# Get a summary level of historical data
|
126
|
+
# @returns [Array<Hash>] scenario details for any failing scenarios in the run (auth_name, failing, passing)
|
127
|
+
# @example
|
128
|
+
# [ [ 'agrovoc', 0, 24 ],
|
129
|
+
# [ 'geonames_ld4l_cache', 2, 22 ] ... ]
|
130
|
+
def self.historical_summary
|
131
|
+
runs = all_runs_per_authority
|
132
|
+
failures = failing_runs_per_authority
|
133
|
+
return [] unless runs.present?
|
134
|
+
data = []
|
135
|
+
runs.each do |auth_name, run_count|
|
136
|
+
auth_data = []
|
137
|
+
auth_data[0] = auth_name
|
138
|
+
failure_count = (failures.key? auth_name) ? failures[auth_name] : 0 # rubocop:disable Style/TernaryParentheses
|
139
|
+
auth_data[1] = failure_count
|
140
|
+
auth_data[2] = run_count - failure_count # passing
|
141
|
+
data << auth_data
|
142
|
+
end
|
143
|
+
data
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.authorities_in_run(run_id:)
|
147
|
+
QaServer::ScenarioRunHistory.where(scenario_run_registry_id: run_id).pluck(:authority_name).uniq
|
148
|
+
end
|
149
|
+
private_class_method :authorities_in_run
|
150
|
+
|
151
|
+
def self.authorities_with_failures_in_run(run_id:)
|
152
|
+
QaServer::ScenarioRunHistory.where(scenario_run_registry_id: run_id).where.not(status: 'good').pluck('authority_name').uniq
|
153
|
+
end
|
154
|
+
private_class_method :authorities_with_failures_in_run
|
155
|
+
|
156
|
+
def self.status_counts_in_run(run_id:)
|
157
|
+
status = QaServer::ScenarioRunHistory.group('status').where(scenario_run_registry_id: run_id).count
|
158
|
+
status["good"] = 0 unless status.key? "good"
|
159
|
+
status["bad"] = 0 unless status.key? "bad"
|
160
|
+
status["unknown"] = 0 unless status.key? "unknown"
|
161
|
+
status
|
162
|
+
end
|
163
|
+
private_class_method :status_counts_in_run
|
164
|
+
|
165
|
+
def self.all_runs_per_authority
|
166
|
+
# TODO: Really want to only get one run per day. Preferably the first run of the day.
|
167
|
+
authority_runs = QaServer::ScenarioRunHistory.pluck(:authority_name, :scenario_run_registry_id).uniq # rubocop:disable Rails/UniqBeforePluck
|
168
|
+
runs_per_authority(authority_runs)
|
169
|
+
end
|
170
|
+
private_class_method :all_runs_per_authority
|
171
|
+
|
172
|
+
def self.failing_runs_per_authority
|
173
|
+
failing_authority_runs = QaServer::ScenarioRunHistory.where.not(status: 'good').pluck(:authority_name, :scenario_run_registry_id).uniq
|
174
|
+
runs_per_authority(failing_authority_runs)
|
175
|
+
end
|
176
|
+
private_class_method :failing_runs_per_authority
|
177
|
+
|
178
|
+
def self.runs_per_authority(authority_runs)
|
179
|
+
runs_per_authority = {}
|
180
|
+
authority_runs.each do |auth_run|
|
181
|
+
auth_name = auth_run[0]
|
182
|
+
runs_per_authority[auth_name] = 0 unless runs_per_authority.key? auth_name
|
183
|
+
runs_per_authority[auth_name] += 1
|
184
|
+
end
|
185
|
+
runs_per_authority
|
186
|
+
end
|
187
|
+
private_class_method :runs_per_authority
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Provide access to the scenario_run_registry database table which registers each run of tests made over time.
|
3
|
+
module QaServer
|
4
|
+
class ScenarioRunRegistry < ActiveRecord::Base
|
5
|
+
self.table_name = 'scenario_run_registry'
|
6
|
+
has_many :scenario_run_history, foreign_key: :scenario_run_registry_id
|
7
|
+
|
8
|
+
# Get the latest saved run of scenarios.
|
9
|
+
def self.latest_run
|
10
|
+
return nil unless QaServer::ScenarioRunRegistry.last
|
11
|
+
QaServer::ScenarioRunRegistry.last # Can we count on last to always be the one with the latest dt_stamp?
|
12
|
+
# latest_run = ScenarioRunRegistry.all.sort(:dt_stamp).last
|
13
|
+
# return nil if latest_run.blank?
|
14
|
+
# latest_run.id
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get the latest saved status.
|
18
|
+
def self.latest_run_id
|
19
|
+
latest = latest_run
|
20
|
+
return nil unless latest
|
21
|
+
lastest.id
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.save_run(scenarios_results:)
|
25
|
+
run = QaServer::ScenarioRunRegistry.create(dt_stamp: dt_stamp_now_et)
|
26
|
+
scenarios_results.each { |result| QaServer::ScenarioRunHistory.save_result(run_id: run.id, scenario_result: result) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.dt_stamp_now_et
|
30
|
+
Time.now.in_time_zone("Eastern Time (US & Canada)")
|
31
|
+
end
|
32
|
+
private_class_method :dt_stamp_now_et
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Abstract class that parses the authority configuration from the yml file into the parts needed by inheriting scenario types.
|
3
|
+
module QaServer
|
4
|
+
class ScenarioRunSummary
|
5
|
+
# @return [Integer] the id of the scenario run being summarized
|
6
|
+
attr_reader :run_id
|
7
|
+
|
8
|
+
# @return [Date] the date time stamp of the scenario run being summarized
|
9
|
+
attr_reader :run_dt_stamp
|
10
|
+
|
11
|
+
# @return [Integer] number of all authorities in the run
|
12
|
+
attr_reader :authority_count
|
13
|
+
|
14
|
+
# @return [Integer] number of authorities in the run that had at least one failing test
|
15
|
+
attr_reader :failing_authority_count
|
16
|
+
|
17
|
+
# @return [Integer] number of scenarios that passed during this run
|
18
|
+
attr_reader :passing_scenario_count
|
19
|
+
|
20
|
+
# @return [Integer] name of the subauthority the scenario runs against
|
21
|
+
attr_reader :failing_scenario_count
|
22
|
+
|
23
|
+
# @return [Integer] total number of scenarios in this run
|
24
|
+
attr_reader :total_scenario_count
|
25
|
+
|
26
|
+
# @param run_id [Integer] the id of the scenario run being summarized
|
27
|
+
# @param run_dt_stamp [Date] the date time stamp of the scenario run being summarized
|
28
|
+
# @param authority_count [Integer] number of all authorities in the run
|
29
|
+
# @param failing_authority_count [Integer] number of authorities in the run that had failing tests
|
30
|
+
# @param passing_scenario_count [Integer] number of scenarios that passed during this run
|
31
|
+
# @param failing_scenario_count [Integer] number of scenarios that failed during this run
|
32
|
+
# rubocop:disable Metrics/ParameterLists
|
33
|
+
def initialize(run_id:, run_dt_stamp:, authority_count:, failing_authority_count:, passing_scenario_count:, failing_scenario_count:)
|
34
|
+
@run_id = run_id
|
35
|
+
@run_dt_stamp = run_dt_stamp
|
36
|
+
@authority_count = authority_count
|
37
|
+
@failing_authority_count = failing_authority_count
|
38
|
+
@passing_scenario_count = passing_scenario_count
|
39
|
+
@failing_scenario_count = failing_scenario_count
|
40
|
+
@total_scenario_count = failing_scenario_count + passing_scenario_count
|
41
|
+
end
|
42
|
+
# rubocop:enable Metrics/ParameterLists
|
43
|
+
end
|
44
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Holds all scenarios for an authority.
|
2
3
|
module QaServer
|
3
4
|
class Scenarios
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
SEARCH_SCENARIOS = 'search'.freeze
|
5
|
+
AUTHORITY_SCENARIO = 'authority'
|
6
|
+
TERM_SCENARIOS = 'term'
|
7
|
+
SEARCH_SCENARIOS = 'search'
|
8
8
|
|
9
9
|
# @return [Qa::Authorities::LinkedData::GenericAuthority] authority instance the scenarios run against
|
10
10
|
attr_reader :authority
|
@@ -18,6 +18,9 @@ module QaServer
|
|
18
18
|
# @return [Array<SearchScenario>] the search scenarios to run against the authority
|
19
19
|
attr_reader :search_scenarios
|
20
20
|
|
21
|
+
# @return [Hash] configurations from the yml file for all scenarios for an authority
|
22
|
+
attr_reader :scenarios_config; private :scenarios_config # rubocop:disable Style/Semicolon
|
23
|
+
|
21
24
|
# @param authority [Qa::Authorities::LinkedData::GenericAuthority] the instance of the QA authority
|
22
25
|
# @param authoity_name [String] the name of the authority the scenario tests (e.g. "agrovoc_direct")
|
23
26
|
# @param scenarios_config [Hash] configurations from the yml file for all scenarios for an authority
|
@@ -34,27 +37,23 @@ module QaServer
|
|
34
37
|
def parse_term_scenarios
|
35
38
|
@term_scenarios = []
|
36
39
|
term_scenarios_config.each do |term_scenario_config|
|
37
|
-
@term_scenarios << TermScenario.new(authority: authority,
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
@term_scenarios << QaServer::TermScenario.new(authority: authority,
|
41
|
+
authority_name: authority_name,
|
42
|
+
authority_scenario_config: authority_scenario_config,
|
43
|
+
scenario_config: term_scenario_config)
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
44
47
|
def parse_search_scenarios
|
45
48
|
@search_scenarios = []
|
46
49
|
search_scenarios_config.each do |search_scenario_config|
|
47
|
-
@search_scenarios << SearchScenario.new(authority: authority,
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
@search_scenarios << QaServer::SearchScenario.new(authority: authority,
|
51
|
+
authority_name: authority_name,
|
52
|
+
authority_scenario_config: authority_scenario_config,
|
53
|
+
scenario_config: search_scenario_config)
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
54
|
-
def scenarios_config
|
55
|
-
@scenarios_config
|
56
|
-
end
|
57
|
-
|
58
57
|
def authority_scenario_config
|
59
58
|
scenarios_config[AUTHORITY_SCENARIO]
|
60
59
|
end
|
@@ -68,4 +67,3 @@ module QaServer
|
|
68
67
|
end
|
69
68
|
end
|
70
69
|
end
|
71
|
-
|
@@ -1,7 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# This class parses the search configuration from the yml file into the parts needed by the search scenario validator.
|
2
3
|
module QaServer
|
3
4
|
class SearchScenario < AuthorityScenario
|
4
|
-
|
5
5
|
# @return [String] query being executed by this scenario
|
6
6
|
attr_reader :query
|
7
7
|
|
@@ -14,8 +14,8 @@ module QaServer
|
|
14
14
|
# @return [String] subject_uri, if specified, should be in the search results between position 1 and expected_by_position
|
15
15
|
attr_reader :subject_uri
|
16
16
|
|
17
|
-
MAX_RECORDS = '4'
|
18
|
-
DEFAULT_REPLACEMENTS = { maxRecords: MAX_RECORDS }
|
17
|
+
MAX_RECORDS = '4'
|
18
|
+
DEFAULT_REPLACEMENTS = { maxRecords: MAX_RECORDS }.freeze
|
19
19
|
DEFAULT_POSITION = nil
|
20
20
|
DEFAULT_SUBJECT_URI = nil
|
21
21
|
|
@@ -37,7 +37,7 @@ module QaServer
|
|
37
37
|
# @return [String] the example URL
|
38
38
|
def url
|
39
39
|
subauth = "/#{subauthority_name}" if subauthority?
|
40
|
-
prefix = "
|
40
|
+
prefix = "#{QaServer::Engine.qa_engine_mount}/search/linked_data/#{authority_name.downcase}#{subauth}"
|
41
41
|
"#{prefix}?q=#{query}#{url_replacements}"
|
42
42
|
end
|
43
43
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'erb'
|
2
3
|
|
3
4
|
# This class parses the term configuration from the yml file into the parts needed by the term scenario validator.
|
@@ -23,7 +24,7 @@ module QaServer
|
|
23
24
|
# @return [String] the example URL
|
24
25
|
def url
|
25
26
|
subauth = "/#{subauthority_name}" if subauthority_name.present?
|
26
|
-
prefix = "
|
27
|
+
prefix = "#{QaServer::Engine.qa_engine_mount}/show/linked_data/#{authority_name.downcase}#{subauth}"
|
27
28
|
"#{prefix}/#{url_identifier}"
|
28
29
|
end
|
29
30
|
|
@@ -1,10 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# This presenter class provides all data needed by the view that show the list of authorities.
|
2
3
|
module QaServer
|
3
4
|
class AuthorityListPresenter
|
4
|
-
|
5
|
-
@urls_data = urls_data
|
6
|
-
end
|
7
|
-
|
5
|
+
# rubocop:disable Style/AsciiComments
|
8
6
|
# @return [Array<Hash>] A list of status data for each scenario tested.
|
9
7
|
# @example
|
10
8
|
# { status: :PASS,
|
@@ -15,8 +13,11 @@ module QaServer
|
|
15
13
|
# action: 'search',
|
16
14
|
# url: '/qa/search/linked_data/locnames_ld4l_cache/person?q=mark twain&maxRecords=4',
|
17
15
|
# err_message: '' }
|
18
|
-
|
19
|
-
|
16
|
+
attr_reader :urls_data
|
17
|
+
# rubocop:enable Style/AsciiComments
|
18
|
+
|
19
|
+
def initialize(urls_data:)
|
20
|
+
@urls_data = urls_data
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# This presenter class provides all data needed by the view that checks the status of authorities.
|
2
3
|
module QaServer
|
3
4
|
class CheckStatusPresenter
|
4
|
-
|
5
5
|
# @param authorities_list [Array<String>] a list of all loaded authorities' names
|
6
6
|
# @param status_data [Array<Hash>] a list of status data for each scenario tested
|
7
7
|
def initialize(authorities_list:, connection_status_data:, accuracy_status_data:)
|
@@ -12,10 +12,9 @@ module QaServer
|
|
12
12
|
|
13
13
|
# @return [Array<String>] A list of all loaded authorities' names
|
14
14
|
# @example ['AGROVOC_DIRECT', 'AGROVOC_LD4L_CACHE', 'LOCNAMES_LD4L_CACHE']
|
15
|
-
|
16
|
-
@authorities_list
|
17
|
-
end
|
15
|
+
attr_reader :authorities_list
|
18
16
|
|
17
|
+
# rubocop:disable Style/AsciiComments
|
19
18
|
# @return [Array<Hash>] A list of status data for each connection scenario tested.
|
20
19
|
# @example
|
21
20
|
# [ { status: :PASS,
|
@@ -26,10 +25,10 @@ module QaServer
|
|
26
25
|
# action: 'search',
|
27
26
|
# url: '/qa/search/linked_data/locnames_ld4l_cache/person?q=mark twain&maxRecords=4',
|
28
27
|
# err_message: '' }, ... ]
|
29
|
-
|
30
|
-
|
31
|
-
end
|
28
|
+
attr_reader :connection_status_data
|
29
|
+
# rubocop:enable Style/AsciiComments
|
32
30
|
|
31
|
+
# rubocop:disable Style/AsciiComments
|
33
32
|
# @return [Array<Hash>] A list of status data for each accuracy scenario tested.
|
34
33
|
# @example
|
35
34
|
# [ { status: :PASS,
|
@@ -42,9 +41,8 @@ module QaServer
|
|
42
41
|
# actual: 8,
|
43
42
|
# url: '/qa/search/linked_data/locnames_ld4l_cache/person?q=mark twain&maxRecords=20',
|
44
43
|
# err_message: '' }, ... ]
|
45
|
-
|
46
|
-
|
47
|
-
end
|
44
|
+
attr_reader :accuracy_status_data
|
45
|
+
# rubocop:enable Style/AsciiComments
|
48
46
|
|
49
47
|
# @return [Boolean] true if status data exists; otherwise false
|
50
48
|
def connection_status_data?
|
@@ -58,19 +56,31 @@ module QaServer
|
|
58
56
|
|
59
57
|
# @return [String] the name of the css style class to use for the status cell based on the status of the scenario test.
|
60
58
|
def status_style_class(status)
|
61
|
-
"status-#{status[:status]
|
59
|
+
"status-#{status[:status]}"
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [String] the name of the css style class to use for the status cell based on the status of the scenario test.
|
63
|
+
def status_label(status)
|
64
|
+
case status[:status]
|
65
|
+
when :good
|
66
|
+
QaServer::ScenarioRunHistory::GOOD_MARKER
|
67
|
+
when :bad
|
68
|
+
QaServer::ScenarioRunHistory::BAD_MARKER
|
69
|
+
when :unknown
|
70
|
+
QaServer::ScenarioRunHistory::UNKNOWN_MARKER
|
71
|
+
end
|
62
72
|
end
|
63
73
|
|
64
74
|
def value_all_collections
|
65
|
-
CheckStatusController::ALL_AUTHORITIES
|
75
|
+
QaServer::CheckStatusController::ALL_AUTHORITIES
|
66
76
|
end
|
67
77
|
|
68
78
|
def value_check_param
|
69
|
-
AuthorityValidationController::VALIDATION_TYPE_PARAM
|
79
|
+
QaServer::AuthorityValidationController::VALIDATION_TYPE_PARAM
|
70
80
|
end
|
71
81
|
|
72
82
|
def value_check_connections
|
73
|
-
AuthorityValidationController::VALIDATE_CONNECTIONS
|
83
|
+
QaServer::AuthorityValidationController::VALIDATE_CONNECTIONS
|
74
84
|
end
|
75
85
|
|
76
86
|
def label_check_connections
|
@@ -78,7 +88,7 @@ module QaServer
|
|
78
88
|
end
|
79
89
|
|
80
90
|
def value_check_accuracy
|
81
|
-
AuthorityValidationController::VALIDATE_ACCURACY
|
91
|
+
QaServer::AuthorityValidationController::VALIDATE_ACCURACY
|
82
92
|
end
|
83
93
|
|
84
94
|
def label_check_accuracy
|
@@ -86,7 +96,7 @@ module QaServer
|
|
86
96
|
end
|
87
97
|
|
88
98
|
def value_all_checks
|
89
|
-
AuthorityValidationController::ALL_VALIDATIONS
|
99
|
+
QaServer::AuthorityValidationController::ALL_VALIDATIONS
|
90
100
|
end
|
91
101
|
|
92
102
|
def label_all_checks
|