kalibro_gatekeeper_client 0.0.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +29 -0
  6. data/AUTHORS +4 -0
  7. data/COPYING +674 -0
  8. data/COPYING.LESSER +165 -0
  9. data/Gemfile +4 -0
  10. data/README.md +77 -0
  11. data/Rakefile +6 -0
  12. data/cucumber.yml +1 -0
  13. data/features/base_tool/all_names.feature +8 -0
  14. data/features/base_tool/find_by_name.feature +12 -0
  15. data/features/configuration/all.feature +10 -0
  16. data/features/metric_configuration/find.feature +18 -0
  17. data/features/metric_configuration/metric_configurations_of.feature +18 -0
  18. data/features/metric_result/descendant_results.feature +19 -0
  19. data/features/metric_result/history_of.feature +20 -0
  20. data/features/metric_result/metric_results_of.feature +19 -0
  21. data/features/module_result/children.feature +18 -0
  22. data/features/module_result/find.feature +15 -0
  23. data/features/module_result/history_of.feature +11 -0
  24. data/features/processing/first_processing_after.feature +18 -0
  25. data/features/processing/first_processing_of.feature +18 -0
  26. data/features/processing/has_processing.feature +18 -0
  27. data/features/processing/has_processing_after.feature +18 -0
  28. data/features/processing/has_processing_before.feature +18 -0
  29. data/features/processing/has_ready_processing.feature +18 -0
  30. data/features/processing/last_processing_before.feature +18 -0
  31. data/features/processing/last_processing_of.feature +18 -0
  32. data/features/processing/last_processing_state_of.feature +18 -0
  33. data/features/processing/last_ready_processing_of.feature +18 -0
  34. data/features/processing/processing_of.feature +32 -0
  35. data/features/processing/processing_with_date_of.feature +32 -0
  36. data/features/project/all.feature +10 -0
  37. data/features/project/creation.feature +9 -0
  38. data/features/project/destroy.feature +10 -0
  39. data/features/project/exists.feature +9 -0
  40. data/features/project/find.feature +10 -0
  41. data/features/range/all.feature +14 -0
  42. data/features/range/exists.feature +13 -0
  43. data/features/range/find.feature +14 -0
  44. data/features/range/ranges_of.feature +22 -0
  45. data/features/range/save.feature +14 -0
  46. data/features/reading/all.feature +13 -0
  47. data/features/reading/exists.feature +13 -0
  48. data/features/reading/find.feature +11 -0
  49. data/features/reading/readings_of.feature +11 -0
  50. data/features/reading_group/all.feature +10 -0
  51. data/features/repository/all.feature +14 -0
  52. data/features/repository/cancel_processing.feature +14 -0
  53. data/features/repository/exists.feature +14 -0
  54. data/features/repository/find.feature +14 -0
  55. data/features/repository/of.feature +15 -0
  56. data/features/repository/process.feature +16 -0
  57. data/features/repository/types.feature +9 -0
  58. data/features/step_definitions/base_tool_steps.rb +28 -0
  59. data/features/step_definitions/configuration_steps.rb +11 -0
  60. data/features/step_definitions/metric_configuration_steps.rb +52 -0
  61. data/features/step_definitions/metric_result_steps.rb +29 -0
  62. data/features/step_definitions/metric_steps.rb +3 -0
  63. data/features/step_definitions/module_result_steps.rb +30 -0
  64. data/features/step_definitions/processing_steps.rb +91 -0
  65. data/features/step_definitions/project_steps.rb +48 -0
  66. data/features/step_definitions/range_steps.rb +68 -0
  67. data/features/step_definitions/reading_group_steps.rb +19 -0
  68. data/features/step_definitions/reading_steps.rb +39 -0
  69. data/features/step_definitions/repository_steps.rb +61 -0
  70. data/features/support/env.rb +25 -0
  71. data/features/support/kalibro_cucumber_helpers.yml.sample +10 -0
  72. data/kalibro_gatekeeper_client.gemspec +49 -0
  73. data/lib/kalibro_gatekeeper_client/entities/base_tool.rb +55 -0
  74. data/lib/kalibro_gatekeeper_client/entities/configuration.rb +34 -0
  75. data/lib/kalibro_gatekeeper_client/entities/date_metric_result.rb +39 -0
  76. data/lib/kalibro_gatekeeper_client/entities/date_module_result.rb +39 -0
  77. data/lib/kalibro_gatekeeper_client/entities/metric.rb +21 -0
  78. data/lib/kalibro_gatekeeper_client/entities/metric_configuration.rb +76 -0
  79. data/lib/kalibro_gatekeeper_client/entities/metric_configuration_snapshot.rb +57 -0
  80. data/lib/kalibro_gatekeeper_client/entities/metric_result.rb +72 -0
  81. data/lib/kalibro_gatekeeper_client/entities/model.rb +174 -0
  82. data/lib/kalibro_gatekeeper_client/entities/module.rb +27 -0
  83. data/lib/kalibro_gatekeeper_client/entities/module_result.rb +75 -0
  84. data/lib/kalibro_gatekeeper_client/entities/process_time.rb +31 -0
  85. data/lib/kalibro_gatekeeper_client/entities/processing.rb +113 -0
  86. data/lib/kalibro_gatekeeper_client/entities/project.rb +35 -0
  87. data/lib/kalibro_gatekeeper_client/entities/range.rb +100 -0
  88. data/lib/kalibro_gatekeeper_client/entities/range_snapshot.rb +37 -0
  89. data/lib/kalibro_gatekeeper_client/entities/reading.rb +67 -0
  90. data/lib/kalibro_gatekeeper_client/entities/reading_group.rb +44 -0
  91. data/lib/kalibro_gatekeeper_client/entities/repository.rb +89 -0
  92. data/lib/kalibro_gatekeeper_client/entities/repository_observer.rb +50 -0
  93. data/lib/kalibro_gatekeeper_client/entities/stack_trace_element.rb +31 -0
  94. data/lib/kalibro_gatekeeper_client/entities/throwable.rb +42 -0
  95. data/lib/kalibro_gatekeeper_client/entities.rb +37 -0
  96. data/lib/kalibro_gatekeeper_client/errors/record_not_found.rb +22 -0
  97. data/lib/kalibro_gatekeeper_client/errors/standard.rb +24 -0
  98. data/lib/kalibro_gatekeeper_client/errors.rb +18 -0
  99. data/lib/kalibro_gatekeeper_client/helpers/aggregation_options.rb +25 -0
  100. data/lib/kalibro_gatekeeper_client/helpers/hash_converters.rb +48 -0
  101. data/lib/kalibro_gatekeeper_client/helpers/request_methods.rb +47 -0
  102. data/lib/kalibro_gatekeeper_client/helpers/xml_converters.rb +20 -0
  103. data/lib/kalibro_gatekeeper_client/kalibro_cucumber_helpers/configuration.rb +39 -0
  104. data/lib/kalibro_gatekeeper_client/kalibro_cucumber_helpers/hooks.rb +56 -0
  105. data/lib/kalibro_gatekeeper_client/kalibro_cucumber_helpers/scripts/delete_all_kalibro_entries.sh +23 -0
  106. data/lib/kalibro_gatekeeper_client/kalibro_cucumber_helpers/scripts/prepare_kalibro_query_file.sh +38 -0
  107. data/lib/kalibro_gatekeeper_client/kalibro_cucumber_helpers/scripts/put_kalibro_on_test_mode.sh +39 -0
  108. data/lib/kalibro_gatekeeper_client/kalibro_cucumber_helpers/scripts/return_kalibro_from_test_mode.sh +26 -0
  109. data/lib/kalibro_gatekeeper_client/kalibro_cucumber_helpers.rb +40 -0
  110. data/lib/kalibro_gatekeeper_client/version.rb +19 -0
  111. data/lib/kalibro_gatekeeper_client.rb +61 -0
  112. data/lib/rake/test_task.rb +57 -0
  113. data/spec/entities/base_tool_spec.rb +168 -0
  114. data/spec/entities/configuration_spec.rb +61 -0
  115. data/spec/entities/date_metric_result_spec.rb +62 -0
  116. data/spec/entities/date_module_result_spec.rb +61 -0
  117. data/spec/entities/metric_configuration_snapshot_spec.rb +107 -0
  118. data/spec/entities/metric_configuration_spec.rb +173 -0
  119. data/spec/entities/metric_result_spec.rb +188 -0
  120. data/spec/entities/metric_spec.rb +47 -0
  121. data/spec/entities/model_spec.rb +322 -0
  122. data/spec/entities/module_result_spec.rb +163 -0
  123. data/spec/entities/process_time_spec.rb +33 -0
  124. data/spec/entities/processing_spec.rb +334 -0
  125. data/spec/entities/project_spec.rb +68 -0
  126. data/spec/entities/range_snapshot_spec.rb +50 -0
  127. data/spec/entities/range_spec.rb +225 -0
  128. data/spec/entities/reading_group_spec.rb +90 -0
  129. data/spec/entities/reading_spec.rb +148 -0
  130. data/spec/entities/repository_observer_spec.rb +123 -0
  131. data/spec/entities/repository_spec.rb +191 -0
  132. data/spec/entities/stack_trace_element_spec.rb +26 -0
  133. data/spec/entities/throwable_spec.rb +51 -0
  134. data/spec/factories/base_tools.rb +31 -0
  135. data/spec/factories/configurations.rb +29 -0
  136. data/spec/factories/date_metric_results.rb +28 -0
  137. data/spec/factories/date_module_results.rb +22 -0
  138. data/spec/factories/metric_configurations.rb +28 -0
  139. data/spec/factories/metric_configurations_snapshot.rb +26 -0
  140. data/spec/factories/metric_results.rb +24 -0
  141. data/spec/factories/metrics.rb +35 -0
  142. data/spec/factories/models.rb +20 -0
  143. data/spec/factories/module_results.rb +33 -0
  144. data/spec/factories/modules.rb +22 -0
  145. data/spec/factories/process_times.rb +27 -0
  146. data/spec/factories/processings.rb +25 -0
  147. data/spec/factories/projects.rb +29 -0
  148. data/spec/factories/ranges.rb +35 -0
  149. data/spec/factories/ranges_snapshot.rb +26 -0
  150. data/spec/factories/reading_groups.rb +23 -0
  151. data/spec/factories/readings.rb +25 -0
  152. data/spec/factories/repositories.rb +34 -0
  153. data/spec/factories/repository_observers.rb +24 -0
  154. data/spec/factories/stack_trace_elements.rb +24 -0
  155. data/spec/factories/throwables.rb +23 -0
  156. data/spec/helpers/aggregation_options_spec.rb +31 -0
  157. data/spec/helpers/hash_converters_spec.rb +111 -0
  158. data/spec/helpers/xml_converters_spec.rb +64 -0
  159. data/spec/kalibro_entities_spec.rb +108 -0
  160. data/spec/savon/fixtures/config.yml +1 -0
  161. data/spec/savon/fixtures/invalid_config.yml +2 -0
  162. data/spec/savon/fixtures/project/does_not_exists.xml +1 -0
  163. data/spec/savon/savon_test_helper.rb +14 -0
  164. data/spec/spec_helper.rb +56 -0
  165. metadata +466 -0
