kalibro_client 2.0.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a5bcfbb03d6e6c0d2bf2c3b4d671daf6fe2dcc6
4
- data.tar.gz: 968a58a0f973981f2909bdb0ef6969a0c19cce24
3
+ metadata.gz: 8dbf2ac51375c86cb7e1f7cf8a3aab2a28c530b4
4
+ data.tar.gz: fdb92022806ccb9a35b1e0b3b2124282494e2fac
5
5
  SHA512:
6
- metadata.gz: 815e31061ec7660983846ffed1052d3d2bcfaee8c373b287757ca2ba192f3943939fc292687738504a964f664a1dda6d5a4534512e808653407ce8fe9989022b
7
- data.tar.gz: cec3da37bf2df5bd5926679ddbda0aa7fc76f5c276f309acc46daf732e75d4953b0f3e25408f59ce0c471618a545d40ccee990cf7772c3c4926889959935d754
6
+ metadata.gz: 3066c33f39ddd5712c30dfa85b08270cc08a18e65646d97ce6c69c5c22cb9bf9106078099c22aa23a4516bb3f150a24d94da1e9c98afe180f80cc21fac0ea216
7
+ data.tar.gz: b468950f31c0d32770e3198dc4f878e3e337875f05796df9c25c654895073474eb92a27f389a82a73167d7a196aae5d9aeb1735645eba32a2ea4f57819cb5067
data/.travis.yml CHANGED
@@ -5,11 +5,11 @@ rvm:
5
5
  addons:
6
6
  postgresql: "9.3"
7
7
 
8
- before_script:
8
+ before_script:
9
9
  # Remove bugged libzmq3 package, see https://github.com/travis-ci/travis-ci/issues/982 and https://github.com/travis-ci/travis-ci/issues/1715 for details
10
10
  - sudo apt-get remove libzmq3
11
- - git clone https://github.com/mezuro/kalibro_install.git -b v3.8 kalibro_install
12
- - KALIBRO_PROCESSOR_VERSION='v1.0.0' KALIBRO_CONFIGURATIONS_VERSION='v1.1.1' ./kalibro_install/install.sh
11
+ - git clone https://github.com/mezuro/kalibro_install.git -b v4.0 kalibro_install
12
+ - KALIBRO_PROCESSOR_VERSION='v1.1.1' KALIBRO_CONFIGURATIONS_VERSION='v1.2.0' ./kalibro_install/install.sh
13
13
  - cp features/support/kalibro_cucumber_helpers.yml.sample features/support/kalibro_cucumber_helpers.yml
14
14
  - export BUNDLE_GEMFILE=$PWD/Gemfile
15
15
  - export CODECLIMATE_REPO_TOKEN=46cbb96b053b03ad66b0355bd96d0787f56fc5a4fc171b8d6eb30c421c5e6777
@@ -0,0 +1,11 @@
1
+ Feature: HotspotMetricConfiguration retrieval
2
+ In order to be able to list just with the HotspotMetricConfigurations
3
+ As a developer
4
+ I want to get all HotspotMetricConfigurations of a given KalibroConfiguration
5
+
6
+ @kalibro_configuration_restart
7
+ Scenario: get a list of all hotspot metric configurations of some kalibro configuration
8
+ Given I have a kalibro configuration with name "Kalibro for Java"
9
+ And I have a hotspot metric configuration within the given kalibro configuration
10
+ When I request for hotspot_metric_configurations of the given kalibro configuration
11
+ Then I should get a list with the given HotspotMetricConfiguration
@@ -0,0 +1,12 @@
1
+ Feature: TreeMetricConfiguration retrieval
2
+ In order to be able to list just with the TreeMetricConfigurations
3
+ As a developer
4
+ I want to get all TreeMetricConfigurations of a given KalibroConfiguration
5
+
6
+ @kalibro_configuration_restart
7
+ Scenario: get a list of all tree metric configurations of some kalibro configuration
8
+ Given I have a kalibro configuration with name "Kalibro for Java"
9
+ And I have a reading group with name "Group"
10
+ And I have a tree metric configuration within the given kalibro configuration
11
+ When I request for tree_metric_configurations of the given kalibro configuration
12
+ Then I should get a list with the given TreeMetricConfiguration
@@ -0,0 +1,20 @@
1
+ Feature: Module Results
2
+ In order to be able to get the module result associated with this metric result
3
+ As a developer
4
+ I want to get the module result of the given metric result
5
+
6
+ @kalibro_configuration_restart @kalibro_processor_restart
7
+ Scenario: when there is a metric result
8
+ Given I have a project with name "Kalibro"
9
+ And I have a kalibro configuration with name "Java"
10
+ And I have a reading group with name "Group"
11
+ And I have a loc configuration within the given kalibro configuration
12
+ And the given project has the following Repositories:
13
+ | name | scm_type | address |
14
+ | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
+ And I call the process method for the given repository
16
+ And I wait up for a ready processing
17
+ And I call the first_processing method for the given repository
18
+ When I get the first metric result of the given processing
19
+ And I ask for the module result of the given metric result
20
+ Then I should get a module result
@@ -18,6 +18,17 @@ Given(/^I have a loc configuration within the given kalibro configuration$/) do
18
18
  kalibro_configuration_id: @kalibro_configuration.id})
