Commit 9cbf9d3730e0b35b9aa6b16aeb25bc726ca667ca
1 parent
b67cf9df
Exists in
master
and in
28 other branches
[Mezuro] Fixing Fixtures: attributes should all be strings as received from savon.
Showing
23 changed files
with
67 additions
and
60 deletions
Show diff stats
plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb
... | ... | @@ -26,6 +26,7 @@ class Kalibro::MetricConfigurationSnapshot < Kalibro::Model |
26 | 26 | |
27 | 27 | def to_hash |
28 | 28 | hash = super |
29 | + puts hash | |
29 | 30 | hash[:attributes!][:range] = {'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', |
30 | 31 | 'xsi:type' => 'kalibro:rangeSnapshotXml' } |
31 | 32 | hash | ... | ... |
plugins/mezuro/lib/kalibro/model.rb
... | ... | @@ -15,7 +15,7 @@ class Kalibro::Model |
15 | 15 | if(!excepts.include?(field)) |
16 | 16 | field_value = send(field) |
17 | 17 | if !field_value.nil? |
18 | - hash[field] = convert_to_hash(field_value) | |
18 | + hash[field] = convert_to_hash(field_value) | |
19 | 19 | if field_value.is_a?(Kalibro::Model) |
20 | 20 | hash = {:attributes! => {}}.merge(hash) |
21 | 21 | hash[:attributes!][field.to_sym] = { |
... | ... | @@ -91,7 +91,7 @@ class Kalibro::Model |
91 | 91 | return self.class.date_with_milliseconds(value) if value.is_a?(DateTime) |
92 | 92 | return 'INF' if value.is_a?(Float) and value.infinite? == 1 |
93 | 93 | return '-INF' if value.is_a?(Float) and value.infinite? == -1 |
94 | - value | |
94 | + value.to_s | |
95 | 95 | end |
96 | 96 | |
97 | 97 | def xml_instance_class_name(object) | ... | ... |
plugins/mezuro/lib/kalibro/process_time.rb
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
... | ... | @@ -47,6 +47,11 @@ class MezuroPlugin::Helpers::ContentViewerHelper |
47 | 47 | def self.format_name(metric_configuration_snapshot) |
48 | 48 | metric_configuration_snapshot.metric.name.delete("() ") |
49 | 49 | end |
50 | + | |
51 | + def self.format_time(time) | |
52 | + time.class | |
53 | + #MezuroPluginModuleResultController.helpers.distance_of_time_in_words(0, time/1000, include_seconds = true) | |
54 | + end | |
50 | 55 | |
51 | 56 | private |
52 | 57 | ... | ... |
plugins/mezuro/test/fixtures/configuration_fixtures.rb
plugins/mezuro/test/fixtures/metric_configuration_fixtures.rb
... | ... | @@ -4,13 +4,13 @@ class MetricConfigurationFixtures |
4 | 4 | |
5 | 5 | def self.amloc_metric_configuration |
6 | 6 | amloc = Kalibro::MetricConfiguration.new amloc_metric_configuration_hash |
7 | - amloc.configuration_id = 13 | |
7 | + amloc.configuration_id = "13" | |
8 | 8 | amloc |
9 | 9 | end |
10 | 10 | |
11 | 11 | def self.sc_metric_configuration |
12 | 12 | sc = Kalibro::MetricConfiguration.new sc_metric_configuration_hash |
13 | - sc.configuration_id = 13 | |
13 | + sc.configuration_id = "13" | |
14 | 14 | sc |
15 | 15 | end |
16 | 16 | |
... | ... | @@ -19,22 +19,22 @@ class MetricConfigurationFixtures |
19 | 19 | :code => 'amloc', |
20 | 20 | :metric => MetricFixtures.amloc_hash, |
21 | 21 | :base_tool_name => MetricFixtures.amloc_hash[:origin], |
22 | - :weight => 1.0, | |
22 | + :weight => "1.0", | |
23 | 23 | :aggregation_form => 'AVERAGE', |
24 | - :reading_group_id => 31, | |
25 | - :configuration_id => 13 | |
24 | + :reading_group_id => "31", | |
25 | + :configuration_id => "13" | |
26 | 26 | }) |
27 | 27 | end |
28 | 28 | |
29 | 29 | def self.amloc_metric_configuration_hash |
30 | 30 | { |
31 | - :id => 42, | |
31 | + :id => "42", | |
32 | 32 | :code => 'amloc', |
33 | 33 | :metric => MetricFixtures.amloc_hash, |
34 | 34 | :base_tool_name => MetricFixtures.amloc_hash[:origin], |
35 | - :weight => 1.0, | |
35 | + :weight => "1.0", | |
36 | 36 | :aggregation_form => 'AVERAGE', |
37 | - :reading_group_id => 31, | |
37 | + :reading_group_id => "31", | |
38 | 38 | :attributes! => {:metric => { |
39 | 39 | 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', |
40 | 40 | 'xsi:type' => 'kalibro:metricXml' }} |
... | ... | @@ -43,12 +43,12 @@ class MetricConfigurationFixtures |
43 | 43 | |
44 | 44 | def self.sc_metric_configuration_hash |
45 | 45 | { |
46 | - :id => 42, | |
46 | + :id => "42", | |
47 | 47 | :code => 'sc', |
48 | 48 | :metric => MetricFixtures.compound_metric_hash, |
49 | - :weight => 1.0, | |
49 | + :weight => "1.0", | |
50 | 50 | :aggregation_form => 'AVERAGE', |
51 | - :reading_group_id => 31, | |
51 | + :reading_group_id => "31", | |
52 | 52 | :attributes! => {:metric => { |
53 | 53 | 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', |
54 | 54 | 'xsi:type' => 'kalibro:metricXml' }} | ... | ... |
plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb
... | ... | @@ -10,7 +10,7 @@ class MetricConfigurationSnapshotFixtures |
10 | 10 | def self.metric_configuration_snapshot_hash |
11 | 11 | { |
12 | 12 | :code => "code", |
13 | - :weight => 1, | |
13 | + :weight => "1", | |
14 | 14 | :aggregation_form => 'AVERAGE', |
15 | 15 | :metric => MetricFixtures.amloc_hash, |
16 | 16 | :base_tool_name => "Analizo", |
... | ... | @@ -43,11 +43,11 @@ class MetricConfigurationSnapshotFixtures |
43 | 43 | def self.compound_metric_configuration_snapshot_hash |
44 | 44 | { |
45 | 45 | :code => "code", |
46 | - :weight => 1, | |
46 | + :weight => "1", | |
47 | 47 | :aggregation_form => 'AVERAGE', |
48 | 48 | :metric => MetricFixtures.compound_metric, |
49 | 49 | :base_tool_name => "Analizo", |
50 | - :range => RangeSnapshotFixtures.range_snapshot_hash, | |
50 | + :range => [RangeSnapshotFixtures.range_snapshot_hash], | |
51 | 51 | :attributes! => { |
52 | 52 | :metric => { |
53 | 53 | 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', | ... | ... |
plugins/mezuro/test/fixtures/metric_fixtures.rb
... | ... | @@ -5,7 +5,7 @@ class MetricFixtures |
5 | 5 | end |
6 | 6 | |
7 | 7 | def self.compound_metric_hash |
8 | - {:name => 'Structural Complexity', :compound => true, :scope => 'CLASS', :script => 'return 42;', :description => 'Calculate the Structural Complexity of the Code'} | |
8 | + {:name => 'Structural Complexity', :compound => "true", :scope => 'CLASS', :script => 'return 42;', :description => 'Calculate the Structural Complexity of the Code'} | |
9 | 9 | end |
10 | 10 | |
11 | 11 | def self.total_cof |
... | ... | @@ -13,7 +13,7 @@ class MetricFixtures |
13 | 13 | end |
14 | 14 | |
15 | 15 | def self.total_cof_hash |
16 | - {:name => 'Total Coupling Factor', :compound => false, :scope => 'APPLICATION', :origin => 'Analizo', :language => ['JAVA']} | |
16 | + {:name => 'Total Coupling Factor', :compound => "false", :scope => 'APPLICATION', :origin => 'Analizo', :language => ['JAVA']} | |
17 | 17 | end |
18 | 18 | |
19 | 19 | def self.amloc |
... | ... | @@ -21,7 +21,7 @@ class MetricFixtures |
21 | 21 | end |
22 | 22 | |
23 | 23 | def self.amloc_hash |
24 | - {:name => 'Average Method LOC', :compound => false, :scope => 'CLASS', :origin => 'Analizo', :language => ['JAVA']} | |
24 | + {:name => 'Average Method LOC', :compound => "false", :scope => 'CLASS', :origin => 'Analizo', :language => ['JAVA']} | |
25 | 25 | end |
26 | 26 | |
27 | 27 | end | ... | ... |
plugins/mezuro/test/fixtures/metric_result_fixtures.rb
... | ... | @@ -13,7 +13,7 @@ class MetricResultFixtures |
13 | 13 | |
14 | 14 | def self.metric_result_with_error_hash |
15 | 15 | { |
16 | - :id => 41, | |
16 | + :id => "41", | |
17 | 17 | :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash, |
18 | 18 | :error => ThrowableFixtures.throwable_hash |
19 | 19 | } |
... | ... | @@ -21,9 +21,9 @@ class MetricResultFixtures |
21 | 21 | |
22 | 22 | def self.native_metric_result_hash |
23 | 23 | { |
24 | - :id => 42, | |
24 | + :id => "42", | |
25 | 25 | :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash, |
26 | - :value => 0.0, | |
26 | + :value => "0.0", | |
27 | 27 | :attributes! => |
28 | 28 | { |
29 | 29 | :configuration => |
... | ... | @@ -37,9 +37,9 @@ class MetricResultFixtures |
37 | 37 | |
38 | 38 | def self.compound_metric_result_hash |
39 | 39 | { |
40 | - :id => 43, | |
40 | + :id => "43", | |
41 | 41 | :configuration => MetricConfigurationSnapshotFixtures.compound_metric_configuration_snapshot_hash, |
42 | - :value => 1.0, | |
42 | + :value => "1.0", | |
43 | 43 | :attributes! => |
44 | 44 | { |
45 | 45 | :configuration => | ... | ... |
plugins/mezuro/test/fixtures/module_result_fixtures.rb
... | ... | @@ -8,10 +8,10 @@ class ModuleResultFixtures |
8 | 8 | |
9 | 9 | def self.module_result_hash |
10 | 10 | { |
11 | - :id => 42, | |
11 | + :id => "42", | |
12 | 12 | :module => ModuleFixtures.module_hash, |
13 | - :grade => 10.0, | |
14 | - :parent_id => 31, | |
13 | + :grade => "10.0", | |
14 | + :parent_id => "31", | |
15 | 15 | :attributes! => |
16 | 16 | { |
17 | 17 | :module => |
... | ... | @@ -25,12 +25,12 @@ class ModuleResultFixtures |
25 | 25 | |
26 | 26 | def self.parent_module_result_hash |
27 | 27 | { |
28 | - :id => 31, | |
28 | + :id => "31", | |
29 | 29 | :module => { |
30 | 30 | :name => 'Qt-Calculator Parent', |
31 | 31 | :granularity => 'APPLICATION' |
32 | 32 | }, |
33 | - :grade => 10.0, | |
33 | + :grade => "10.0", | |
34 | 34 | :attributes! => |
35 | 35 | { |
36 | 36 | :module => | ... | ... |
plugins/mezuro/test/fixtures/process_time_fixtures.rb
plugins/mezuro/test/fixtures/processing_fixtures.rb
... | ... | @@ -9,17 +9,17 @@ class ProcessingFixtures |
9 | 9 | |
10 | 10 | def self.processing_hash |
11 | 11 | { |
12 | - :id => 31, | |
12 | + :id => "31", | |
13 | 13 | :date => '2011-10-20T18:26:43.151+00:00', |
14 | 14 | :state => 'READY', |
15 | 15 | :process_time => [ProcessTimeFixtures.process_time_hash], |
16 | - :results_root_id => 13 | |
16 | + :results_root_id => "13" | |
17 | 17 | } |
18 | 18 | end |
19 | 19 | |
20 | 20 | def self.processing_with_error_hash |
21 | 21 | { |
22 | - :id => 31, | |
22 | + :id => "31", | |
23 | 23 | :date => '2011-10-20T18:26:43.151+00:00', |
24 | 24 | :state => 'ERROR', |
25 | 25 | :process_time => [ProcessTimeFixtures.process_time_hash], | ... | ... |
plugins/mezuro/test/fixtures/project_content_fixtures.rb
... | ... | @@ -3,14 +3,7 @@ class ProjectContentFixtures |
3 | 3 | def self.project_content |
4 | 4 | content = MezuroPlugin::ProjectContent.new |
5 | 5 | content.project_id = 42 |
6 | - #content.name = 'Qt-Calculator' | |
7 | - #content.project_license = 'GPL' | |
8 | - #content.description = 'Calculator for Qt' | |
9 | - #content.repository_type = [RepositoryFixtures.repository_hash[:type]] | |
10 | - #content.repository_url = [RepositoryFixtures.repository_hash[:address]] | |
11 | - #content.configuration_name = 'Kalibro for Java' | |
12 | - #content.periodicity_in_days = 1 | |
13 | 6 | content |
14 | 7 | end |
15 | 8 | |
16 | -end | |
17 | 9 | \ No newline at end of file |
10 | +end | ... | ... |
plugins/mezuro/test/fixtures/project_fixtures.rb
plugins/mezuro/test/fixtures/range_fixtures.rb
... | ... | @@ -5,11 +5,11 @@ class RangeFixtures |
5 | 5 | end |
6 | 6 | |
7 | 7 | def self.created_range |
8 | - Kalibro::Range.new :beginning => 19.5, :end => "INF", :reading_id => 1, :comments => "Test range 1" | |
8 | + Kalibro::Range.new :beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1" | |
9 | 9 | end |
10 | 10 | |
11 | 11 | def self.range_hash |
12 | - {:id => 1, :beginning => 19.5, :end => "INF", :reading_id => 1, :comments => "Test range 1"} | |
12 | + {:id => "1", :beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1"} | |
13 | 13 | end |
14 | 14 | |
15 | 15 | end | ... | ... |
plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb
... | ... | @@ -5,7 +5,7 @@ class RangeSnapshotFixtures |
5 | 5 | end |
6 | 6 | |
7 | 7 | def self.range_snapshot_hash |
8 | - { :end => 5, :label => "snapshot", :grade => 10, :color => "FF2284", :comments => "comment" } | |
8 | + { :end => "5", :label => "snapshot", :grade => "10", :color => "FF2284", :comments => "comment" } | |
9 | 9 | end |
10 | 10 | |
11 | 11 | end | ... | ... |
plugins/mezuro/test/fixtures/reading_fixtures.rb
... | ... | @@ -5,11 +5,11 @@ class ReadingFixtures |
5 | 5 | end |
6 | 6 | |
7 | 7 | def self.created_reading # A created object has no id before being sent to kalibro |
8 | - Kalibro::Reading.new :label => "Reading Test Label", :grade => 10.5, :color => "AABBCC" | |
8 | + Kalibro::Reading.new :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC" | |
9 | 9 | end |
10 | 10 | |
11 | 11 | def self.reading_hash |
12 | - {:id => 42, :label => "Reading Test Label", :grade => 10.5, :color => "AABBCC" } | |
12 | + {:id => "42", :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC" } | |
13 | 13 | end |
14 | 14 | |
15 | 15 | end | ... | ... |
plugins/mezuro/test/fixtures/reading_group_fixtures.rb
... | ... | @@ -9,7 +9,7 @@ class ReadingGroupFixtures |
9 | 9 | end |
10 | 10 | |
11 | 11 | def self.reading_group_hash |
12 | - {:id => 42, :name => "Reading Group Test", :description => "Reading group in the fixtures"} | |
12 | + {:id => "42", :name => "Reading Group Test", :description => "Reading group in the fixtures"} | |
13 | 13 | end |
14 | 14 | |
15 | 15 | end | ... | ... |
plugins/mezuro/test/fixtures/repository_fixtures.rb
... | ... | @@ -12,12 +12,12 @@ class RepositoryFixtures |
12 | 12 | :process_period => "1", |
13 | 13 | :type => 'SUBVERSION', |
14 | 14 | :address => 'https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator', |
15 | - :configuration_id => 31 | |
15 | + :configuration_id => "31" | |
16 | 16 | }) |
17 | 17 | end |
18 | 18 | |
19 | 19 | def self.repository_hash |
20 | - {:id => 42, :name => "test repository", :description => "test description", :license => "GPL", :process_period => "1", :type => 'SUBVERSION', :address => 'https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator', :configuration_id => 31} | |
20 | + {:id => "42", :name => "test repository", :description => "test description", :license => "GPL", :process_period => "1", :type => 'SUBVERSION', :address => "https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator", :configuration_id => "31"} | |
21 | 21 | end |
22 | 22 | |
23 | 23 | def self.types | ... | ... |
plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb
1 | 1 | class StackTraceElementFixtures |
2 | 2 | |
3 | - def self.stack_trace_element(method_name = 'my method name', line_number = 42) | |
4 | - Kalibro::StackTraceElement.new stack_trace_element_hash(method_name, line_number) | |
3 | + def self.stack_trace_element | |
4 | + Kalibro::StackTraceElement.new stack_trace_element_hash | |
5 | 5 | end |
6 | 6 | |
7 | - def self.stack_trace_element_hash(method_name = 'my method name', line_number = 42) | |
7 | + def self.stack_trace_element_hash | |
8 | 8 | { |
9 | 9 | :declaring_class => 'my.declaring.Class', |
10 | - :method_name => method_name, | |
10 | + :method_name => 'my method name', | |
11 | 11 | :file_name => 'MyFile.java', |
12 | - :line_number => line_number | |
12 | + :line_number => '42' | |
13 | 13 | } |
14 | 14 | end |
15 | 15 | ... | ... |
plugins/mezuro/test/fixtures/throwable_fixtures.rb
... | ... | @@ -11,8 +11,7 @@ class ThrowableFixtures |
11 | 11 | :target_string => 'Target String', |
12 | 12 | :message => 'Throwable message from ThrowableTest', |
13 | 13 | :stack_trace_element => [ |
14 | - StackTraceElementFixtures.stack_trace_element_hash('my method 1', 42), | |
15 | - StackTraceElementFixtures.stack_trace_element_hash('my method 2', 84) | |
14 | + StackTraceElementFixtures.stack_trace_element_hash, StackTraceElementFixtures.stack_trace_element_hash | |
16 | 15 | ] |
17 | 16 | } |
18 | 17 | end | ... | ... |
plugins/mezuro/test/unit/kalibro/process_time_test.rb
plugins/mezuro/views/mezuro_plugin_processing/_processing.rhtml
... | ... | @@ -8,9 +8,10 @@ |
8 | 8 | <td><%= @processing.date %></td> |
9 | 9 | </tr> |
10 | 10 | <% @processing.process_time.each do |process_time| %> |
11 | + <%= process_time.inspect %> | |
11 | 12 | <tr> |
12 | 13 | <td><%= _(process_time.state + ' time') %></td> |
13 | - <td><%= process_time.time %></td> | |
14 | + <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_time(process_time.time) %></td> | |
14 | 15 | </tr> |
15 | 16 | <% end %> |
16 | 17 | <tr> |
... | ... | @@ -33,4 +34,4 @@ |
33 | 34 | }); |
34 | 35 | </script> |
35 | 36 | |
36 | -<span id="module_result_root_id" module_result_root_id="<%= @processing.results_root_id %>"> | |
37 | 37 | \ No newline at end of file |
38 | +<span id="module_result_root_id" module_result_root_id="<%= @processing.results_root_id %>"> | ... | ... |