@@ -0,0 +1,32 @@
1
+ Feature: Processing of
2
+ In order to be able to retrieve processing results
3
+ As a developer
4
+ I want to be able to retrieve the processing
5
+
6
+ @kalibro_restart
7
+ Scenario: With one repository just after starting to process
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And I have a reading group with name "Group"
11
+ And I have a metric configuration within the given configuration
12
+ And the given project has the following Repositories:
13
+ | name | type | address |
14
+ | Kalibro | GIT | https://github.com/mezuro/kalibro.git |
15
+ And I call the process method for the given repository
16
+ And I wait up to 1 seconds
17
+ When I call the processing_of method for the given repository
18
+ Then I should get a Processing with state "LOADING"
19
+
20
+ @kalibro_restart
21
+ Scenario: With one repository just after with ready processing
22
+ Given I have a project with name "Kalibro"
23
+ And I have a configuration with name "Java"
24
+ And I have a reading group with name "Group"
25
+ And I have a metric configuration within the given configuration
26
+ And the given project has the following Repositories:
27
+ | name | type | address |
28
+ | Kalibro | GIT | https://github.com/mezuro/kalibro.git |
29
+ And I call the process method for the given repository
30
+ And I wait up for a ready processing
31
+ When I call the processing_of method for the given repository
32
+ Then I should get a Processing with state "READY"
@@ -0,0 +1,32 @@
1
+ Feature: Processing with date of
2
+ In order to be able to retrieve processing results
3
+ As a developer
4
+ I want to be able to retrieve the processing for a given date
5
+
6
+ @kalibro_restart
7
+ Scenario: With one repository just after starting to process and tomorrow's date
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And I have a reading group with name "Group"
11
+ And I have a metric configuration within the given configuration
12
+ And the given project has the following Repositories:
13
+ | name | type | address |
14
+ | Kalibro | GIT | https://github.com/mezuro/kalibro.git |
15
+ And I call the process method for the given repository
16
+ And I wait up to 1 seconds
17
+ When I call the processing_with_date_of method for the given repository and tomorrow's date
18
+ Then I should get a Processing
19
+
20
+ @kalibro_restart
21
+ Scenario: With one repository just after starting to process and yesterday's date
22
+ Given I have a project with name "Kalibro"
23
+ And I have a configuration with name "Java"
24
+ And I have a reading group with name "Group"
25
+ And I have a metric configuration within the given configuration
26
+ And the given project has the following Repositories:
27
+ | name | type | address |
28
+ | Kalibro | GIT | https://github.com/mezuro/kalibro.git |
29
+ And I call the process method for the given repository
30
+ And I wait up to 1 seconds
31
+ When I call the processing_with_date_of method for the given repository and yesterday's date
32
+ Then I should get a Processing
@@ -0,0 +1,10 @@
1
+ Feature: All
2
+ In order to be able to have projects
3
+ As an developer
4
+ I want to get all the available projects
5
+
6
+ @kalibro_restart
7
+ Scenario: one project
8
+ Given I have a project with name "Kalibro"
9
+ When I ask for all the projects
10
+ Then I should get a list with the given project
@@ -0,0 +1,9 @@
1
+ Feature: Creation
2
+ In order to be able to have projects
3
+ As an developer
4
+ I want to create projects
5
+
6
+ @kalibro_restart
7
+ Scenario: create a valid project
8
+ When I create the project with name "Kalibro"
9
+ Then the project should exist
@@ -0,0 +1,10 @@
1
+ Feature: Destroy
2
+ In order to be able to have projects
3
+ As an developer
4
+ I want to detroy projects
5
+
6
+ @kalibro_restart
7
+ Scenario: destroy an existing project
8
+ Given I have a project with name "Kalibro"
9
+ When I destroy the project with the same id of the given project
10
+ Then the project should not exist
@@ -0,0 +1,9 @@
1
+ Feature: Exists
2
+ In order to be able to have projects
3
+ As an developer
4
+ I want to find wich projects exists
5
+
6
+ @kalibro_restart
7
+ Scenario: check a valid project
8
+ Given I have a project with name "Kalibro"
9
+ Then the project should exist
@@ -0,0 +1,10 @@
1
+ Feature: Find
2
+ In order to be able to have projects
3
+ As an developer
4
+ I want to find projects
5
+
6
+ @kalibro_restart
7
+ Scenario: find a valid project
8
+ Given I have a project with name "Kalibro"
9
+ When I search a project with the same id of the given project
10
+ Then it should return the same project as the given one
@@ -0,0 +1,14 @@
1
+ Feature: Range listing
2
+ In order to be able to get all the ranges
3
+ As a developer
4
+ I want to see all the ranges
5
+
6
+ @kalibro_restart
7
+ Scenario: When there are ranges
8
+ Given I have a configuration with name "Java"
9
+ And I have a reading group with name "Group"
10
+ And I have a metric configuration within the given configuration
11
+ And I have a reading within the given reading group
12
+ And I have a range within the given reading
13
+ When I ask for all the ranges
14
+ Then I should not get an empty list
@@ -0,0 +1,13 @@
1
+ Feature: Exists
2
+ In order to be able to have ranges
3
+ As a developer
4
+ I want to find wich range exists
5
+
6
+ @kalibro_restart
7
+ Scenario: find a valid range
8
+ Given I have a configuration with name "Java"
9
+ And I have a reading group with name "Group"
10
+ And I have a metric configuration within the given configuration
11
+ And I have a reading within the given reading group
12
+ And I have a range within the given reading
13
+ Then the range should exist
@@ -0,0 +1,14 @@
1
+ Feature: Find
2
+ In order to be able to have ranges
3
+ As a developer
4
+ I want to find ranges
5
+
6
+ @kalibro_restart
7
+ Scenario: find a valid range
8
+ Given I have a configuration with name "Java"
9
+ And I have a reading group with name "Group"
10
+ And I have a metric configuration within the given configuration
11
+ And I have a reading within the given reading group
12
+ And I have a range within the given reading
13
+ When I search a range with the same id of the given range
14
+ Then it should return the same range as the given one
@@ -0,0 +1,22 @@
1
+ Feature: Range of
2
+ In order to be able to get all the ranges of a metric configuration
3
+ As a developer
4
+ I want to see all the ranges of the given metric configuration
5
+
6
+ @kalibro_restart
7
+ Scenario: With a inexistent range
8
+ Given I have a configuration with name "Java"
9
+ And I have a reading group with name "Group"
10
+ And I have a metric configuration within the given configuration
11
+ When I ask ranges of the given metric configuration
12
+ Then I should get an empty list
13
+
14
+ @kalibro_restart
15
+ Scenario: With an existing range
16
+ Given I have a configuration with name "Java"
17
+ And I have a reading group with name "Group"
18
+ And I have a metric configuration within the given configuration
19
+ And I have a reading within the given reading group
20
+ And I have a range within the given reading
21
+ When I ask ranges of the given metric configuration
22
+ Then I should get a list with the given range
@@ -0,0 +1,14 @@
1
+ Feature: Save
2
+ In order to be able to use ranges
3
+ As a developer
4
+ I want to save it on kalibro database
5
+
6
+ @kalibro_restart
7
+ Scenario: When there is a metric configuration
8
+ Given I have a configuration with name "Java"
9
+ And I have a reading group with name "Group"
10
+ And I have a metric configuration within the given configuration
11
+ And I have a reading within the given reading group
12
+ And I have an unsaved range within the given reading
13
+ When I ask to save the given range
14
+ Then the id of the given range should be set
@@ -0,0 +1,13 @@
1
+ Feature: Reading listing
2
+ In order to be able to visualize readings
3
+ As a developer
4
+ I want to see all the readings on the service
5
+
6
+ @kalibro_restart
7
+ Scenario: With existing reading group reading
8
+ Given I have a reading group with name "Kalibro"
9
+ And the given reading group has the following readings:
10
+ | label | grade | color |
11
+ | "Awesome" | 10 | 3333FF |
12
+ When I ask for all the readings
13
+ Then the response should contain the given reading
@@ -0,0 +1,13 @@
1
+ Feature: Reading listing
2
+ In order to be able to check know if a reading still exists
3
+ As a developer
4
+ I want to check that on the service
5
+
6
+ @kalibro_restart
7
+ Scenario: With existing reading group reading
8
+ Given I have a reading group with name "RG"
9
+ And the given reading group has the following readings:
10
+ | label | grade | color |
11
+ | "Awesome" | 10 | 3333FF |
12
+ When I ask to check if the given reading exists
13
+ Then I should get true
@@ -0,0 +1,11 @@
1
+ Feature: Find
2
+ In order to be able to have readings
3
+ As an developer
4
+ I want to find reading
5
+
6
+ @kalibro_restart
7
+ Scenario: find a valid reading
8
+ Given I have a reading group with name "Kalibro"
9
+ And I have a reading within the given reading group
10
+ When I ask for a reading with the same id of the given reading
11
+ Then I should get the given reading
@@ -0,0 +1,11 @@
1
+ Feature: Find
2
+ In order to be able to have readings
3
+ As an developer
4
+ I want to get the readings of the given reading group
5
+
6
+ @kalibro_restart
7
+ Scenario: readings of a valid reading group
8
+ Given I have a reading group with name "Kalibro"
9
+ And I have a reading within the given reading group
10
+ When I ask for the readings of the given reading group
11
+ Then I should get a list with the given reading
@@ -0,0 +1,10 @@
1
+ Feature: All
2
+ In order to be able to have reading groups
3
+ As a developer
4
+ I want to get all the available reading groups
5
+
6
+ @kalibro_restart
7
+ Scenario: one reading group
8
+ Given I have a reading group with name "Kalibro"
9
+ When I ask for all the reading groups
10
+ Then I should get a list with the given reading group
@@ -0,0 +1,14 @@
1
+ Feature: Repositories listing
2
+ In order to be able to visualize repositories
3
+ As a developer
4
+ I want to see all the repositories on the service
5
+
6
+ @kalibro_restart
7
+ Scenario: With existing project repository
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And the given project has the following Repositories:
11
+ | name | type | address |
12
+ | "Kalibro" | GIT | https://github.com/mezuro/kalibro.git |
13
+ When I ask for all the repositories
14
+ Then the response should contain the given repository
@@ -0,0 +1,14 @@
1
+ Feature: Process
2
+ In order to be have repositories
3
+ As a developer
4
+ I want to cancel the repository processing
5
+
6
+ @kalibro_restart
7
+ Scenario: With one repository
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And the given project has the following Repositories:
11
+ | name | type | address |
12
+ | "Kalibro" | GIT | https://github.com/mezuro/kalibro.git |
13
+ When I call the cancel_process method for the given repository
14
+ Then I should get success
@@ -0,0 +1,14 @@
1
+ Feature: Repositories listing
2
+ In order to be able to check know if a repository still exists
3
+ As a developer
4
+ I want to check that on the service
5
+
6
+ @kalibro_restart
7
+ Scenario: With existing project repository
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And the given project has the following Repositories:
11
+ | name | type | address |
12
+ | "Kalibro" | GIT | https://github.com/mezuro/kalibro.git |
13
+ When I ask to check if the given repository exists
14
+ Then I should get true
@@ -0,0 +1,14 @@
1
+ Feature: Repositories listing
2
+ In order to be able to visualize a specific repository
3
+ As a developer
4
+ I want to find that repository
5
+
6
+ @kalibro_restart
7
+ Scenario: With existing project repository
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And the given project has the following Repositories:
11
+ | name | type | address |
12
+ | "Kalibro" | GIT | https://github.com/mezuro/kalibro.git |
13
+ When I ask to find the given repository
14
+ Then I should get the given repository
@@ -0,0 +1,15 @@
1
+ Feature: Repositories listing
2
+ In order to be able to visualize repositories
3
+ As a developer
4
+ I want to see all the repository from a given project
5
+
6
+ @kalibro_restart
7
+ Scenario: With existing project repository
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And the given project has the following Repositories:
11
+ | name | type | address |
12
+ | "Kalibro" | GIT | https://github.com/mezuro/kalibro.git |
13
+ When I ask for repositories from the given project
14
+ Then I should get a list with the given repository
15
+ And the repositories should contain the project id
@@ -0,0 +1,16 @@
1
+ Feature: Process
2
+ In order to be have repositories
3
+ As a developer
4
+ I want to start the repository processing
5
+
6
+ @kalibro_restart
7
+ Scenario: With one repository
8
+ Given I have a project with name "Kalibro"
9
+ And I have a configuration with name "Java"
10
+ And I have a reading group with name "Group"
11
+ And I have a metric configuration within the given configuration
12
+ And the given project has the following Repositories:
13
+ | name | type | address |
14
+ | Kalibro | GIT | https://github.com/mezuro/kalibro.git |
15
+ When I call the process method for the given repository
16
+ Then I should get success
@@ -0,0 +1,9 @@
1
+ Feature: Types listing
2
+ In order to be able to create repositories
3
+ As a developer
4
+ I want to see all the repository types available
5
+
6
+ @kalibro_restart
7
+ Scenario: listing the types
8
+ When I list types
9
+ Then I should get an array of types
@@ -0,0 +1,28 @@
1
+ When(/^I get all base tool names$/) do
2
+ @base_tool_names = KalibroGatekeeperClient::Entities::BaseTool.all_names
3
+ end
4
+
5
+ When(/^I search base tool Analizo by name$/) do
6
+ @result = KalibroGatekeeperClient::Entities::BaseTool.find_by_name("Analizo")
7
+ end
8
+
9
+ When(/^I search base tool Avalio by name$/) do
10
+ @is_error = false
11
+ begin
12
+ KalibroGatekeeperClient::Entities::BaseTool.find_by_name("Avalio")
13
+ rescue KalibroGatekeeperClient::Errors::RecordNotFound
14
+ @is_error = true
15
+ end
16
+ end
17
+
18
+ Then(/^it should return Checkstyle and Analizo strings inside of an array$/) do
19
+ (@base_tool_names.include?("Checkstyle") && @base_tool_names.include?("Analizo")).should be_true
20
+ end
21
+
22
+ Then(/^I should get Analizo base tool$/) do
23
+ @result.name.should eq "Analizo"
24
+ end
25
+
26
+ Then(/^I should get an error$/) do
27
+ @is_error.should be_true
28
+ end
@@ -0,0 +1,11 @@
1
+ Given(/^I have a configuration with name "(.*?)"$/) do |name|
2
+ @configuration = FactoryGirl.create(:configuration, {name: name, id: nil})
3
+ end
4
+
5
+ When(/^I get all the configurations$/) do
6
+ @all_configurations = KalibroGatekeeperClient::Entities::Configuration.all
7
+ end
8
+
9
+ Then(/^I should get a list with the given configuration$/) do
10
+ @all_configurations.include?(@configuration).should be_true
11
+ end
@@ -0,0 +1,52 @@
1
+ Given(/^I have a metric configuration within the given configuration$/) do
2
+ @metric_configuration = FactoryGirl.create(:metric_configuration,
3
+ {id: nil,
4
+ reading_group_id: @reading_group.id,
5
+ configuration_id: @configuration.id})
6
+ end
7
+
8
+ Given(/^I have a metric configuration within the given configuration with the given metric$/) do
9
+ @metric_configuration = FactoryGirl.create(:metric_configuration,
10
+ {id: nil,
11
+ metric: @metric,
12
+ reading_group_id: @reading_group.id,
13
+ configuration_id: @configuration.id})
14
+ end
15
+
16
+ Given(/^I have a loc configuration within the given configuration$/) do
17
+ @metric_configuration = FactoryGirl.create(:metric_configuration,
18
+ {id: nil,
19
+ metric: FactoryGirl.create(:loc),
20
+ reading_group_id: @reading_group.id,
21
+ configuration_id: @configuration.id})
22
+ end
23
+
24
+ When(/^I search a metric configuration with the same id of the given metric configuration$/) do
25
+ @found_metric_configuration = KalibroGatekeeperClient::Entities::MetricConfiguration.find(@metric_configuration.id)
26
+ end
27
+
28
+ When(/^I search an inexistent metric configuration$/) do
29
+ @is_error = false
30
+ inexistent_id = rand(Time.now.to_i)
31
+ begin
32
+ KalibroGatekeeperClient::Entities::MetricConfiguration.find(inexistent_id)
33
+ rescue KalibroGatekeeperClient::Errors::RecordNotFound
34
+ @is_error = true
35
+ end
36
+ end
37
+
38
+ When(/^I request all metric configurations of the given configuration$/) do
39
+ @metric_configurations = KalibroGatekeeperClient::Entities::MetricConfiguration.metric_configurations_of(@configuration.id)
40
+ end
41
+
42
+ Then(/^it should return the same metric configuration as the given one$/) do
43
+ @found_metric_configuration == @metric_configuration
44
+ end
45
+
46
+ Then(/^I should get a list of its metric configurations$/) do
47
+ @metric_configurations == [@metric_configuration]
48
+ end
49
+
50
+ Then(/^I should get an empty list of metric configurations$/) do
51
+ @metric_configurations == []
52
+ end
@@ -0,0 +1,29 @@
1
+ When(/^I call the metric results of method with the results root id of the given processing$/) do
2
+ @response = KalibroGatekeeperClient::Entities::MetricResult.metric_results_of(@response.results_root_id)
3
+ end
4
+
5
+ Given(/^I search a metric result with descendant results for the given metric result$/) do
6
+ first_module_result = KalibroGatekeeperClient::Entities::ModuleResult.find(@response.results_root_id)
7
+
8
+ metric_results = KalibroGatekeeperClient::Entities::MetricResult.metric_results_of(first_module_result.id)
9
+ @response = metric_results.first.descendant_results
10
+ end
11
+
12
+ When(/^I call the history of method with the metric name and the results root id of the given processing$/) do
13
+ @response = KalibroGatekeeperClient::Entities::MetricResult.history_of(@metric.name, @response.results_root_id)
14
+ end
15
+
16
+ Then (/^I should get a Float list$/) do
17
+ @response.should be_a(Array)
18
+ @response.first.should be_a(Float)
19
+ end
20
+
21
+ Then(/^I should get a list of metric results$/) do
22
+ @response.should be_a(Array)
23
+ @response.first.should be_a(KalibroGatekeeperClient::Entities::MetricResult)
24
+ end
25
+
26
+ Then(/^I should get a list of date metric results$/) do
27
+ @response.should be_a(Array)
28
+ @response.first.should be_a(KalibroGatekeeperClient::Entities::DateMetricResult)
29
+ end
@@ -0,0 +1,3 @@
1
+ Given(/^I have a metric with name "(.*?)"$/) do |name|
2
+ @metric = FactoryGirl.create(:metric, {name: name})
3
+ end
@@ -0,0 +1,30 @@
1
+ Given(/^I have a module result$/) do
2
+ Pending
3
+ @module_result = FactoryGirl.create(:module_result)
4
+ end
5
+
6
+ When(/^I ask a module result with the same id of the given module result$/) do
7
+ @found_module_result = KalibroGatekeeperClient::Entities::ModuleResult.find(@module_result.id)
8
+ end
9
+
10
+ When(/^I ask for an inexistent module result$/) do
11
+ @is_error = false
12
+ begin
13
+ KalibroGatekeeperClient::Entities::ModuleResult.find(-1)
14
+ rescue KalibroGatekeeperClient::Errors::RecordNotFound
15
+ @is_error = true
16
+ end
17
+ end
18
+
19
+ Then(/^I should get the given module result$/) do
20
+ @found_module_result == @module_result
21
+ end
22
+
23
+ When(/^I ask for the children of the processing root module result$/) do
24
+ @children = KalibroGatekeeperClient::Entities::ModuleResult.
25
+ find(KalibroGatekeeperClient::Entities::Processing.processing_of(@repository.id).results_root_id)
26
+ end
27
+
28
+ Then(/^I should get a list with the children module results$/) do
29
+ @children.should be_a(KalibroGatekeeperClient::Entities::ModuleResult)
30
+ end
@@ -0,0 +1,91 @@
1
+ Given(/^I wait up to (\d+) seconds$/) do |seconds|
2
+ sleep(seconds.to_i)
3
+ end
4
+
5
+ Given(/^I wait up for a ready processing$/) do
6
+ unless KalibroGatekeeperClient::Entities::Processing.has_ready_processing(@repository.id)
7
+ while(true)
8
+ if KalibroGatekeeperClient::Entities::Processing.has_ready_processing(@repository.id)
9
+ break
10
+ else
11
+ sleep(10)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ When(/^I call the has_processing for the given repository$/) do
18
+ @response = KalibroGatekeeperClient::Entities::Processing.has_processing(@repository.id)
19
+ end
20
+
21
+ When(/^I call the has_ready_processing for the given repository$/) do
22
+ @response = KalibroGatekeeperClient::Entities::Processing.has_ready_processing(@repository.id)
23
+ end
24
+
25
+ When(/^I call the has_processing_after for the given repository with yerterday's date$/) do
26
+ @response = KalibroGatekeeperClient::Entities::Processing.has_processing_after(@repository.id, DateTime.now - 1)
27
+ end
28
+
29
+ When(/^I call the has_processing_before for the given repository with tomorrows's date$/) do
30
+ @response = KalibroGatekeeperClient::Entities::Processing.has_processing_before(@repository.id, DateTime.now + 1)
31
+ end
32
+
33
+ When(/^I call the last_processing_state_of method for the given repository$/) do
34
+ @response = KalibroGatekeeperClient::Entities::Processing.last_processing_state_of(@repository.id)
35
+ end
36
+
37
+ When(/^I call the last_ready_processing_of method for the given repository$/) do
38
+ @response = KalibroGatekeeperClient::Entities::Processing.last_ready_processing_of(@repository.id)
39
+ end
40
+
41
+ When(/^I call the first_processing_of method for the given repository$/) do
42
+ @response = KalibroGatekeeperClient::Entities::Processing.first_processing_of(@repository.id)
43
+ end
44
+
45
+ When(/^I call the last_processing_of method for the given repository$/) do
46
+ @response = KalibroGatekeeperClient::Entities::Processing.last_processing_of(@repository.id)
47
+ end
48
+
49
+ When(/^I call the first_processing_after method for the given repository and yesterday's date$/) do
50
+ @response = KalibroGatekeeperClient::Entities::Processing.first_processing_after(@repository.id, DateTime.now - 1)
51
+ end
52
+
53
+ When(/^I call the last_processing_before method for the given repository and tomorrow's date$/) do
54
+ @response = KalibroGatekeeperClient::Entities::Processing.last_processing_before(@repository.id, DateTime.now + 1)
55
+ end
56
+
57
+ When(/^I call the processing_of method for the given repository$/) do
58
+ @response = KalibroGatekeeperClient::Entities::Processing.processing_of(@repository.id)
59
+ end
60
+
61
+ When(/^I call the processing_with_date_of method for the given repository and tomorrow's date$/) do
62
+ @response = KalibroGatekeeperClient::Entities::Processing.processing_with_date_of(@repository.id, DateTime.now + 1)
63
+ end
64
+
65
+ When(/^I call the processing_with_date_of method for the given repository and yesterday's date$/) do
66
+ @response = KalibroGatekeeperClient::Entities::Processing.processing_with_date_of(@repository.id, DateTime.now - 1)
67
+ end
68
+
69
+ Then(/^I should get a Processing with state "(.*?)"$/) do |state|
70
+ @response.state.should eq(state)
71
+ end
72
+
73
+ Then(/^I should get nil$/) do
74
+ @response.should be_nil
75
+ end
76
+
77
+ Then(/^I should get "(.*?)"$/) do |state|
78
+ @response.should eq(state)
79
+ end
80
+
81
+ Then(/^I should get false$/) do
82
+ @response.should be_false
83
+ end
84
+
85
+ Then(/^I should get true$/) do
86
+ @response.should be_true
87
+ end
88
+
89
+ Then(/^I should get a Processing$/) do
90
+ @response.should be_a(KalibroGatekeeperClient::Entities::Processing)
91
+ end