19
19
  end
20
20
 
21
+ Given(/^I have a hotspot metric configuration within the given kalibro configuration$/) do
22
+ @hotspot_metric_configuration = FactoryGirl.create(:metric_configuration,
23
+ {metric: FactoryGirl.build(:hotspot_metric),
24
+ kalibro_configuration_id: @kalibro_configuration.id})
25
+ end
26
+
27
+ Given(/^I have a tree metric configuration within the given kalibro configuration$/) do
28
+ step "I have a loc configuration within the given kalibro configuration"
29
+ @tree_metric_configuration = @metric_configuration
30
+ end
31
+
21
32
  When(/^I search a metric configuration with the same id of the given metric configuration$/) do
22
33
  @found_metric_configuration = KalibroClient::Entities::Configurations::MetricConfiguration.find(@metric_configuration.id)
23
34
  end
@@ -49,6 +60,14 @@ When(/^I have a flay configuration within the given kalibro configuration$/) do
49
60
  kalibro_configuration_id: @kalibro_configuration.id})
50
61
  end
51
62
 
63
+ When(/^I request for hotspot_metric_configurations of the given kalibro configuration$/) do
64
+ @hotspot_metric_configurations = @kalibro_configuration.hotspot_metric_configurations
65
+ end
66
+
67
+ When(/^I request for tree_metric_configurations of the given kalibro configuration$/) do
68
+ @tree_metric_configurations = @kalibro_configuration.tree_metric_configurations
69
+ end
70
+
52
71
  Then(/^it should return the same metric configuration as the given one$/) do
53
72
  expect(@found_metric_configuration).to eq(@metric_configuration)
54
73
  end
@@ -73,3 +92,11 @@ end
73
92
  Then(/^its metric should be Hotspot one$/) do
74
93
  expect(@found_metric_configuration.metric).to be_a(KalibroClient::Entities::Miscellaneous::HotspotMetric)
75
94
  end
