From a8f3a260fc5d68da412212e43f3e37d45b9b96fe Mon Sep 17 00:00:00 2001 From: Rafael Reggiani Manzo Date: Tue, 5 Aug 2014 14:23:52 -0300 Subject: [PATCH] Updated KalibroGatekeeperClient (Using KalibroProcessor) --- .gitignore | 1 + .travis.yml | 24 ++++++++++++++++++++---- Gemfile | 2 +- Gemfile.lock | 4 ++-- config/deploy.rb | 1 + config/kalibro_processor.yml.sample | 1 + features/metric_configuration/create.feature | 6 ------ features/project/create.feature | 6 ++---- features/project/deletion.feature | 6 +++--- features/project/edition.feature | 16 ++++++++-------- features/project/listing.feature | 6 +++--- features/project/show.feature | 10 +++++----- features/repository/create.feature | 6 +++--- features/repository/delete.feature | 2 +- features/repository/edit.feature | 6 +++--- features/repository/show/date_select.feature | 2 +- features/repository/show/metric_results.feature | 2 +- features/repository/show/modules_tree.feature | 6 +++--- features/repository/show/repository_info.feature | 19 +++++++++++-------- features/step_definitions/repository_steps.rb | 3 ++- features/users/user_projects.feature | 2 +- 21 files changed, 73 insertions(+), 58 deletions(-) create mode 100644 config/kalibro_processor.yml.sample diff --git a/.gitignore b/.gitignore index fbbf3b5..53ec4b3 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ coverage database.yml database.yml~ kalibro.yml +kalibro_processor.yml kalibro_cucumber_helpers.yml KalibroService.tar.gz KalibroService/ diff --git a/.travis.yml b/.travis.yml index 77ae55a..b2e8215 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ rvm: before_script: - "cp config/database.yml.sample config/database.yml" + - "cp config/kalibro_processor.yml.sample config/kalibro_processor.yml" - "bundle exec rake db:migrate RAILS_ENV=test" - git clone https://gist.github.com/0c4ad3b5700c6364abf1.git -b v1.0 kalibro_install - pushd kalibro_install @@ -12,13 +13,28 @@ before_script: - bash install.sh - popd - cp features/support/kalibro_cucumber_helpers.yml.sample features/support/kalibro_cucumber_helpers.yml - - git clone https://github.com/mezuro/kalibro_gatekeeper.git -b v0.0.1 kalibro_gatekeeper - - pushd kalibro_gatekeeper + # Gatekeeper + - git clone https://github.com/mezuro/kalibro_gatekeeper.git -b v0.1.1 kalibro_gatekeeper + - cd kalibro_gatekeeper - cp config/database.yml.sample config/database.yml + - cp config/kalibro_processor.yml.sample config/kalibro_processor.yml - export BUNDLE_GEMFILE=$PWD/Gemfile - bundle install - - bundle exec rails s -p 8081 -d - - popd + - RAILS_ENV=local bundle exec rails s -p 8081 -d + - cd .. + - export BUNDLE_GEMFILE=$PWD/Gemfile + # Processor + - git clone https://github.com/mezuro/kalibro_processor.git -b v0.0.2 kalibro_processor + - cd kalibro_processor + - psql -c "create role kalibro_processor with createdb login password 'kalibro_processor'" -U postgres + - cp config/database.yml.postgresql_sample config/database.yml + - cp config/repositories.yml.sample config/repositories.yml + - export BUNDLE_GEMFILE=$PWD/Gemfile + - bundle install + - bundle exec rake db:setup db:migrate + - bundle exec rails s -p 8082 -d + - bundle exec bin/delayed_job start + - cd .. - export BUNDLE_GEMFILE=$PWD/Gemfile script: diff --git a/Gemfile b/Gemfile index b23f62b..d4967f6 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,7 @@ gem 'jbuilder', '~> 2.1.2' gem 'devise', '~> 3.2.4' # Kalibro integration -gem 'kalibro_gatekeeper_client', "~> 0.1.0" +gem 'kalibro_gatekeeper_client', "~> 0.2.1" # PostgreSQL integration gem "pg", "~> 0.17.0" diff --git a/Gemfile.lock b/Gemfile.lock index 7aa735f..b21f953 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -130,7 +130,7 @@ GEM jquery-ui-rails (4.2.1) railties (>= 3.2.16) json (1.8.1) - kalibro_gatekeeper_client (0.1.1) + kalibro_gatekeeper_client (0.2.1) activesupport (>= 2.2.1) faraday_middleware (~> 0.9.0) konacha (3.2.3) @@ -284,7 +284,7 @@ DEPENDENCIES jbuilder (~> 2.1.2) jquery-rails jquery-ui-rails (~> 4.2.1) - kalibro_gatekeeper_client (~> 0.1.0) + kalibro_gatekeeper_client (~> 0.2.1) konacha (~> 3.2.0) mocha pg (~> 0.17.0) diff --git a/config/deploy.rb b/config/deploy.rb index f5ebb3e..057b0f3 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -48,6 +48,7 @@ namespace :deploy do on roles(:web) do execute "ln -s #{File.join(deploy_to, 'shared', 'config/database.yml')} #{File.join(release_path, 'config/database.yml')}" execute "ln -s #{File.join(deploy_to, 'shared', 'config/kalibro_gatekeeper.yml')} #{File.join(release_path, 'config/kalibro_gatekeeper.yml')}" + execute "ln -s #{File.join(deploy_to, 'shared', 'config/kalibro_processor.yml')} #{File.join(release_path, 'config/kalibro_processor.yml')}" end end diff --git a/config/kalibro_processor.yml.sample b/config/kalibro_processor.yml.sample new file mode 100644 index 0000000..fc12184 --- /dev/null +++ b/config/kalibro_processor.yml.sample @@ -0,0 +1 @@ +address: http://localhost:8082 \ No newline at end of file diff --git a/features/metric_configuration/create.feature b/features/metric_configuration/create.feature index abd7293..5522160 100644 --- a/features/metric_configuration/create.feature +++ b/features/metric_configuration/create.feature @@ -40,9 +40,3 @@ Feature: Metric Configuration Creation And I click the Total Lines of Code link When I click the Back link Then I should be at the choose metric page - # Checks for error loading metrics with '' characters - When I click the "Checkstyle" h3 - And I click the Average 'if' Depth link - And I wait for "1" seconds - Then I should see "Average nested depth of all 'if-else' blocks. Default maximum: 1." - diff --git a/features/project/create.feature b/features/project/create.feature index f8c259f..5360f89 100644 --- a/features/project/create.feature +++ b/features/project/create.feature @@ -3,12 +3,11 @@ Feature: Project Creation As a regular user I should be able to create projects - @kalibro_restart Scenario: Should not create project without login Given I am at the All Projects page Then I should not see New Project - @kalibro_restart + @kalibro_processor_restart Scenario: project creation Given I am a regular user And I am signed in @@ -19,7 +18,7 @@ Feature: Project Creation Then I should see "Kalibro" And I should see "Web Service to collect metrics" - @kalibro_restart + @kalibro_processor_restart Scenario: project creation with already taken name Given I am a regular user And I am signed in @@ -30,7 +29,6 @@ Feature: Project Creation When I press the Save button Then I should see "There's already" - @kalibro_restart Scenario: project creation with blank name Given I am a regular user And I am signed in diff --git a/features/project/deletion.feature b/features/project/deletion.feature index d3b66bb..8104660 100644 --- a/features/project/deletion.feature +++ b/features/project/deletion.feature @@ -3,13 +3,13 @@ Feature: Project Deletion As a regular user The system should have an interface to it - @kalibro_restart + @kalibro_processor_restart Scenario: Should not delete a project without user authetication Given I have a sample project When I am at the Sample Project page Then I should not see Destroy - @kalibro_restart + @kalibro_processor_restart Scenario: Should not delete a project that doesn't belongs to user Given I am a regular user And I am signed in @@ -17,7 +17,7 @@ Feature: Project Deletion When I am at the Sample Project page Then I should not see Destroy - @kalibro_restart + @kalibro_processor_restart Scenario: Should delete a project that I own Given I am a regular user And I am signed in diff --git a/features/project/edition.feature b/features/project/edition.feature index d2d3881..7d5b355 100644 --- a/features/project/edition.feature +++ b/features/project/edition.feature @@ -3,7 +3,7 @@ Feature: Project As a regular user I should be able to edit my projects - @kalibro_restarts + @kalibro_processor_restart Scenario: Should go to the edit page from a project that I own Given I am a regular user And I am signed in @@ -12,7 +12,7 @@ Feature: Project When I click the Edit link Then I should be in the Edit Project page - @kalibro_restart + @kalibro_processor_restart Scenario: Should not show edit links from projects that doesn't belongs to me Given I am a regular user And I am signed in @@ -20,7 +20,7 @@ Feature: Project And I am at the All Projects page Then I should not see "Edit" within "table tr td" - @kalibro_restart + @kalibro_processor_restart Scenario: Should not render the edit page if the project doesn't belongs to the current user Given I am a regular user And I am signed in @@ -29,7 +29,7 @@ Feature: Project When I visit the sample project edit page Then I should see "You're not allowed to do this operation" - @kalibro_restart + @kalibro_processor_restart Scenario: Filling up the form Given I am a regular user And I am signed in @@ -39,7 +39,7 @@ Feature: Project Then The field "project[name]" should be filled with the sample project "name" And The field "project[description]" should be filled with the sample project "description" - @kalibro_restart + @kalibro_processor_restart Scenario: With valid attributes Given I am a regular user And I am signed in @@ -51,7 +51,7 @@ Feature: Project Then I should see "Kalibro" And I should see "Web Service to collect metrics" - @kalibro_restart + @kalibro_processor_restart Scenario: With project name already taken Given I am a regular user And I am signed in @@ -62,7 +62,7 @@ Feature: Project When I press the Save button Then I should see "There's already" - @kalibro_restart + @kalibro_processor_restart Scenario: Editing just the description Given I am a regular user And I am signed in @@ -72,7 +72,7 @@ Feature: Project When I press the Save button And I should see "Web Service to collect metrics" - @kalibro_restart + @kalibro_processor_restart Scenario: With blank project name Given I am a regular user And I am signed in diff --git a/features/project/listing.feature b/features/project/listing.feature index da724a3..79471c0 100644 --- a/features/project/listing.feature +++ b/features/project/listing.feature @@ -3,7 +3,7 @@ Feature: Project listing As a regular user I should have various listings - Scenario: Listing projects + Scenario: Listing projects Given I am at the homepage When I click the Project link Then I should see "Projects" @@ -11,7 +11,7 @@ Feature: Project listing And I should see "Description" And I should see "To create new projects you must be logged in page." - @kalibro_restart + @kalibro_processor_restart Scenario: Should list the existing projects Given I am a regular user And I am signed in @@ -20,7 +20,7 @@ Feature: Project listing Then the sample project should be there And I should not see "To create new projects you must be logged in page." - @kalibro_restart + @kalibro_processor_restart Scenario: Should show the existing project Given I am a regular user And I am signed in diff --git a/features/project/show.feature b/features/project/show.feature index f487ef2..61e8820 100644 --- a/features/project/show.feature +++ b/features/project/show.feature @@ -3,7 +3,7 @@ Feature: Show Project As a regular user I should be able to see each of them -@kalibro_restart +@kalibro_restart @kalibro_processor_restart Scenario: Should not show the create repository link to user that doesn't own the project Given I am a regular user And I have a sample project @@ -14,7 +14,7 @@ Scenario: Should not show the create repository link to user that doesn't own th And I should not see Destroy project And I should not see Edit -@kalibro_restart +@kalibro_processor_restart Scenario: Should show the create repository link the project owner Given I am a regular user And I am signed in @@ -23,13 +23,13 @@ Scenario: Should show the create repository link the project owner Then I should see "New Repository" -@kalibro_restart +@kalibro_processor_restart Scenario: Considering the project has no repositories Given I have a sample project When I am at the Sample Project page Then I should see "There are no repositories yet!" -@kalibro_restart +@kalibro_restart @kalibro_processor_restart Scenario: Considering the project has repositories Given I have a sample project And I have a sample configuration with native metrics @@ -37,7 +37,7 @@ Scenario: Considering the project has repositories When I am at the Sample Project page Then I should not see There are no repositories yet! -@kalibro_restart +@kalibro_processor_restart Scenario: Checking project contents Given I have a sample project When I am at the Sample Project page diff --git a/features/repository/create.feature b/features/repository/create.feature index 3b3cf35..e50c18a 100644 --- a/features/repository/create.feature +++ b/features/repository/create.feature @@ -3,7 +3,7 @@ Feature: Repository Creation As a regular user I should be able to create repositories -@kalibro_restart @javascript +@kalibro_restart @kalibro_processor_restart @javascript Scenario: repository creation Given I am a regular user And I am signed in @@ -20,7 +20,7 @@ Scenario: repository creation When I press the Save button Then I should see the saved repository's content -@kalibro_restart @javascript +@kalibro_restart @kalibro_processor_restart @javascript Scenario: repository creation blank validations Given I am a regular user And I am signed in @@ -35,7 +35,7 @@ Scenario: repository creation blank validations Then I should see "Name can't be blank" And I should see "Address can't be blank" -@kalibro_restart @javascript +@kalibro_restart @kalibro_processor_restart @javascript Scenario: repository creation with name already taken Given I am a regular user And I am signed in diff --git a/features/repository/delete.feature b/features/repository/delete.feature index 8c0262d..a636292 100644 --- a/features/repository/delete.feature +++ b/features/repository/delete.feature @@ -3,7 +3,7 @@ Feature: Project Deletion As a regular user The system should have an interface to it - @kalibro_restart + @kalibro_restart @kalibro_processor_restart Scenario: Should delete a project that I own Given I am a regular user And I am signed in diff --git a/features/repository/edit.feature b/features/repository/edit.feature index 396803a..4efde7c 100644 --- a/features/repository/edit.feature +++ b/features/repository/edit.feature @@ -3,7 +3,7 @@ Feature: Repository Edit As a regular user I should be able to edit my repositories - @kalibro_restart + @kalibro_restart @kalibro_processor_restart Scenario: editing a repository successfully Given I am a regular user And I am signed in @@ -25,7 +25,7 @@ Feature: Repository Edit And I should see "Weekly" And I should see "EU DataGrid Software License (EUDatagrid)" - @kalibro_restart + @kalibro_restart @kalibro_processor_restart Scenario: editing a repository with blank fields Given I am a regular user And I am signed in @@ -39,7 +39,7 @@ Feature: Repository Edit Then I should see "Name can't be blank" And I should see "Address can't be blank" - @kalibro_restart + @kalibro_restart @kalibro_processor_restart Scenario: editing a repository with already taken name Given I am a regular user And I am signed in diff --git a/features/repository/show/date_select.feature b/features/repository/show/date_select.feature index f2b6eea..51b865d 100644 --- a/features/repository/show/date_select.feature +++ b/features/repository/show/date_select.feature @@ -3,7 +3,7 @@ Feature: Date Select As a regular user I should be able to select a specific date - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: With a specific date selected Given I have a sample project And I have a sample configuration with native metrics diff --git a/features/repository/show/metric_results.feature b/features/repository/show/metric_results.feature index 0676ffb..901acd3 100644 --- a/features/repository/show/metric_results.feature +++ b/features/repository/show/metric_results.feature @@ -3,7 +3,7 @@ Feature: Repository metric results As a regular user I should see the metric results table with its graphics - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: Should show the message when the graphic of the given metric have only a single point Given I am a regular user And I am signed in diff --git a/features/repository/show/modules_tree.feature b/features/repository/show/modules_tree.feature index 3e9f88c..e06711a 100644 --- a/features/repository/show/modules_tree.feature +++ b/features/repository/show/modules_tree.feature @@ -3,7 +3,7 @@ Feature: Repository modules tree As a regular user I should see the tree and be able to navigate over it - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: Should show modules directories root when the process has been finished Given I am a regular user And I am signed in @@ -17,7 +17,7 @@ Feature: Repository modules tree When I visit the repository show page Then I should see the given module result - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: Should show children of root when the process has been finished Given I am a regular user And I am signed in @@ -36,7 +36,7 @@ Feature: Repository modules tree And I should see "Granularity" And I should see "Grade" - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: Module navigation Given I am a regular user And I am signed in diff --git a/features/repository/show/repository_info.feature b/features/repository/show/repository_info.feature index cb22dd1..9703bf3 100644 --- a/features/repository/show/repository_info.feature +++ b/features/repository/show/repository_info.feature @@ -3,7 +3,7 @@ Feature: Show Repository As a regular user I should see it's informations - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: Testing the repository values Given I have a sample project And I have a sample configuration with native metrics @@ -19,7 +19,7 @@ Feature: Show Repository And I should see "License" And I should see the given repository's content - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: With a ready processing and asking to reprocess Given I am a regular user And I am signed in @@ -32,9 +32,12 @@ Feature: Show Repository Then I should see the sample repository name And I should see "State" And I should see "Creation date" - And I should see "LOADING time" + And I should see "PREPARING time" And I should see "COLLECTING time" - And I should see "ANALYZING time" + And I should see "BUILDING time" + And I should see "AGGREGATING time" + And I should see "CALCULATING time" + And I should see "INTERPRETATING time" When I click the "Metric Results" h3 And I click the "Modules Tree" h3 Then I should see "Metric" @@ -45,9 +48,9 @@ Feature: Show Repository And I should see "Granularity" And I should see "Grade" When I click the Reprocess link - Then I should see "LOADING" + Then I should see "PREPARING" - @kalibro_restart @javascript + @kalibro_restart @kalibro_processor_restart @javascript Scenario: Just after start to process Given I am a regular user And I am signed in @@ -57,7 +60,7 @@ Feature: Show Repository And I start to process that repository When I visit the repository show page Then I should see the sample repository name - And I should see "LOADING" + And I should see "PREPARING" And I should see "Address" And I should see "Configuration" And I should see "State" @@ -67,5 +70,5 @@ Feature: Show Repository When I click the "Modules Tree" h3 Then I should see "Loading data. Please, wait." And I wait for "75" seconds or until I see "COLLECTING" - And I wait for "60" seconds or until I see "ANALYZING" + And I wait for "60" seconds or until I see "AGGREGATING" And I wait for "400" seconds or until I see "READY" diff --git a/features/step_definitions/repository_steps.rb b/features/step_definitions/repository_steps.rb index 7cbb631..c1e5ff7 100644 --- a/features/step_definitions/repository_steps.rb +++ b/features/step_definitions/repository_steps.rb @@ -6,7 +6,8 @@ Given(/^I have a sample configuration with native metrics$/) do {id: nil, metric: FactoryGirl.build(:loc), reading_group_id: reading_group.id, - configuration_id: @configuration.id}) + configuration_id: @configuration.id, + code: 'loc'}) range = FactoryGirl.build(:mezuro_range, {id: nil, reading_id: reading.id, beginning: '-INF', :end => 'INF', metric_configuration_id: metric_configuration.id}) range.save end diff --git a/features/users/user_projects.feature b/features/users/user_projects.feature index da76ff6..5a2716e 100644 --- a/features/users/user_projects.feature +++ b/features/users/user_projects.feature @@ -3,7 +3,7 @@ Feature: User projects list As a regular user I want to have a page with a list of my projects - @kalibro_restart + @kalibro_processor_restart Scenario: with current password Given I am a regular user And I own a sample project -- libgit2 0.21.2