95
+
96
+ Then(/^I should get a list with the given HotspotMetricConfiguration$/) do
97
+ expect(@hotspot_metric_configurations).to include(@hotspot_metric_configuration)
98
+ end
99
+
100
+ Then(/^I should get a list with the given TreeMetricConfiguration$/) do
101
+ expect(@tree_metric_configurations).to include(@tree_metric_configuration)
102
+ end
@@ -13,6 +13,15 @@ When(/^I call the history of method with the metric name and the results root id
13
13
  @response = KalibroClient::Entities::Processor::TreeMetricResult.history_of(@metric.name, @response.root_module_result_id, @repository.id)
14
14
  end
15
15
 
16
+ When(/^I get the first metric result of the given processing$/) do
17
+ @metric_result = KalibroClient::Entities::Processor::ModuleResult.find(@response.root_module_result_id)
18
+ .tree_metric_results.first
19
+ end
20
+
21
+ When(/^I ask for the module result of the given metric result$/) do
22
+ @module_result = @metric_result.module_result
23
+ end
24
+
16
25
  Then (/^I should get a Float list$/) do
17
26
  expect(@response).to be_a(Array)
18
27
  expect(@response.first).to be_a(Float)
@@ -31,3 +40,7 @@ end
31
40
  Then(/^the first metric result should have a metric configuration$/) do
32
41
  expect(@response.first.metric_configuration).to be_a(KalibroClient::Entities::Configurations::MetricConfiguration)
33
42
  end
43
+
44
+ Then(/^I should get a module result$/) do
45
+ expect(@module_result).to be_a(KalibroClient::Entities::Processor::ModuleResult)
46
+ end
@@ -29,7 +29,19 @@ module KalibroClient
29
29
  end
30
30
 
31
31
  def metric_configurations
32
- KalibroClient::Entities::Configurations::MetricConfiguration.create_objects_array_from_hash(self.class.request(':id/metric_configurations', {id: id}, :get))
32
+ KalibroClient::Entities::Configurations::MetricConfiguration.create_objects_array_from_hash(self.class.request(':id/metric_configurations', {id: id}, :get))
33
+ end
34
+
35
+ def hotspot_metric_configurations
36
+ hotspot_metric_configurations_hash = self.class.request(':id/hotspot_metric_configurations', {id: id}, :get)
37
+ KalibroClient::Entities::Configurations::MetricConfiguration.create_objects_array_from_hash(
38
+ {'metric_configurations' => hotspot_metric_configurations_hash['hotspot_metric_configurations']})
39
+ end
40
+
41
+ def tree_metric_configurations
42
+ tree_metric_configurations_hash = self.class.request(':id/tree_metric_configurations', {id: id}, :get)
43
+ KalibroClient::Entities::Configurations::MetricConfiguration.create_objects_array_from_hash(
44
+ {'metric_configurations' => tree_metric_configurations_hash['tree_metric_configurations']})
33
45
  end
34
46
  end
35
47
  end
@@ -5,7 +5,7 @@
5
5
  # it under the terms of the GNU General Public License as published by
6
6
  # the Free Software Foundation, either version 3 of the License, or
7
7
  # (at your option) any later version.
8
- #
8
+ #
9
9
  # This program is distributed in the hope that it will be useful,
10
10
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -18,9 +18,7 @@ module KalibroClient
18
18
  module Entities
19
19
  module Processor
20
20
  class KalibroModule < KalibroClient::Entities::Processor::Base
21
-
22
- attr_accessor :granlrty, :id, :long_name, :module_result_id
23
- alias_method :granularity, :granlrty
21
+ attr_accessor :granularity, :id, :long_name, :module_result_id
24
22
 
25
23
  def name=(value)
26
24
  @long_name = (value.is_a?(Array) ? value.join('.') : value)
@@ -18,10 +18,9 @@ module KalibroClient
18
18
  module Entities
19
19
  module Processor
20
20
  class MetricResult < KalibroClient::Entities::Processor::Base
21
-
22
21
  # TODO: related_hotspot_metric_results_id should be enclosed to Processor which does not return this id into the response
23
22
  # there should be a controller that returns all the HotspotMetricResults associated through RelatedHotspotMetricResult
24
- attr_accessor :id, :value, :module_result_id, :metric_configuration_id,
23
+ attr_accessor :id, :value, :metric_configuration_id, :module_result_id,
25
24
  :line_number, :message, :related_hotspot_metric_results_id
26
25
  attr_reader :metric_configuration
27
26
 
@@ -50,6 +49,13 @@ module KalibroClient
50
49
  def value=(value)
51
50
  @value = value.to_f
52
51
  end
52
+
53
+ def module_result
54
+ return @module_result unless @module_result.nil? || @module_result_id != @module_result.id
55
+ module_result_hash = KalibroClient::Entities::Processor::MetricResult
56
+ .request(':id/module_result', { id: @module_result_id }, :get)['module_result']
57
+ @module_result = KalibroClient::Entities::Processor::ModuleResult.new module_result_hash
58
+ end
53
59
  end
54
60
  end
55
61
  end
@@ -15,5 +15,5 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  module KalibroClient
18
- VERSION = "2.0.0"
18
+ VERSION = "2.1.0"
19
19
  end
@@ -33,7 +33,7 @@ describe KalibroClient::Entities::Configurations::KalibroConfiguration do
33
33
  returns({'kalibro_configurations' => []})
34
34
  end
35
35
 
36
- it 'should return nil' do
36
+ it 'is expected to return nil' do
37
37
  expect(KalibroClient::Entities::Configurations::KalibroConfiguration.all).to be_empty
38
38
  end
39
39
  end
@@ -49,7 +49,7 @@ describe KalibroClient::Entities::Configurations::KalibroConfiguration do
49
49
  returns({'kalibro_configurations' => [kalibro_configuration.to_hash, another_kalibro_configuration.to_hash]})
50
50
  end
51
51
 
52
- it 'should return the two elements' do
52
+ it 'is expected to return the two elements' do
53
53
  kalibro_configurations = KalibroClient::Entities::Configurations::KalibroConfiguration.all
54
54
 
55
55
  expect(kalibro_configurations.size).to eq(2)
@@ -68,7 +68,7 @@ describe KalibroClient::Entities::Configurations::KalibroConfiguration do
68
68
  returns({'metric_configurations' => []})
69
69
  end
70
70
 
71
- it 'should return an empty array' do
71
+ it 'is expected to return an empty array' do
72
72
  expect(subject.metric_configurations).to be_empty
73
73
  end
74
74
  end
@@ -83,9 +83,71 @@ describe KalibroClient::Entities::Configurations::KalibroConfiguration do
83
83
  returns({'metric_configurations' => [metric_configuration_1.to_hash, metric_configuration_2.to_hash]})
84
84
  end
85
85
 
86
- it 'should return an empty array' do
86
+ it 'is expected to return an array with the given metric configurations' do
87
87
  expect(subject.metric_configurations).to eq([metric_configuration_1, metric_configuration_2])
88
88
  end
89
89
  end
90
90
  end
91
+
92
+ describe 'hotspot_metric_configurations' do
93
+ context 'with no hotspot metric configurations' do
94
+ before :each do
95
+ KalibroClient::Entities::Configurations::KalibroConfiguration.
96
+ expects(:request).
97
+ with(':id/hotspot_metric_configurations', {id: subject.id}, :get).
98
+ returns({'hotspot_metric_configurations' => []})
99
+ end
100
+
101
+ it 'is expected to return an empty array' do
102
+ expect(subject.hotspot_metric_configurations).to be_empty
103
+ end
104
+ end
105
+
106
+ context 'with hotspot metric configurations' do
107
+ let(:metric_configuration_1) { FactoryGirl.build(:metric_configuration, kalibro_configuration_id: subject.id) }
108
+ let(:metric_configuration_2) { FactoryGirl.build(:metric_configuration, kalibro_configuration_id: subject.id) }
109
+
110
+ before :each do
111
+ KalibroClient::Entities::Configurations::KalibroConfiguration.
112
+ expects(:request).
113
+ with(':id/hotspot_metric_configurations', {id: subject.id}, :get).
114
+ returns({'hotspot_metric_configurations' => [metric_configuration_1.to_hash, metric_configuration_2.to_hash]})
115
+ end
116
+
117
+ it 'is expected to return an array with the hotspot metric configurations' do
118
+ expect(subject.hotspot_metric_configurations).to eq([metric_configuration_1, metric_configuration_2])
119
+ end
120
+ end
121
+ end
122
+
123
+ describe 'tree_metric_configurations' do
124
+ context 'with no tree metric configurations' do
125
+ before :each do
126
+ KalibroClient::Entities::Configurations::KalibroConfiguration.
127
+ expects(:request).
128
+ with(':id/tree_metric_configurations', {id: subject.id}, :get).
129
+ returns({'tree_metric_configurations' => []})
130
+ end
131
+
132
+ it 'is expected to return an empty array' do
133
+ expect(subject.tree_metric_configurations).to be_empty
134
+ end
135
+ end
136
+
137
+ context 'with tree metric configurations' do
138
+ let(:metric_configuration_1) { FactoryGirl.build(:metric_configuration, kalibro_configuration_id: subject.id) }
139
+ let(:metric_configuration_2) { FactoryGirl.build(:metric_configuration, kalibro_configuration_id: subject.id) }
140
+
141
+ before :each do
142
+ KalibroClient::Entities::Configurations::KalibroConfiguration.
143
+ expects(:request).
144
+ with(':id/tree_metric_configurations', {id: subject.id}, :get).
145
+ returns({'tree_metric_configurations' => [metric_configuration_1.to_hash, metric_configuration_2.to_hash]})
146
+ end
147
+
148
+ it 'is expected to return an array with the tree metric configurations' do
149
+ expect(subject.tree_metric_configurations).to eq([metric_configuration_1, metric_configuration_2])
150
+ end
151
+ end
152
+ end
91
153
  end
@@ -93,4 +93,46 @@ describe KalibroClient::Entities::Processor::MetricResult do
93
93
  expect(subject.value).to eq(42)
94
94
  end
95
95
  end
96
+
97
+ describe 'module_result' do
98
+ let(:module_result) { FactoryGirl.build(:module_result, :with_id) }
99
+ subject { FactoryGirl.build(:metric_result, module_result_id: module_result.id) }
100
+
101
+ context 'when module_result is nil' do
102
+ before do
103
+ described_class.expects(:request).with(':id/module_result', { id: module_result.id }, :get)
104
+ .returns('module_result' => module_result.to_hash)
105
+ end
106
+
107
+ it 'is expected to request the module result and set it' do
108
+ expect(subject.module_result).to eq(module_result)
109
+ end
110
+ end
111
+
112
+ context 'when the module_result_id is different than the module_result\'s id' do
113
+ let(:different_id) { module_result.id + 1 }
114
+ let(:different_module_result) { FactoryGirl.build(:module_result, id: different_id) }
115
+
116
+ before do
117
+ described_class.expects(:request).with(':id/module_result', { id: different_id }, :get)
118
+ .returns('module_result' => different_module_result.to_hash)
119
+ end
120
+
121
+ it 'is expected to set the module_result to the one matched by the id' do
122
+ subject.module_result_id = different_module_result.id
123
+ expect(subject.module_result).to eq(different_module_result)
124
+ end
125
+ end
126
+
127
+ context 'when the module_result_id is the same as the module_result\'s id' do
128
+ before do
129
+ described_class.expects(:request).with(':id/module_result', { id: module_result.id }, :get)
130
+ .once.returns('module_result' => module_result.to_hash)
131
+ end
132
+
133
+ it 'is expected to not change the module_result' do
134
+ expect(subject.module_result).to eq(module_result)
135
+ end
136
+ end
137
+ end
96
138
  end
@@ -5,7 +5,7 @@
5
5
  # it under the terms of the GNU General Public License as published by
6
6
  # the Free Software Foundation, either version 3 of the License, or
7
7
  # (at your option) any later version.
8
- #
8
+ #
9
9
  # This program is distributed in the hope that it will be useful,
10
10
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -16,13 +16,13 @@
16
16
 
17
17
  FactoryGirl.define do
18
18
  factory :kalibro_module, class: KalibroClient::Entities::Processor::KalibroModule do
19
- name 'Qt-Calculator'
20
- granlrty 'APPLICATION'
19
+ name 'Qt-Calculator'
20
+ granularity 'APPLICATION'
21
21
 
22
22
  trait :with_id do
23
23
  id 1
24
24
  end
25
25
 
26
26
  factory :kalibro_module_with_id, traits: [:with_id]
27
- end
27
+ end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalibro_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Quadros Miranda
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-09-30 00:00:00.000000000 Z
14
+ date: 2015-10-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -193,7 +193,9 @@ files:
193
193
  - features/kalibro_configuration/all.feature
194
194
  - features/kalibro_configuration/creation.feature
195
195
  - features/kalibro_configuration/destroy.feature
196
+ - features/kalibro_configuration/hotspot_metric_configurations.feature
196
197
  - features/kalibro_configuration/metric_configurations.feature
198
+ - features/kalibro_configuration/tree_metric_configurations.feature
197
199
  - features/kalibro_range/destroy.feature
198
200
  - features/kalibro_range/exists.feature
199
201
  - features/kalibro_range/find.feature
@@ -208,6 +210,7 @@ files:
208
210
  - features/metric_configuration/metric_configurations_of.feature
209
211
  - features/metric_result/hotspot_related_results.feature
210
212
  - features/metric_result/metric_results_of.feature
213
+ - features/metric_result/module_results.feature
211
214
  - features/metric_result/tree/descendant_values.feature
212
215
  - features/metric_result/tree/history_of.feature
213
216
  - features/module_result/children.feature
@@ -403,7 +406,9 @@ test_files:
403
406
  - features/kalibro_configuration/all.feature
404
407
  - features/kalibro_configuration/creation.feature
405
408
  - features/kalibro_configuration/destroy.feature
409
+ - features/kalibro_configuration/hotspot_metric_configurations.feature
406
410
  - features/kalibro_configuration/metric_configurations.feature
411
+ - features/kalibro_configuration/tree_metric_configurations.feature
407
412
  - features/kalibro_range/destroy.feature
408
413
  - features/kalibro_range/exists.feature
409
414
  - features/kalibro_range/find.feature
@@ -418,6 +423,7 @@ test_files:
418
423
  - features/metric_configuration/metric_configurations_of.feature
419
424
  - features/metric_result/hotspot_related_results.feature
420
425
  - features/metric_result/metric_results_of.feature
426
+ - features/metric_result/module_results.feature
421
427
  - features/metric_result/tree/descendant_values.feature
422
428
  - features/metric_result/tree/history_of.feature
423
429
  - features/module_result/children.feature