diff --git a/plugins/mezuro/AUTHORS b/plugins/mezuro/AUTHORS deleted file mode 100644 index b344249..0000000 --- a/plugins/mezuro/AUTHORS +++ /dev/null @@ -1,42 +0,0 @@ -Mezuro Authors -============== - -Copyright 2010-2013 -------------------- - - Almir Alves Pereira (almir.sne at gmail.com) - Alessandro Palmeira (alessandro.palmeira at gmail.com) - Andre Casimiro (ah.casimiro at gmail.com) - Antonio Terceiro (terceiro at colivre.coop.br) - Caio Salgado (caio.csalgado at gmail.com) - Carlos Morais (carlos88morais at gmail.com) - Daniel Alves (danpaulalves at gmail.com) - Daniela Feitosa (daniela at colivre.coop.br) - Diego Araújo (diegoamc90 at gmail.com) - Everton Santos (everton2x4 at gmail.com) - Guilherme Rojas (guilhermehrojas at gmail.com) - Jefferson Fernandes (jeffs.fernandes at gmail.com) - Joao Machini (joao.machini at gmail.com) - João da Silva (jaodsilv@linux.ime.usp.br) - Paulo Meirelles (paulo at softwarelivre.org) - Pedro Leal (pedrombl at gmail.com) - Rafael Manso (rr.manzo at gmail.com) - Rafael Messias (rmmartins at gmail.com) - Renan Teruo (renanteruoc at gmail.com) - Rodrigo Souto (rodrigo at colivre.coop.br) - -Collaborators (from USP Lab XP course 2010 on another code) ------------------------------------------------------------ - - Ana Paula Oliveira dos Santos (anapaulao.santos at gmail.com) - Lucianna Almeida (lucianna.th at gmail.com) - Thiago Colucci (ticolucci at gmail.com) - Vinicius Daros (vinicius.k.daros at gmail.com) - Viviane Almeida Santos (viviane.almeida at gmail.com) - -Advisors --------- - - Fabio Kon (fabio.kon at ime.usp.br) - Alfredo Goldman (gold at ime.usp.br) - diff --git a/plugins/mezuro/README.md b/plugins/mezuro/README.md deleted file mode 100644 index e50092e..0000000 --- a/plugins/mezuro/README.md +++ /dev/null @@ -1,144 +0,0 @@ -README - Mezuro Plugin -====================== - -Mezuro is a source code tracking platform based on Noosfero social networking -platform with Mezuro Plugin actived to access Kalibro Web Service. - - -INSTALL -======= - -Dependences ------------ - -See the Noosfero INSTALL (and HACKING) file. After install Noosfero, you must -install Mezuro dependences: - -$ gem install --no-ri --no-rdoc nokogiri -v 1.5.0 -$ gem install --no-ri --no-rdoc wasabi -v 2.0.0 -$ gem install --no-ri --no-rdoc savon -v 0.9.7 -$ gem install --no-ri --no-rdoc googlecharts - -$ gem uninstall rack -$ gem install --no-ri --no-rdoc rack -v 1.0.1 - - -*with RVM* - -if you want to use RVM (Ruby Version Manager) environment, just run: - -$ plugins/mezuro/script/install/install-rvm.sh - - -Enable Mezuro Plugin --------------------- - -Also, you need to enable Mezuro Plugin at your Noosfero installation: - -cd -./script/noosfero-plugins enable mezuro - - -Install Service ---------------- - -To run Mezuro (Noosfero with Mezuro Plugin), you need to install the Kalibro -Service. For that, see: -https://gitorious.org/kalibro/kalibro/blobs/master/INSTALL - - -Configure Service Address -------------------------- - -Addictionaly, copy service.yml.example to service.yml and define your Kalibro -Service address: - -$ cd /plugin/mezuro -$ cp service.yml.example service.yml - -If you install Kalibro Service at localhost, just keep the default -adress: - -http://localhost:8080/KalibroService/ - - -Set Licences list ------------------ - -$ cd /plugin/mezuro -$ cp licence.yml.example licence.yml - - -Apply Mezuro Theme ---------------------- - -(Our RVM install script already do that) - -If you want, you can use the Mezuro default theme: - -$ cd public/designs/themes && rm -f default -$ git clone git://gitorious.org/mezuro/mezuro-theme.git -$ ln -s mezuro-theme/ default && cd ../../../ - - -Active Mezuro Plugin on Noosfero Environment --------------------------------------------- - -As a Noosfero administrator user, go to administrator panel: - -- Click on "Enable/disable plugins" option -- Click on "Mezuro Plugin" check-box - - -DEVELOPMENT -=========== - -Get the Mezuro (Noosfero with Mezuro Plugin) development repository: - -$ git clone https://gitorious.org/+mezuro/noosfero/mezuro -$ cd mezuro -$ git checkout mezuro - -Running Mezuro tests --------------------- - -$ rake test:noosfero_plugins:mezuro - -or just: - -$ rake test:noosfero_plugin_mezuro:units -$ rake test:noosfero_plugin:mezuro:functionals - - -Get Involved -============ - -If you found any bug and/or want to collaborate, please send an e-mail to -paulo@softwarelivre.org - - -LICENSE -======= - -Copyright (c) The Author developers. - -See Noosfero license. - - -AUTHORS -======= - -Please, see the Mezuro AUTHORS file. - - -ACKNOWLEDGMENTS -=============== - -The authors have been supported by organizations: - -University of São Paulo (USP) -FLOSS Competence Center -http://ccsl.ime.usp.br - -Brazilian National Research Council (CNPQ) -http://www.cnpq.br/ diff --git a/plugins/mezuro/TODO b/plugins/mezuro/TODO deleted file mode 100644 index 9e61a68..0000000 --- a/plugins/mezuro/TODO +++ /dev/null @@ -1,73 +0,0 @@ -README/TODO do branch cucumber_tests - -Tarefas: -- Escrever uma história (procurar uma já escrita) para isso -- Descobrir o porquê dos erros nos testes do mezuro (repository_url) -- Dar rebase com o mezuro-dev (os tais testes passam no mezuro-dev) -- Fazer mais testes -- Ver como/quando o selenium pode ser integrado ao projeto (conversar com noosfero/ talvez até tentar implementar alguma coisa??) - - -Testes de aceitação a serem feitos: (* já feito) - -Projetos: - Criar - * correto - * errado - duplicado - Editar - correto - errado - Deletar(não precisa fazer - problema do noosfero) - -Configurações: - criar - *correta - *errado (sem titulo) - *duplicada - editar - verificar se mantem as metricas - correto - não é possível mudar o titulo - deletar (não precisa fazer - problema do noosfero) - metricas: - criar - nativa: - *correta - *errada - duplicada (é pra funcionar?) - composta: - *correta - errada - duplicada - editar - para metrica correta - para metrica errada - *deletar - ranges: - criar - *range correto - range errado - todos os casos - editar - para range correto - para range errado - deletar - -Testes falhando: - -Arquivo adding_metric_configuration.feature: - Scenario: adding a native metric configuration without code - Precisa do selenium para ver em qual página está. - Scenario: adding a compound metric configuration - Scenario: adding a compound metric configuration with invalid script - As métricas compostas não estão salvando direito. - - -Arquivo creating_project.feature: - Scenario: I create a Kalibro project with valid attributes - ás vezes falha por erro de já existir na Kalibro. Esse erro teóricamente já havia sido resolvido. - - -Arquivo adding_ranges.feature: - Scenario: adding a range to a metric configuration - Precisa do selenium para esperar a página carregar. diff --git a/plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb b/plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb deleted file mode 100644 index ce0901b..0000000 --- a/plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb +++ /dev/null @@ -1,109 +0,0 @@ -class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - def choose_metric - @configuration_content = profile.articles.find(params[:id]) - @base_tools = Kalibro::BaseTool.all - end - - def new_native - @configuration_content = profile.articles.find(params[:id]) - @reading_group_names_and_ids = reading_group_names_and_ids - @metric = Kalibro::BaseTool.find_by_name(params[:base_tool_name]).metric params[:metric_name] - @metric_configuration = Kalibro::MetricConfiguration.new :base_tool_name => params[:base_tool_name], :metric => @metric - end - - def edit_native - params_to_edit_view - end - - def new_compound - @configuration_content = profile.articles.find(params[:id]) - @metric_configurations = @configuration_content.metric_configurations - @reading_group_names_and_ids = reading_group_names_and_ids - metric = Kalibro::Metric.new :compound => true - @metric_configuration = Kalibro::MetricConfiguration.new :metric => metric - if configuration_content_has_errors? - redirect_to_error_page @configuration_content.errors[:base] - end - end - - def edit_compound - params_to_edit_view - end - - def create - configuration_content = profile.articles.find(params[:id]) - metric_configuration = Kalibro::MetricConfiguration.create(params[:metric_configuration]) - - if metric_configuration_has_errors? metric_configuration - redirect_to_error_page metric_configuration.errors[0].message - else - redirect_to(metric_configuration_url(configuration_content, metric_configuration.id)) - end - end - - def update - @configuration_content = profile.articles.find(params[:id]) - metric_configurations = @configuration_content.metric_configurations - metric_configuration = find_metric_configuration(metric_configurations, params[:metric_configuration][:id].to_i) - metric_configuration.update_attributes params[:metric_configuration] - if metric_configuration_has_errors? metric_configuration - redirect_to_error_page metric_configuration.errors[0].message - else - redirect_to @configuration_content.view_url - end - end - - def remove - configuration_content = profile.articles.find(params[:id]) - configuration_id = configuration_content.configuration_id - metric_configuration = Kalibro::MetricConfiguration.new({:id => params[:metric_configuration_id].to_i}) - metric_configuration.destroy - if metric_configuration_has_errors? metric_configuration - redirect_to_error_page metric_configuration.errors[0].message - else - redirect_to configuration_content.view_url - end - end - - private - - def find_metric_configuration (metric_configurations, metric_configuration_id) - metric_configurations.select {|metric_configuration| metric_configuration.id == metric_configuration_id }.first - end - - def reading_group_names_and_ids - array = Kalibro::ReadingGroup.all.map { |reading_group| [reading_group.name, reading_group.id] } - array.sort { |x,y| x.first.downcase <=> y.first.downcase } - end - - def metric_configuration_has_errors? metric_configuration - not metric_configuration.errors.empty? - end - - def configuration_content_has_errors? - not @configuration_content.errors[:base].nil? - end - - def metric_configuration_url(configuration_content, metric_configuration_id) - url = configuration_content.view_url - url[:controller] = controller_name - url[:id] = configuration_content.id - url[:metric_configuration_id] = metric_configuration_id - url[:action] = (params[:metric_configuration][:metric][:compound] == "true" ? "edit_compound" : "edit_native") - url - end - - def params_to_edit_view - @configuration_content = profile.articles.find(params[:id]) - @metric_configurations = @configuration_content.metric_configurations - @metric_configuration = find_metric_configuration(@metric_configurations, params[:metric_configuration_id].to_i) - @metric = @metric_configuration.metric - @reading_group_names_and_ids = reading_group_names_and_ids - @ranges = Kalibro::Range.ranges_of(@metric_configuration.id) - end - -end - diff --git a/plugins/mezuro/controllers/myprofile/mezuro_plugin_myprofile_controller.rb b/plugins/mezuro/controllers/myprofile/mezuro_plugin_myprofile_controller.rb deleted file mode 100644 index fa121f1..0000000 --- a/plugins/mezuro/controllers/myprofile/mezuro_plugin_myprofile_controller.rb +++ /dev/null @@ -1,29 +0,0 @@ -class MezuroPluginMyprofileController < ProfileController #MyprofileController? - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - -# rescue_from Exception do |exception| -# @message = process_error_message exception.message -# render :partial => "error_page" -# end - - def error_page - @message = params[:message] - end - - protected - - def redirect_to_error_page(message) - message = URI.escape(CGI.escape(process_error_message(message)),'.') - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" - end - - def process_error_message message #FIXME - if message =~ /bla/ - message - else - message - end - end - -end diff --git a/plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb b/plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb deleted file mode 100644 index 77331b8..0000000 --- a/plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb +++ /dev/null @@ -1,66 +0,0 @@ -class MezuroPluginRangeController < MezuroPluginMyprofileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - def new - params_to_range_form - params_to_redirect - end - - def edit - params_to_range_form - ranges = Kalibro::Range.ranges_of params[:metric_configuration_id].to_i - @range = (ranges.select { |range| range.id == params[:range_id].to_i }).first - end - - def create - params_to_redirect - save_range - end - - def update - save_range - end - - def remove - configuration_content = profile.articles.find(params[:id]) - Kalibro::Range.new({:id => params[:range_id].to_i}).destroy - redirect_to(metric_configuration_url(configuration_content)) - end - - private - - def metric_configuration_url configuration_content - url = configuration_content.view_url - url[:controller] = "mezuro_plugin_metric_configuration" - url[:id] = configuration_content.id - url[:metric_configuration_id] = params[:metric_configuration_id].to_i - url[:action] = (params[:compound] ? "edit_compound" : "edit_native") - url - end - - def reading_labels_and_ids - Kalibro::Reading.readings_of(params[:reading_group_id].to_i).map { |reading| [reading.label, reading.id] } - end - - def save_range - metric_configuration_id = params[:metric_configuration_id].to_i - @range = Kalibro::Range.new params[:range] - @range.save metric_configuration_id - if !@range.errors.empty? - @error = @range.errors[0].message - end - end - - def params_to_range_form - @content_id = params[:id].to_i - @metric_configuration_id = params[:metric_configuration_id].to_i - @reading_labels_and_ids = reading_labels_and_ids - end - - def params_to_redirect - @reading_group_id = params[:reading_group_id].to_i - @compound = params[:compound] - end - -end diff --git a/plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb b/plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb deleted file mode 100644 index 2f21085..0000000 --- a/plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb +++ /dev/null @@ -1,48 +0,0 @@ -class MezuroPluginReadingController < MezuroPluginMyprofileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - def new - @reading_group_content = profile.articles.find(params[:id]) - - readings = Kalibro::Reading.readings_of @reading_group_content.reading_group_id - @parser="|*|" - @labels_and_grades = readings.map {|reading| "#{reading.label}#{@parser}#{reading.grade}#{@parser}"} - end - - def save - reading_group_content = profile.articles.find(params[:id]) - reading = Kalibro::Reading.new params[:reading] - - if( reading.save ) - redirect_to reading_group_content.view_url - else - redirect_to_error_page reading.errors[0].message - end - end - - def edit - @reading_group_content = profile.articles.find(params[:id]) - @reading = Kalibro::Reading.find params[:reading_id] - - readings = Kalibro::Reading.readings_of @reading_group_content.reading_group_id - readings = readings.select {|reading| (reading.id != @reading.id)} - @parser="|*|" - @labels_and_grades = readings.map do |reading| - if(reading.id != @reading.id) - "#{reading.label}#{@parser}#{reading.grade}#{@parser}" - end - end - end - - def destroy - reading_group_content = profile.articles.find(params[:id]) - reading = Kalibro::Reading.find params[:reading_id] - reading.destroy - if( reading.errors.empty? ) - redirect_to reading_group_content.view_url - else - redirect_to_error_page reading.errors[0].message - end - end -end diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb deleted file mode 100644 index 15bc6a5..0000000 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb +++ /dev/null @@ -1,21 +0,0 @@ -class MezuroPluginModuleResultController < MezuroPluginProfileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - def module_result - @module_result = Kalibro::ModuleResult.find(params[:module_result_id].to_i) - @metric_results = Kalibro::MetricResult.metric_results_of(@module_result.id) - render :partial => 'module_result' - end - - def metric_result_history - @history = Kalibro::MetricResult.history_of(params[:metric_name], params[:module_result_id].to_i) - render :partial => 'score_history' - end - - def module_result_history - @history = Kalibro::ModuleResult.history_of(params[:module_result_id].to_i) - render :partial => 'score_history' - end - -end diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb deleted file mode 100644 index e969cd2..0000000 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb +++ /dev/null @@ -1,34 +0,0 @@ -class MezuroPluginProcessingController < MezuroPluginProfileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - def state - processing = processing_for_date(params[:repository_id].to_i, params[:date]) - if processing.error.nil? - render :text => processing.state - else - render :text => 'ERROR' - end - end - - def processing - @processing = processing_for_date(params[:repository_id].to_i, params[:date]) - if @processing.error.nil? - render :partial => 'processing' - else - render :partial => 'processing_error' - end - end - - private - - def processing_for_date(repository_id, date = nil) - processing_class = Kalibro::Processing - if date.nil? - processing_class.processing_of(repository_id) - else - processing_class.processing_with_date_of(repository_id, date) - end - end - -end diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb deleted file mode 100644 index 4bf0424..0000000 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -#TODO Ver quais metodos precisam estar aqui e fazer os testes -class MezuroPluginProfileController < ProfileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - -=begin - rescue_from Exception do |exception| - @message = process_error_message exception.message - render :partial => "error_page" - end - - def error_page - @message = params[:message] - end -=end - protected - - def process_error_message message - if message =~ /undefined method `module' for nil:NilClass/ - "Kalibro did not return any result. Verify if the selected configuration is correct." - else - message - end - end - - def project_content_has_errors? - not @content.errors[:base].nil? - end - - def redirect_to_error_page(message) - message = URI.escape(CGI.escape(process_error_message(message)),'.') - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}" - end - -end - diff --git a/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb b/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb deleted file mode 100644 index edbdf8c..0000000 --- a/plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb +++ /dev/null @@ -1,65 +0,0 @@ -class MezuroPluginRepositoryController < MezuroPluginProfileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - def new - params_repository_form - end - - def edit - params_repository_form - @repository = @project_content.repositories.select{ |repository| repository.id == params[:repository_id].to_i }.first - end - - def save - project_content = profile.articles.find(params[:id]) - repository = Kalibro::Repository.new( params[:repository] ) - - if( repository.save ) - repository.process - redirect_to(repository_url(project_content, repository.id)) - else - redirect_to_error_page repository.errors[0].message - end - end - - def show - @project_content = profile.articles.find(params[:id]) - @repository = @project_content.repositories.select{ |repository| repository.id == params[:repository_id].to_i }.first - @configuration_name = Kalibro::Configuration.find(@repository.configuration_id).name - end - - def destroy - project_content = profile.articles.find(params[:id]) - repository = Kalibro::Repository.new :id => params[:repository_id] - repository.destroy - if( repository.errors.empty? ) - redirect_to project_content.view_url - else - redirect_to_error_page repository.errors[0].message - end - end - - private - - def repository_url(project_content, repository_id) - url = project_content.view_url - url[:controller] = controller_name - url[:id] = project_content.id - url[:repository_id] = repository_id - url[:action] = "show" - url - end - - def params_repository_form - @project_content = profile.articles.find(params[:id]) - @repository_types = Kalibro::Repository.repository_types - - configurations = Kalibro::Configuration.all - configurations = [] if (configurations.nil?) - @configuration_select = configurations.map do |configuration| - [configuration.name,configuration.id] - end - end - -end diff --git a/plugins/mezuro/dependencies.rb b/plugins/mezuro/dependencies.rb deleted file mode 100644 index d9fefdf..0000000 --- a/plugins/mezuro/dependencies.rb +++ /dev/null @@ -1,3 +0,0 @@ -require 'rubygems' -require 'savon' -require 'googlecharts' diff --git a/plugins/mezuro/features/configuration.feature b/plugins/mezuro/features/configuration.feature deleted file mode 100644 index e5895a5..0000000 --- a/plugins/mezuro/features/configuration.feature +++ /dev/null @@ -1,158 +0,0 @@ -Feature: Configuration - As a mezuro user - I want to create, edit and remove a Mezuro configuration - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - Given I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - - Scenario: I see Mezuro configurantion's input form - Given I am on joaosilva's control panel - When I follow "Mezuro configuration" - Then I should see "Title" - And I should see "Description" - And I should see "Clone Configuration" - - @selenium @kalibro_restart - Scenario: I create a Mezuro configuration with valid attributes without cloning - Given I am on joaosilva's control panel - And I follow "Mezuro configuration" - When I fill the fields with the new following data - | article_name | Sample Configuration | - | article_description | Sample Description | - | article_configuration_to_clone_id | None | - And I press "Save" - Then I should see "Sample Configuration" - And I should see "Sample Description" - And I should see "Add Metric" - - @selenium @kalibro_restart - Scenario: I create a Mezuro configuration with valid attributes with cloning - Given I have a Mezuro configuration with the following data - | name | Sample Configuration| - | description | Sample Description | - | user | joaosilva | - And I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I have a Mezuro metric configuration with previous created configuration and reading group - And I am on joaosilva's control panel - And I follow "Mezuro configuration" - When I fill the fields with the new following data - | article_name | Another Configuration | - | article_description | Another Description | - | article_configuration_to_clone_id | Sample Configuration | - And I press "Save" - Then I should see "Another Configuration" - And I should see "Another Description" - And I should see "Total Coupling Factor" - And I should see "Add Metric" - - Scenario: I try to create a Mezuro configuration without title - Given I am on joaosilva's control panel - And I follow "Mezuro configuration" - And the field "article_name" is empty - When I press "Save" - Then I should see "Title can't be blank" - - @kalibro_restart - Scenario: I try to create a Mezuro configuration with title already in use - Given I have a Mezuro configuration with the following data - | name | Sample Configuration | - | description | Sample Description | - | user | joaosilva | - And I am on joaosilva's control panel - When I create a Mezuro configuration with the following data - | Title | Sample Configuration | - | Description | Sample Description | - | Clone | None | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." - - @selenium @kalibro_restart - Scenario: I see a Mezuro configuration edit form - Given I have a Mezuro configuration with the following data - | name | Sample Configuration | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Configuration" - When I follow "Edit" - Then I should see "Sample Configuration" in the "article_name" - And I should see "Sample Description" in the "article_description" - And I should see "Save" button - - @selenium @kalibro_restart - Scenario: I edit a Mezuro configuration with valid attributes - Given I have a Mezuro configuration with the following data - | name | Sample Configuration | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Configuration" - And I follow "Edit" - When I fill the fields with the new following data - | article_name | Another Configuration | - | article_description | Another Description | - And I press "Save" - Then I should see "Another Configuration" - And I should see "Another Description" - And I should see "Add Metric" - - @selenium @kalibro_restart - Scenario: I try to edit a Mezuro configuration leaving empty its title - Given I have a Mezuro configuration with the following data - | name | Sample Configuration | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Configuration" - And I follow "Edit" - When I erase the "article_name" field - And I press "Save" - Then I should see "Title can't be blank" - - @selenium @kalibro_restart - Scenario: I try to edit a Mezuro configuration with title of an existing Mezuro Configuration - Given I have a Mezuro configuration with the following data - | name | Sample Configuration | - | description | Sample Description | - | user | joaosilva | - And I have a Mezuro configuration with the following data - | name | Another Configuration | - | description | Another Description | - | user | joaosilva | - And I am on article "Sample Configuration" - And I follow "Edit" - When I fill the fields with the new following data - | article_name | Another Configuration | - | article_description | Another Description | - And I press "Save" - Then I should see "Slug The title (article name) is already being used by another article, please use another title." - - @selenium @kalibro_restart - Scenario: I delete a Mezuro configuration that belongs to me - Given I have a Mezuro configuration with the following data - | name | Sample Configuration | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Configuration" - When I follow "Delete" - And I confirm the "Are you sure that you want to remove the item "Sample Configuration"?" dialog - Then I go to /joaosilva/sample-configuration - And I should see "There is no such page: /joaosilva/sample-configuration" - - @selenium @kalibro_restart - Scenario: I cannot edit or delete a Mezuro configuration that doesn't belong to me - Given I have a Mezuro configuration with the following data - | name | Sample Configuration | - | description | Sample Description | - | user | joaosilva | - And the following users - | login | name | - | adminuser | Admin | - And I am logged in as "adminuser" - When I am on article "Sample Configuration" - Then I should not see "Delete" - And I should not see "Edit" - diff --git a/plugins/mezuro/features/project.feature b/plugins/mezuro/features/project.feature deleted file mode 100644 index e0c2516..0000000 --- a/plugins/mezuro/features/project.feature +++ /dev/null @@ -1,134 +0,0 @@ -Feature: Project - As a mezuro user - I want to create, edit and remove a Mezuro project - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And the following community - | identifier | name | - | mycommunity | My Community | - And "Joao Silva" is admin of "My Community" - - Scenario: I see the Mezuro project input form - Given I am on mycommunity's control panel - When I follow "Mezuro project" - Then I should see "Title" - And I should see "Description" - - @kalibro_restart - Scenario: I create a Mezuro project with valid attributes - Given I am on mycommunity's control panel - When I create a Mezuro project with the following data - | Title | Sample Project | - | Description | Sample Description | - Then I should see "Sample Project" - And I should see "Sample Description" - And I should see "Add Repository" - - Scenario: I try to create a Mezuro project without title - Given I am on mycommunity's control panel - And I follow "Mezuro project" - And the field "article_name" is empty - When I press "Save" - Then I should see "Title can't be blank" - - @kalibro_restart - Scenario: I try to create a Mezuro project with title already in use - Given I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And I am on mycommunity's control panel - When I create a Mezuro project with the following data - | Title | Sample Project | - | Description | Sample Description | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." - - @selenium @kalibro_restart - Scenario: I see a Mezuro project edit form - Given I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And I am on article "Sample Project" - When I follow "Edit" - Then I should see "Sample Project" in the "article_name" - And I should see "Sample Description" in the "article_description" - And I should see "Save" button - - @selenium @kalibro_restart - Scenario: I edit a Mezuro project with valid attributes - Given I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And I am on article "Sample Project" - And I follow "Edit" - When I fill the fields with the new following data - | article_name | Another Project | - | article_description | Another Description| - And I press "Save" - Then I should see "Another Project" - And I should see "Another Description" - And I should see "Add Repository" - - @selenium @kalibro_restart - Scenario: I try to edit a Mezuro project leaving empty its title - Given I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And I am on article "Sample Project" - And I follow "Edit" - When I erase the "article_name" field - And I press "Save" - Then I should see "Title can't be blank" - - @selenium @kalibro_restart - Scenario: I try to edit a Mezuro project with title of an existing Mezuro Project - Given I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And I have a Mezuro project with the following data - | name | Another Project | - | description | Another Description | - | community | mycommunity | - And I am on article "Sample Project" - And I follow "Edit" - When I fill the fields with the new following data - | article_name | Another Project | - | article_description | Another Description| - And I press "Save" - Then I should see "Slug The title (article name) is already being used by another article, please use another title." - - @selenium @kalibro_restart - Scenario: I delete a Mezuro project that belongs to me - Given I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And I am on article "Sample Project" - When I follow "Delete" - And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog - Then I go to /mycommunity/sample-project - And I should see "There is no such page: /mycommunity/sample-project" - - @selenium @kalibro_restart - Scenario: I cannot edit or delete a Mezuro project that doesn't belong to me - Given I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And the following users - | login | name | - | user | User | - And I am logged in as "user" - When I am on article "Sample Project" - Then I should not see "Delete" - And I should not see "Edit" - diff --git a/plugins/mezuro/features/reading.feature b/plugins/mezuro/features/reading.feature deleted file mode 100644 index 8428edb..0000000 --- a/plugins/mezuro/features/reading.feature +++ /dev/null @@ -1,243 +0,0 @@ -@kalibro_restart -Feature: Reading - As a Mezuro user - I want to create, edit and remove a reading - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And I have a Mezuro reading group with the following data - | name | Sample Reading Group | - | description | Sample Description | - | user | joaosilva | - - @selenium - Scenario: I want to see the Mezuro reading input form - Given I am on article "Sample Reading Group" - When I follow "Add Reading" - Then I should see "Sample Reading Group Reading Group" in a link - And I should see "Label" - And I should see "Grade" - And I should see "Color" - And I should see "Save" button - - @selenium - Scenario: I try to add a reading with no name - Given I am on article "Sample Reading Group" - When I follow "Add Reading" - And I fill the fields with the new following data - | reading_label | | - | reading_grade | 10.2 | - | reading_color | ABCDEF | - And I press "Save" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to add a reading with no grade - Given I am on article "Sample Reading Group" - When I follow "Add Reading" - And I fill the fields with the new following data - | reading_label | Useless | - | reading_grade | | - | reading_color | f51313 | - And I press "Save" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to add a reading with no color - Given I am on article "Sample Reading Group" - When I follow "Add Reading" - And I fill the fields with the new following data - | reading_label | Fantastic | - | reading_grade | 4.0 | - | reading_color | | - And I press "Save" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to add a reading with an invalid color - Given I am on article "Sample Reading Group" - When I follow "Add Reading" - And I fill the fields with the new following data - | reading_label | Fantastic | - | reading_grade | 4.0 | - | reading_color | 1D10T4 | - And I press "Save" - Then I should see "This is not a valid color." inside an alert - - @selenium - Scenario: I try to add a reading with a label which already exists - Given I have a Mezuro reading with the following data - | label | Simple | - | grade | 2.0 | - | color | 34afe2 | - And I am on article "Sample Reading Group" - When I follow "Add Reading" - And I fill the fields with the new following data - | reading_label | Simple | - | reading_grade | 4.0 | - | reading_color | 1f0fa0 | - And I press "Save" - Then I should see "This label already exists! Please, choose another one." inside an alert - - @selenium - Scenario: I try to add a reading with a grade which already exists - Given I have a Mezuro reading with the following data - | label | Extraordinary | - | grade | 10.0 | - | color | b4bad0 | - And I am on article "Sample Reading Group" - When I follow "Add Reading" - And I fill the fields with the new following data - | reading_label | Super | - | reading_grade | 10.0 | - | reading_color | f0f000 | - And I press "Save" - Then I should see "This grade already exists! Please, choose another one." inside an alert - - @selenium - Scenario: I want to add a reading with valid attributes - Given I am on article "Sample Reading Group" - When I follow "Add Reading" - And I fill the fields with the new following data - | reading_label | Normal | - | reading_grade | 1.0 | - | reading_color | 19cbd1 | - And I press "Save" - Then I should see "Normal" - And I should see "1.0" - And I should see the "#19cbd1" color - And I should see "Remove" - - @selenium - Scenario: I want to see a reading edit form - Given I have a Mezuro reading with the following data - | label | Simple | - | grade | 2.0 | - | color | 34afe2 | - And I am on article "Sample Reading Group" - When I follow the edit link for "Simple" reading - Then I should see "Simple" in the "reading_label" - And I should see "2.0" in the "reading_grade" - And I should see "34afe2" in the "reading_color" - And I should see "Save" button - - @selenium - Scenario: I try to edit a reading leaving empty its title - Given I have a Mezuro reading with the following data - | label | Simple | - | grade | 2.0 | - | color | 34afe2 | - And I am on article "Sample Reading Group" - When I follow the edit link for "Simple" reading - And I erase the "reading_label" field - And I press "Save" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to edit a reading leaving empty its grade - Given I have a Mezuro reading with the following data - | label | Simple | - | grade | 2.0 | - | color | 34afe2 | - And I am on article "Sample Reading Group" - When I follow the edit link for "Simple" reading - And I erase the "reading_grade" field - And I press "Save" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to edit a reading leaving empty its color - Given I have a Mezuro reading with the following data - | label | Simple | - | grade | 2.0 | - | color | 34afe2 | - And I am on article "Sample Reading Group" - When I follow the edit link for "Simple" reading - And I erase the "reading_color" field - And I press "Save" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to edit a reading with an invalid color - Given I have a Mezuro reading with the following data - | label | Worthless | - | grade | 1.0 | - | color | e5cad4 | - And I am on article "Sample Reading Group" - When I follow the edit link for "Worthless" reading - And I fill the fields with the new following data - | reading_label | Worthless | - | reading_grade | 1.0 | - | reading_color | bu5aoooooo | - And I press "Save" - Then I should see "This is not a valid color." inside an alert - - @selenium - Scenario: I try to edit a reading with a label which already exists - Given I have a Mezuro reading with the following data - | label | Simple | - | grade | 2.0 | - | color | 34afe2 | - And I have a Mezuro reading with the following data - | label | Complex | - | grade | 5.0 | - | color | 13deb2 | - And I am on article "Sample Reading Group" - When I follow the edit link for "Simple" reading - And I fill the fields with the new following data - | reading_label | Complex | - | reading_grade | 2.0 | - | reading_color | 34afe2 | - And I press "Save" - Then I should see "This label already exists! Please, choose another one." inside an alert - - @selenium - Scenario: I try to edit a reading with a grade which already exists - Given I have a Mezuro reading with the following data - | label | Terrible | - | grade | 0.0 | - | color | 4feda4 | - And I have a Mezuro reading with the following data - | label | Perfect | - | grade | 10.0 | - | color | de41b2 | - And I am on article "Sample Reading Group" - When I follow the edit link for "Terrible" reading - And I fill the fields with the new following data - | reading_label | Terrible | - | reading_grade | 10.0 | - | reading_color | 4feda4 | - And I press "Save" - Then I should see "This grade already exists! Please, choose another one." inside an alert - - @selenium - Scenario: I want to edit a reading with valid attributes - Given I have a Mezuro reading with the following data - | label | Awful | - | grade | 2.5 | - | color | babaca | - And I am on article "Sample Reading Group" - When I follow the edit link for "Awful" reading - And I fill the fields with the new following data - | reading_label | Awesome | - | reading_grade | 10.0 | - | reading_color | fa40fa | - And I press "Save" - Then I should see "Awesome" - And I should see "10.0" - And I should see the "#fa40fa" color - - @selenium - Scenario: I want to remove a reading - Given I have a Mezuro reading with the following data - | label | Unbelievable | - | grade | 9001.0 | - | color | f0f0ca | - And I am on article "Sample Reading Group" - When I follow the remove link for "Unbelievable" reading - Then I should not see "Unbelievable" - And I should not see "9001.0" diff --git a/plugins/mezuro/features/reading_group.feature b/plugins/mezuro/features/reading_group.feature deleted file mode 100644 index a0482eb..0000000 --- a/plugins/mezuro/features/reading_group.feature +++ /dev/null @@ -1,131 +0,0 @@ -Feature: Reading Group - As a mezuro user - I want to create, edit and remove a Mezuro reading group - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - Given I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - - Scenario: I see Mezuro reading group's input form - Given I am on joaosilva's control panel - When I follow "Mezuro reading group" - Then I should see "Title" - And I should see "Description" - - @kalibro_restart - Scenario: I create a Mezuro reading group with valid attributes - Given I am on joaosilva's control panel - When I create a Mezuro reading group with the following data - | Title | Sample Reading Group | - | Description | Sample Description | - Then I should see "Sample Reading Group" - And I should see "Sample Description" - And I should see "Readings" - And I should see "Add Reading" - - Scenario: I try to create a Mezuro reading group without title - Given I am on joaosilva's control panel - And I follow "Mezuro reading group" - And the field "article_name" is empty - When I press "Save" - Then I should see "Title can't be blank" - - @kalibro_restart - Scenario: I try to create a Mezuro reading group with title already in use - Given I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I am on joaosilva's control panel - When I create a Mezuro reading group with the following data - | Title | Sample Reading Group | - | Description | Sample Description | - Then I should see "Slug The title (article name) is already being used by another article, please use another title." - - @selenium @kalibro_restart - Scenario: I see a Mezuro reading group edit form - Given I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Reading group" - When I follow "Edit" - Then I should see "Sample Reading group" in the "article_name" - And I should see "Sample Description" in the "article_description" - And I should see "Save" button - - @selenium @kalibro_restart - Scenario: I edit a Mezuro reading group with valid attributes - Given I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Reading group" - And I follow "Edit" - When I fill the fields with the new following data - | article_name | Another Reading group | - | article_description | Another Description | - And I press "Save" - Then I should see "Another Reading group" - And I should see "Another Description" - And I should see "Add Reading" - - @selenium @kalibro_restart - Scenario: I try to edit a Mezuro reading group leaving empty its title - Given I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Reading group" - And I follow "Edit" - When I erase the "article_name" field - And I press "Save" - Then I should see "Title can't be blank" - - @selenium @kalibro_restart - Scenario: I try to edit a Mezuro reading group with title of an existing Mezuro Reading group - Given I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I have a Mezuro reading group with the following data - | name | Another Reading group | - | description | Another Description | - | user | joaosilva | - And I am on article "Sample Reading group" - And I follow "Edit" - When I fill the fields with the new following data - | article_name | Another Reading group | - | article_description | Another Description | - And I press "Save" - Then I should see "Slug The title (article name) is already being used by another article, please use another title." - - @selenium @kalibro_restart - Scenario: I delete a Mezuro reading group that belongs to me - Given I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I am on article "Sample Reading group" - When I follow "Delete" - And I confirm the "Are you sure that you want to remove the item "Sample Reading group"?" dialog - Then I go to /joaosilva/sample-reading-group - And I should see "There is no such page: /joaosilva/sample-reading-group" - - @selenium @kalibro_restart - Scenario: I cannot edit or delete a Mezuro reading group that doesn't belong to me - Given I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And the following users - | login | name | - | adminuser | Admin | - And I am logged in as "adminuser" - When I am on article "Sample Reading group" - Then I should not see "Delete" - And I should not see "Edit" - diff --git a/plugins/mezuro/features/repository.feature b/plugins/mezuro/features/repository.feature deleted file mode 100644 index 520c1eb..0000000 --- a/plugins/mezuro/features/repository.feature +++ /dev/null @@ -1,276 +0,0 @@ -@kalibro_restart -Feature: Repository - As a Mezuro user - I want to create, edit, remove and process a repository - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And the following community - | identifier | name | - | mycommunity | My Community | - And "Joao Silva" is admin of "My Community" - And I have a Mezuro project with the following data - | name | Sample Project | - | description | Sample Description | - | community | mycommunity | - And I have a Mezuro configuration with the following data - | name | Sample Configuration| - | description | Sample Description | - | user | joaosilva | - And I have a Mezuro reading group with the following data - | name | Sample Reading group | - | description | Sample Description | - | user | joaosilva | - And I have a Mezuro metric configuration with previous created configuration and reading group - - Scenario: I want to see the Mezuro repository input form - Given I am on article "Sample Project" - When I follow "Add Repository" - Then I should see "Name" - And I should see "Description" - And I should see "License" - And I should see "Process Period" - And I should see "Type" - And I should see "Address" - And I should see "Configuration" - And I should see "Add" button - - @selenium - Scenario: I try to add a repository with no name - Given I am on article "Sample Project" - And I follow "Add Repository" - When I fill the fields with the new following data - | repository_name | | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | SUBVERSION | - | repository_address | https://project.svn.sourceforge.net/svnroot/project | - | repository_configuration_id | Sample Configuration | - And I press "Add" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to add a repository with no address - Given I am on article "Sample Project" - And I follow "Add Repository" - When I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | SUBVERSION | - | repository_address | | - | repository_configuration_id | Sample Configuration | - And I press "Add" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to add a repository with an invalid address - Given I am on article "Sample Project" - And I follow "Add Repository" - When I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | GIT | - | repository_address | https://invalid-address.any-extension | - | repository_configuration_id | Sample Configuration | - And I press "Add" - Then I should see "Address does not match type GIT chosen." inside an alert - - @selenium - Scenario: I want to add a repository with valid attributes - Given I am on article "Sample Project" - And I follow "Add Repository" - When I fill the fields with the new following data - | repository_name | My Name | - | repository_description | My Description | - | repository_license | ISC License (ISC) | - | repository_process_period | Not Periodically | - | repository_type | GIT | - | repository_address | https://github.com/user/project.git | - | repository_configuration_id | Sample Configuration | - And I press "Add" - Then I should see "My Name" - And I should see "My Description" - And I should see "ISC License (ISC)" - And I should see "Not Periodically" - And I should see "GIT" - And I should see "https://github.com/user/project.git" - And I should see "Sample Configuration" - And I should see "Status" - - @selenium - Scenario: I want to see the repository edit form - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And I am on article "Sample Project" - When I follow the edit link for "My Name" repository - Then I should see "My Name" in the "repository_name" - And I should see "My Description" in the "repository_description" - And I should see "ISC License (ISC)" in the "repository_license" - And I should see "Not Periodically" in the process period select field - And I should see "GIT" in the "repository_type" - And I should see "https://github.com/user/project.git" in the "repository_address" - And I should see "Sample Configuration" in the repository configuration select field - - @selenium - Scenario: I edit a Mezuro repository with valid attributes - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And I am on article "Sample Project" - When I follow the edit link for "My Name" repository - And I fill the fields with the new following data - | repository_name | Another Name | - | repository_description | Another Description | - | repository_license | Apple Public Source License (APSL-2.0) | - | repository_process_period | Weekly | - | repository_type | SUBVERSION | - | repository_address | https://project.svn.sourceforge.net/svnroot/project | - | repository_configuration_id | Sample Configuration | - And I press "Add" - Then I should see "Another Name" - And I should see "Another Description" - And I should see "Apple Public Source License (APSL-2.0)" - And I should see "Weekly" - And I should see "SUBVERSION" - And I should see "https://project.svn.sourceforge.net/svnroot/project" - And I should see "Sample Configuration" - - @selenium - Scenario: I try to edit a Mezuro repository leaving empty its title - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And I am on article "Sample Project" - And I follow the edit link for "My Name" repository - When I erase the "repository_name" field - And I press "Add" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to edit a Mezuro repository leaving empty its address - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And I am on article "Sample Project" - And I follow the edit link for "My Name" repository - When I erase the "repository_address" field - And I press "Add" - Then I should see "Please fill all fields marked with (*)." inside an alert - - @selenium - Scenario: I try to edit a Mezuro repository with an invalid address - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And I am on article "Sample Project" - When I follow the edit link for "My Name" repository - And I fill the fields with the new following data - | repository_name | Another Name | - | repository_description | Another Description | - | repository_license | Apple Public Source License (APSL-2.0) | - | repository_process_period | Weekly | - | repository_type | SUBVERSION | - | repository_address | https://invalid-address.any-extension | - | repository_configuration_id | Sample Configuration | - And I press "Add" - Then I should see "Address does not match type SUBVERSION chosen." inside an alert - - @selenium - Scenario: I try to edit a repository with an existing repository name - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And I have a Mezuro repository with the following data - | name | Another Name | - | description | Another Description | - | license | Apple Public Source License (APSL-2.0) | - | process_period | Weekly | - | type | SUBVERSION | - | address | https://project.svn.sourceforge.net/svnroot/project | - | configuration_id | Sample Configuration | - And I am on article "Sample Project" - When I follow the edit link for "My Name" repository - And I fill the fields with the new following data - | repository_name | Another Name | - | repository_description | Another Description | - | repository_license | Apple Public Source License (APSL-2.0) | - | repository_process_period | Weekly | - | repository_type | SUBVERSION | - | repository_address | https://project.svn.sourceforge.net/svnroot/project | - | repository_configuration_id | Sample Configuration | - And I press "Add" - #Then I should see "Slug The title (article name) is already being used by another article, please use another title." - #FIXME fix this validation - - @selenium - Scenario: I delete a Mezuro repository of mine - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And I am on article "Sample Project" - When I follow the remove link for "My Name" repository - Then I should not see "My Name" - - @selenium - Scenario: I try to edit or delete a Mezuro repository which doesn't belong to me - Given I have a Mezuro repository with the following data - | name | My Name | - | description | My Description | - | license | ISC License (ISC) | - | process_period | Not Periodically | - | type | GIT | - | address | https://github.com/user/project.git | - | configuration_id | Sample Configuration | - And the following users - | login | name | - | zacarias | Zacarias | - And I am logged in as "zacarias" - When I am on article "Sample Project" - Then I should not see the edit link for "My Name" repository - And I should not see the remove link for "My Name" repository - diff --git a/plugins/mezuro/features/step_definitions/mezuro_steps.rb b/plugins/mezuro/features/step_definitions/mezuro_steps.rb deleted file mode 100644 index 73ca62c..0000000 --- a/plugins/mezuro/features/step_definitions/mezuro_steps.rb +++ /dev/null @@ -1,164 +0,0 @@ -When /^I create a Mezuro (project|reading group) with the following data$/ do |type, fields| - click_link ("Mezuro " + type) - - fields.rows_hash.each do |name, value| - When %{I fill in "#{name}" with "#{value}"} - end - - click_button "Save" - Article.find_by_name(fields.rows_hash[:Title]) -end - -When /^I create a Mezuro configuration with the following data$/ do |fields| - click_link ("Mezuro configuration") - - fields.rows_hash.each do |name, value| - if name != "Clone" - When %{I fill in "#{name}" with "#{value}"} - end - end - - click_button "Save" - Article.find_by_name(fields.rows_hash[:Title]) -end - -Then /^I directly delete content with name "([^\"]*)" for testing purposes$/ do |content_name| - Article.find_by_name(content_name).destroy -end - -Then /^I should be at the url "([^\"]*)"$/ do |url| - if response.class.to_s == 'Webrat::SeleniumResponse' - URI.parse(response.selenium.get_location).path.should == url - else - URI.parse(current_url).path.should == url - end -end - -Then /^the field "([^"]*)" is empty$/ do |field_name| - find_field(field_name).value.should be_nil -end - -Then /^I should see "([^\"]*)" inside an alert$/ do |message| - alert = page.driver.browser.switch_to.alert - assert_equal message, alert.text - alert.accept -end - -Then /^I should see "([^"]*)" in the "([^"]*)"$/ do |content, labeltext| - find_field(labeltext).value.should == content -end - -Then /^I should see "([^"]*)" button$/ do |button_name| - find_button(button_name).should_not be_nil -end - -Then /^I should see "([^"]*)" in a link$/ do |link_name| - find_link(link_name).should_not be_nil -end - -Then /^I should see "([^"]*)" in the process period select field$/ do |content| - selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first - assert_equal selected.last, find_field("repository_process_period").value.to_i -end - -Then /^I should see "([^"]*)" in the repository configuration select field$/ do |content| - selected = Kalibro::Configuration.all.select { |option| option.name == content }.first - assert_equal selected.id, find_field("repository_configuration_id").value.to_i -end - -Then /^I should not see "([^"]*)" button$/ do |button_name| - find_button(button_name).should be_nil -end - -When /^I have a Mezuro (project|reading group|configuration) with the following data$/ do |type, fields| - item = {} - fields.rows_hash.each do |name, value| - if(name=="user" or name=="community") - item.merge!(:profile=>Profile[value]) - else - item.merge!(name => value) - end - end - if (type == "project") - result = MezuroPlugin::ProjectContent.new(item) - elsif (type == "reading group") - result = MezuroPlugin::ReadingGroupContent.new(item) - elsif (type == "configuration") - result = MezuroPlugin::ConfigurationContent.new(item) - end - - result.save! -end - -When /^I have a Mezuro (reading|repository) with the following data$/ do |type, fields| - item = {} - fields.rows_hash.each do |name, value| - if(name=="user" or name=="community") - item.merge!(:profile=>Profile[value]) - else - item.merge!(name => value) - end - end - if (type == "repository") - item["configuration_id"] = Kalibro::Configuration.all.select {|configuration| configuration.name == item["configuration_id"] }.first.id - item.merge!(:project_id => Kalibro::Project.all.last.id) - Kalibro::Repository.create(item) - elsif (type == "reading") - item.merge!(:group_id => Kalibro::ReadingGroup.all.last.id) - Kalibro::Reading.create(item) - end -end - -When /^I erase the "([^"]*)" field$/ do |field_name| - find_field(field_name).set "" -end - -When /^I fill the fields with the new following data$/ do |fields| - fields.rows_hash.each do |key, value| - name = key.to_s - element = find_field(name) - if (element.tag_name.to_s == "select") - select(value, :from => name) - else - element.set value - end - end -end - -When /^I have a Mezuro metric configuration with previous created configuration and reading group$/ do - Kalibro::MetricConfiguration.create({ - :code => 'amloc1', - :metric => {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']}, - :base_tool_name => "Analizo", - :weight => "1.0", - :aggregation_form => 'AVERAGE', - :reading_group_id => Kalibro::ReadingGroup.all.last.id, - :configuration_id => Kalibro::Configuration.all.last.id - }) -end - -When /^I follow the (edit|remove) link for "([^"]*)" (repository|reading)$/ do |action, name, type| - if (type == "repository") - project_id = Kalibro::Project.all.last.id - repositories = Kalibro::Repository.repositories_of project_id - id = repositories.select {|option| option.name == name}.first.id - elsif (type == "reading") - reading_group_id = Kalibro::ReadingGroup.all.last.id - readings = Kalibro::Reading.readings_of reading_group_id - id = readings.select {|option| option.label == name}.first.id - if (action == "edit") - action = name - end - end - - elements = all('a', :text => action.capitalize) - link = type + "_id" - action_link = elements.select {|element| (/#{link}=#{id}/ =~ element[:href]) }.first - action_link.click -end - -Then /^I should see the "([^"]*)" color$/ do |color_name| - elements = all('td', :text => "") - found = elements.select { |element| color_name == element[:bgcolor]}.first - assert_not_nil found -end diff --git a/plugins/mezuro/features/support/hooks.rb b/plugins/mezuro/features/support/hooks.rb deleted file mode 100644 index fb89f01..0000000 --- a/plugins/mezuro/features/support/hooks.rb +++ /dev/null @@ -1,12 +0,0 @@ -Before do - if !$dunit - command = "#{RAILS_ROOT}/plugins/mezuro/script/tests/prepare_kalibro_query_file.sh" - system command - $dunit = true - end -end - -After ('@kalibro_restart') do - command = "#{RAILS_ROOT}/plugins/mezuro/script/tests/delete_all_kalibro_entries.sh" - system command -end diff --git a/plugins/mezuro/install.rb b/plugins/mezuro/install.rb deleted file mode 100644 index f960f51..0000000 --- a/plugins/mezuro/install.rb +++ /dev/null @@ -1 +0,0 @@ -raise "Not ready yet" diff --git a/plugins/mezuro/lib/kalibro/base_tool.rb b/plugins/mezuro/lib/kalibro/base_tool.rb deleted file mode 100644 index 60bf083..0000000 --- a/plugins/mezuro/lib/kalibro/base_tool.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Kalibro::BaseTool < Kalibro::Model - - attr_accessor :name, :description, :collector_class_name, :supported_metric - - def self.find_by_name(base_tool_name) - new request(:get_base_tool, {:base_tool_name => base_tool_name})[:base_tool] - end - - def self.all - basetools = all_names - basetools.map{ |name| find_by_name(name) } - end - - def self.all_names - request(:all_base_tool_names)[:base_tool_name].to_a - end - - def supported_metric=(value) - @supported_metric = Kalibro::Metric.to_objects_array value - end - - def supported_metrics - @supported_metric - end - - def supported_metrics=(supported_metrics) - @supported_metric = supported_metrics - end - - def metric(name) - supported_metrics.find {|metric| metric.name == name} - end - -end diff --git a/plugins/mezuro/lib/kalibro/configuration.rb b/plugins/mezuro/lib/kalibro/configuration.rb deleted file mode 100644 index 7bebf73..0000000 --- a/plugins/mezuro/lib/kalibro/configuration.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Kalibro::Configuration < Kalibro::Model - - attr_accessor :id, :name, :description - - def id=(value) - @id = value.to_i - end - - def self.all - response = request(:all_configurations)[:configuration] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map {|configuration| new configuration} - end - -end diff --git a/plugins/mezuro/lib/kalibro/date_metric_result.rb b/plugins/mezuro/lib/kalibro/date_metric_result.rb deleted file mode 100644 index 5e79a89..0000000 --- a/plugins/mezuro/lib/kalibro/date_metric_result.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Kalibro::DateMetricResult < Kalibro::Model - - attr_accessor :date, :metric_result - - def date=(value) - @date = value.is_a?(String) ? DateTime.parse(value) : value - end - - def metric_result=(value) - @metric_result = Kalibro::MetricResult.to_object value - end - - def result - @metric_result.value - end -end diff --git a/plugins/mezuro/lib/kalibro/date_module_result.rb b/plugins/mezuro/lib/kalibro/date_module_result.rb deleted file mode 100644 index 241e7f6..0000000 --- a/plugins/mezuro/lib/kalibro/date_module_result.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Kalibro::DateModuleResult < Kalibro::Model - - attr_accessor :date, :module_result - - def date=(value) - @date = value.is_a?(String) ? DateTime.parse(value) : value - end - - def module_result=(value) - @module_result = Kalibro::ModuleResult.to_object value - end - - def result - @module_result.grade - end - -end diff --git a/plugins/mezuro/lib/kalibro/errors/record_not_found.rb b/plugins/mezuro/lib/kalibro/errors/record_not_found.rb deleted file mode 100644 index 132b322..0000000 --- a/plugins/mezuro/lib/kalibro/errors/record_not_found.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Kalibro::Errors::RecordNotFound < Kalibro::Errors::Standard -end \ No newline at end of file diff --git a/plugins/mezuro/lib/kalibro/errors/standard.rb b/plugins/mezuro/lib/kalibro/errors/standard.rb deleted file mode 100644 index ae901a6..0000000 --- a/plugins/mezuro/lib/kalibro/errors/standard.rb +++ /dev/null @@ -1,4 +0,0 @@ -#Inspired on: -#https://github.com/rails/rails/blob/master/activerecord/lib/active_record/errors.rb -class Kalibro::Errors::Standard < StandardError -end \ No newline at end of file diff --git a/plugins/mezuro/lib/kalibro/metric.rb b/plugins/mezuro/lib/kalibro/metric.rb deleted file mode 100644 index 2c8066c..0000000 --- a/plugins/mezuro/lib/kalibro/metric.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Kalibro::Metric < Kalibro::Model - - attr_accessor :name, :compound, :scope, :description, :script, :language - - def languages - @language - end - - def languages=(languages) - @language = languages - end - - def language=(value) - @language = Kalibro::Model.to_objects_array value - end - -end diff --git a/plugins/mezuro/lib/kalibro/metric_configuration.rb b/plugins/mezuro/lib/kalibro/metric_configuration.rb deleted file mode 100644 index 6dd0ccd..0000000 --- a/plugins/mezuro/lib/kalibro/metric_configuration.rb +++ /dev/null @@ -1,43 +0,0 @@ -class Kalibro::MetricConfiguration < Kalibro::Model - - attr_accessor :id, :code, :metric, :base_tool_name, :weight, :aggregation_form, :reading_group_id, :configuration_id - - def id=(value) - @id = value.to_i - end - - def reading_group_id=(value) - @reading_group_id = value.to_i - end - - def metric=(value) - @metric = Kalibro::Metric.to_object(value) - end - - def weight=(value) - @weight = value.to_f - end - - def update_attributes(attributes={}) - attributes.each { |field, value| send("#{field}=", value) if self.class.is_valid?(field) } - save - end - - def to_hash - super :except => [:configuration_id] - end - - def self.metric_configurations_of(configuration_id) - response = request(:metric_configurations_of, {:configuration_id => configuration_id})[:metric_configuration] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map { |metric_configuration| new metric_configuration } - end - - private - - def save_params - {:metric_configuration => self.to_hash, :configuration_id => self.configuration_id} - end - -end diff --git a/plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb b/plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb deleted file mode 100644 index ae1a5b2..0000000 --- a/plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb +++ /dev/null @@ -1,38 +0,0 @@ -class Kalibro::MetricConfigurationSnapshot < Kalibro::Model - - attr_accessor :code, :weight, :aggregation_form, :metric, :base_tool_name, :range - - def weight=(value) - @weight = value.to_f - end - - def metric=(value) - if value.kind_of?(Hash) - @metric = Kalibro::Metric.to_object(value) - else - @metric = value - end - end - - def range=(value) - value.to_a - @range = [] - - value.each do |range_snapshot| - @range << Kalibro::RangeSnapshot.to_object(range_snapshot) - end - - end - - def range_snapshot - range - end - - def to_hash - hash = super - hash[:attributes!][:range] = {'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:rangeSnapshotXml' } - hash - end - -end diff --git a/plugins/mezuro/lib/kalibro/metric_result.rb b/plugins/mezuro/lib/kalibro/metric_result.rb deleted file mode 100644 index d4ddb90..0000000 --- a/plugins/mezuro/lib/kalibro/metric_result.rb +++ /dev/null @@ -1,50 +0,0 @@ -class Kalibro::MetricResult < Kalibro::Model - - attr_accessor :id, :configuration, :value, :error - - def initialize(attributes={}) - value = attributes[:value] - @value = (value == "NaN") ? attributes[:aggregated_value].to_f : value.to_f - attributes.each do |field, value| - if field!= :value and field!= :aggregated_value and self.class.is_valid?(field) - send("#{field}=", value) - end - end - @errors = [] - end - - def id=(value) - @id = value.to_i - end - - def configuration=(value) - @configuration = Kalibro::MetricConfigurationSnapshot.to_object value - end - - def metric_configuration_snapshot - configuration - end - - def error=(value) - @error = Kalibro::Throwable.to_object value - end - - def descendant_results - self.class.request(:descendant_results_of, {:metric_result_id => self.id})[:descendant_result].to_a - end - - def self.metric_results_of(module_result_id) - response = request(:metric_results_of, {:module_result_id => module_result_id})[:metric_result] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map {|metric_result| new metric_result} - end - - def self.history_of(metric_name, module_result_id) - response = self.request(:history_of_metric, {:metric_name => metric_name, :module_result_id => module_result_id})[:date_metric_result] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map {|date_metric_result| Kalibro::DateMetricResult.new date_metric_result} - end - -end diff --git a/plugins/mezuro/lib/kalibro/model.rb b/plugins/mezuro/lib/kalibro/model.rb deleted file mode 100644 index ef4e844..0000000 --- a/plugins/mezuro/lib/kalibro/model.rb +++ /dev/null @@ -1,164 +0,0 @@ -class Kalibro::Model - - attr_accessor :errors - - def initialize(attributes={}) - attributes.each { |field, value| send("#{field}=", value) if self.class.is_valid?(field) } - @errors = [] - end - - - def to_hash(options={}) - hash = Hash.new - excepts = options[:except].nil? ? [] : options[:except] - excepts << :errors - fields.each do |field| - if(!excepts.include?(field)) - field_value = send(field) - if !field_value.nil? - hash[field] = convert_to_hash(field_value) - if field_value.is_a?(Kalibro::Model) - hash = {:attributes! => {}}.merge(hash) - hash[:attributes!][field.to_sym] = { - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:' + xml_instance_class_name(field_value) } - end - end - end - end - hash - end - - def self.request(action, request_body = nil) - response = client(endpoint).request(:kalibro, action) { soap.body = request_body } - response.to_hash["#{action}_response".to_sym] # response is a Savon::SOAP::Response, and to_hash is a Savon::SOAP::Response method - end - - def self.to_objects_array value - array = value.kind_of?(Array) ? value : [value] - array.each.collect { |element| to_object(element) } - end - - def self.to_object value - value.kind_of?(Hash) ? new(value) : value - end - - def self.create(attributes={}) - new_model = new attributes - new_model.save - new_model - end - - def self.find(id) - if(exists?(id)) - new request(find_action, id_params(id))["#{class_name.underscore}".to_sym] - else - raise Kalibro::Errors::RecordNotFound - end - end - - def save - begin - self.id = self.class.request(save_action, save_params)["#{instance_class_name.underscore}_id".to_sym] - true - rescue Exception => exception - add_error exception - false - end - end - - def destroy - begin - self.class.request(destroy_action, destroy_params) - rescue Exception => exception - add_error exception - end - end - - def self.exists?(id) - request(exists_action, id_params(id))[:exists] - end - - protected - - def fields - instance_variable_names.each.collect { |variable| variable.to_s.sub(/@/, '').to_sym } - end - - def convert_to_hash(value) - return value if value.nil? - return value.collect { |element| convert_to_hash(element) } if value.is_a?(Array) - return value.to_hash if value.is_a?(Kalibro::Model) - return self.class.date_with_milliseconds(value) if value.is_a?(DateTime) - return 'INF' if value.is_a?(Float) and value.infinite? == 1 - return '-INF' if value.is_a?(Float) and value.infinite? == -1 - value.to_s - end - - def xml_instance_class_name(object) - xml_name = object.class.name - xml_name["Kalibro::"] = "" - xml_name[0..0] = xml_name[0..0].downcase - xml_name + "Xml" - end - - def self.client(endpoint) - service_address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yml") - Savon::Client.new("#{service_address}#{endpoint}Endpoint/?wsdl") - end - - def self.is_valid?(field) - field.to_s[0] != '@' and field != :attributes! and (field.to_s =~ /xsi/).nil? - end - - def self.date_with_milliseconds(date) - milliseconds = "." + (date.sec_fraction * 60 * 60 * 24 * 1000).to_s - date.to_s[0..18] + milliseconds + date.to_s[19..-1] - end - - def instance_class_name - self.class.name.gsub(/Kalibro::/,"") - end - - def self.endpoint - class_name - end - - def save_action - "save_#{instance_class_name.underscore}".to_sym - end - - def save_params - {instance_class_name.underscore.to_sym => self.to_hash} - end - - def destroy_action - "delete_#{instance_class_name.underscore}".to_sym - end - - def destroy_params - {"#{instance_class_name.underscore}_id".to_sym => self.id} - end - - def self.class_name - self.name.gsub(/Kalibro::/,"") - end - - def self.exists_action - "#{class_name.underscore}_exists".to_sym - end - - def self.id_params(id) - {"#{class_name.underscore}_id".to_sym => id} - end - - def self.find_action - "get_#{class_name.underscore}".to_sym - end - - def add_error(exception) - @errors << exception - end - -end - diff --git a/plugins/mezuro/lib/kalibro/module.rb b/plugins/mezuro/lib/kalibro/module.rb deleted file mode 100644 index 5bd75d9..0000000 --- a/plugins/mezuro/lib/kalibro/module.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Kalibro::Module < Kalibro::Model - - attr_accessor :name, :granularity - -end diff --git a/plugins/mezuro/lib/kalibro/module_result.rb b/plugins/mezuro/lib/kalibro/module_result.rb deleted file mode 100644 index 5bb801c..0000000 --- a/plugins/mezuro/lib/kalibro/module_result.rb +++ /dev/null @@ -1,48 +0,0 @@ -class Kalibro::ModuleResult < Kalibro::Model - - attr_accessor :id, :module, :grade, :parent_id, :height - - def self.find(id) - new request(:get_module_result, { :module_result_id => id })[:module_result] - end - - def children - response = self.class.request(:children_of, {:module_result_id => id})[:module_result] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map {|module_result| Kalibro::ModuleResult.new module_result} - end - - def parents - if parent_id.nil? - [] - else - parent = self.class.find(parent_id) - parent.parents << parent - end - end - - def id=(value) - @id = value.to_i - end - - def module=(value) - @module = Kalibro::Module.to_object value - end - - def grade=(value) - @grade = value.to_f - end - - def parent_id=(value) - @parent_id = value.to_i - end - - def self.history_of(module_result_id) - response = self.request(:history_of_module, {:module_result_id => module_result_id})[:date_module_result] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map {|date_module_result| Kalibro::DateModuleResult.new date_module_result} - end - -end diff --git a/plugins/mezuro/lib/kalibro/process_time.rb b/plugins/mezuro/lib/kalibro/process_time.rb deleted file mode 100644 index 0ad0d73..0000000 --- a/plugins/mezuro/lib/kalibro/process_time.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Kalibro::ProcessTime < Kalibro::Model - - attr_accessor :state, :time - - def time=(time) - @time = time.to_i - end - -end diff --git a/plugins/mezuro/lib/kalibro/processing.rb b/plugins/mezuro/lib/kalibro/processing.rb deleted file mode 100644 index 9602fee..0000000 --- a/plugins/mezuro/lib/kalibro/processing.rb +++ /dev/null @@ -1,94 +0,0 @@ -class Kalibro::Processing < Kalibro::Model - - attr_accessor :id, :date, :state, :error, :process_time, :results_root_id - - def self.processing_of(repository_id) - if has_ready_processing(repository_id) - last_ready_processing_of(repository_id) - else #always exists a processing, we send a requisition to kalibro to process repository - last_processing_of(repository_id) - end - end - - def self.processing_with_date_of(repository_id, date) - date = date.is_a?(String) ? DateTime.parse(date) : date - if has_processing_after(repository_id, date) - first_processing_after(repository_id, date) - elsif has_processing_before(repository_id, date) - last_processing_before(repository_id, date) - else - last_processing_of(repository_id) - end - end - - def id=(value) - @id = value.to_i - end - - def date=(value) - @date = value.is_a?(String) ? DateTime.parse(value) : value - end - - def process_times=(value) - process_time=value - end - - def process_time=(value) - @process_time = Kalibro::ProcessTime.to_objects_array value - end - - def process_times - process_time - end - - def error=(value) - @error = Kalibro::Throwable.to_object value - end - - def results_root_id=(value) - @results_root_id = value.to_i - end - - private - - def self.has_processing(repository_id) - request(:has_processing, {:repository_id => repository_id})[:exists] - end - - def self.has_ready_processing(repository_id) - request(:has_ready_processing, {:repository_id => repository_id})[:exists] - end - - def self.has_processing_after(repository_id, date) - request(:has_processing_after, {:repository_id => repository_id, :date => date})[:exists] - end - - def self.has_processing_before(repository_id, date) - request(:has_processing_before, {:repository_id => repository_id, :date => date})[:exists] - end - - def self.last_processing_state_of(repository_id) - request(:last_processing_state, {:repository_id => repository_id})[:process_state] - end - - def self.last_ready_processing_of(repository_id) - new request(:last_ready_processing, {:repository_id => repository_id})[:processing] - end - - def self.first_processing_of(repository_id) - new request(:first_processing, {:repository_id => repository_id})[:processing] - end - - def self.last_processing_of(repository_id) - new request(:last_processing, {:repository_id => repository_id})[:processing] - end - - def self.first_processing_after(repository_id, date) - new request(:first_processing_after, {:repository_id => repository_id, :date => date})[:processing] - end - - def self.last_processing_before(repository_id, date) - new request(:last_processing_before, {:repository_id => repository_id, :date => date})[:processing] - end - -end diff --git a/plugins/mezuro/lib/kalibro/project.rb b/plugins/mezuro/lib/kalibro/project.rb deleted file mode 100644 index a23673b..0000000 --- a/plugins/mezuro/lib/kalibro/project.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Kalibro::Project < Kalibro::Model - - attr_accessor :id, :name, :description - - def id=(value) - @id = value.to_i - end - - def self.all - response = request(:all_projects)[:project] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map {|project| new project} - end -end diff --git a/plugins/mezuro/lib/kalibro/range.rb b/plugins/mezuro/lib/kalibro/range.rb deleted file mode 100644 index eb5860c..0000000 --- a/plugins/mezuro/lib/kalibro/range.rb +++ /dev/null @@ -1,78 +0,0 @@ -class Kalibro::Range < Kalibro::Model - - attr_accessor :id, :beginning, :end, :reading_id, :comments - - def id=(value) - @id = value.to_i - end - - def beginning=(value) - @beginning = value.to_f - @beginning = -1.0/0.0 if value == "-INF" - end - - def beginning - if !@beginning.nil? - case @beginning.to_s - when "-Infinity": "-INF" - else @beginning - end - end - end - - def end=(value) - @end = value.to_f - @end = 1.0/0.0 if value =~ /INF/ - end - - def end - if !@end.nil? - case @end.to_s - when "Infinity": "INF" - else @end - end - end - end - - def reading_id=(value) - @reading_id = value.to_i - end - - def label - reading.label - end - - def grade - reading.grade - end - - def color - reading.color - end - - def self.ranges_of( metric_configuration_id ) - response = request(:ranges_of, {:metric_configuration_id => metric_configuration_id} )[:range] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map { |range| new range } - end - - def save( metric_configuration_id ) - begin - self.id = self.class.request(:save_range, {:range => self.to_hash, :metric_configuration_id => metric_configuration_id})[:range_id] - true - rescue Exception => exception - add_error exception - false - end - end - - private - - def reading - @reading ||= Kalibro::Reading.find(reading_id) - @reading - end - -end - diff --git a/plugins/mezuro/lib/kalibro/range_snapshot.rb b/plugins/mezuro/lib/kalibro/range_snapshot.rb deleted file mode 100644 index 14f0074..0000000 --- a/plugins/mezuro/lib/kalibro/range_snapshot.rb +++ /dev/null @@ -1,17 +0,0 @@ -class Kalibro::RangeSnapshot < Kalibro::Model - - attr_accessor :beginning, :end, :label, :grade, :color, :comments - - def beginning=(value) - @beginning = ((value == "-INF") ? -1.0/0 : value.to_f) - end - - def end=(value) - @end = ((value == "INF") ? 1.0/0 : value.to_f) - end - - def grade=(value) - @grade = value.to_f - end - -end diff --git a/plugins/mezuro/lib/kalibro/reading.rb b/plugins/mezuro/lib/kalibro/reading.rb deleted file mode 100644 index 77458fe..0000000 --- a/plugins/mezuro/lib/kalibro/reading.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Kalibro::Reading < Kalibro::Model - - attr_accessor :id, :label, :grade, :color, :group_id - - def self.find(id) - new request(:get_reading, {:reading_id => id})[:reading] - end - - def self.readings_of( group_id ) - response = request(:readings_of, {:group_id => group_id})[:reading] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map { |reading| new reading } - end - - def self.reading_of( range_id ) - new request(:reading_of, {:range_id => range_id} )[:reading] - end - - def id=(value) - @id = value.to_i - end - - def grade=(value) - @grade = value.to_f - end - - private - - def save_params - {:reading => self.to_hash, :group_id => group_id} - end - -end diff --git a/plugins/mezuro/lib/kalibro/reading_group.rb b/plugins/mezuro/lib/kalibro/reading_group.rb deleted file mode 100644 index f5181fd..0000000 --- a/plugins/mezuro/lib/kalibro/reading_group.rb +++ /dev/null @@ -1,30 +0,0 @@ -class Kalibro::ReadingGroup < Kalibro::Model - - attr_accessor :id, :name, :description - - def id=(value) - @id = value.to_i - end - - def self.all - response = request(:all_reading_groups)[:reading_group] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map { |reading_group| new reading_group } - end - - def self.reading_group_of( metric_configuration_id ) - new request(:reading_group_of, {:metric_configuration_id => metric_configuration_id} )[:reading_group] - end - - private - - def self.id_params(id) - {:group_id => id} - end - - def destroy_params - {:group_id => self.id} - end - -end diff --git a/plugins/mezuro/lib/kalibro/repository.rb b/plugins/mezuro/lib/kalibro/repository.rb deleted file mode 100644 index d918f8b..0000000 --- a/plugins/mezuro/lib/kalibro/repository.rb +++ /dev/null @@ -1,42 +0,0 @@ -class Kalibro::Repository < Kalibro::Model - - attr_accessor :id, :name, :description, :license, :process_period, :type, :address, :configuration_id, :project_id - - def self.repository_types - request(:supported_repository_types)[:supported_type].to_a - end - - def self.repositories_of(project_id) - response = request(:repositories_of, {:project_id => project_id})[:repository] - response = [] if response.nil? - response = [response] if response.is_a?(Hash) - response.map {|repository| new repository} - end - - def id=(value) - @id = value.to_i - end - - def process_period=(value) - @process_period = value.to_i - end - - def configuration_id=(value) - @configuration_id = value.to_i - end - - def process - self.class.request(:process_repository, {:repository_id => self.id}) - end - - def cancel_processing_of_repository - self.class.request(:cancel_processing_of_repository, {:repository_id => self.id}) - end - - private - - def save_params - {:repository => self.to_hash, :project_id => project_id} - end - -end diff --git a/plugins/mezuro/lib/kalibro/stack_trace_element.rb b/plugins/mezuro/lib/kalibro/stack_trace_element.rb deleted file mode 100644 index 39fa8b6..0000000 --- a/plugins/mezuro/lib/kalibro/stack_trace_element.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Kalibro::StackTraceElement < Kalibro::Model - - attr_accessor :declaring_class, :method_name, :file_name, :line_number - - def line_number=(value) - @line_number = value.to_i - end - -end diff --git a/plugins/mezuro/lib/kalibro/throwable.rb b/plugins/mezuro/lib/kalibro/throwable.rb deleted file mode 100644 index ca240c3..0000000 --- a/plugins/mezuro/lib/kalibro/throwable.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Kalibro::Throwable < Kalibro::Model - - attr_accessor :target_string, :message, :cause, :stack_trace_element - - def stack_trace_element=(value) - @stack_trace_element = Kalibro::StackTraceElement.to_objects_array value - end - - def stack_trace - @stack_trace_element - end - - def stack_trace=(stack_trace) - @stack_trace_element = stack_trace - end - - def cause=(cause_value) - @cause = Kalibro::Throwable.to_object cause_value - end - -end diff --git a/plugins/mezuro/lib/mezuro_plugin.rb b/plugins/mezuro/lib/mezuro_plugin.rb deleted file mode 100644 index 6be13c1..0000000 --- a/plugins/mezuro/lib/mezuro_plugin.rb +++ /dev/null @@ -1,39 +0,0 @@ -require 'yaml' - -Savon.configure do |config| - config.log = HTTPI.log = (RAILS_ENV == 'development') -end - -class MezuroPlugin < Noosfero::Plugin - - def self.plugin_name - "Mezuro" - end - - def self.plugin_description - _("A metric analizer plugin.") - end - - def content_types - if context.profile.is_a?(Community) - MezuroPlugin::ProjectContent - else - [MezuroPlugin::ConfigurationContent, - MezuroPlugin::ReadingGroupContent] - end - end - - def control_panel_buttons - if context.profile.is_a?(Community) - {:title => _('Mezuro project'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ProjectContent'}, :icon => 'mezuro' } - else - [{:title => _('Mezuro configuration'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ConfigurationContent'}, :icon => 'mezuro' }, - {:title => _('Mezuro reading group'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ReadingGroupContent'}, :icon => 'mezuro' }] - end - end - - def stylesheet? - true - end - -end diff --git a/plugins/mezuro/lib/mezuro_plugin/configuration_content.rb b/plugins/mezuro/lib/mezuro_plugin/configuration_content.rb deleted file mode 100644 index 556ed00..0000000 --- a/plugins/mezuro/lib/mezuro_plugin/configuration_content.rb +++ /dev/null @@ -1,138 +0,0 @@ -class MezuroPlugin::ConfigurationContent < Article - validate_on_create :validate_configuration_name - - settings_items :configuration_id - - before_save :send_configuration_to_service - after_destroy :remove_configuration_from_service - - def self.short_description - 'Mezuro configuration' - end - - def self.description - 'Set of metric configurations to interpret a Kalibro project' - end - - include ActionView::Helpers::TagHelper - def to_html(options = {}) - lambda do - render :file => 'content_viewer/show_configuration.rhtml' - end - end - - def kalibro_configuration #Can't be just "configuration", method name exists somewhere in noosfero - begin - @configuration ||= Kalibro::Configuration.find(self.configuration_id) - rescue Exception => exception - errors.add_to_base(exception.message) - @configuration = nil - end - @configuration - end - - def configuration_names_and_ids - begin - all_configurations = Kalibro::Configuration.all - all_names_and_ids = all_configurations.map { |configuration| [configuration.name, configuration.id] } - [["None", -1]] + (all_names_and_ids.sort { |x,y| x.first.downcase <=> y.first.downcase }) - rescue Exception => exception - errors.add_to_base(exception.message) - [["None", -1]] - end - - end - - def description=(value) - @description=value - end - - def description - begin - @description ||= kalibro_configuration.description - rescue - @description = "" - end - @description - end - - def configuration_to_clone_id - begin - @configuration_to_clone_id - rescue Exception => exception - nil - end - end - - def configuration_to_clone_id=(value) - @configuration_to_clone_id = (value == -1) ? nil : value - end - - def metric_configurations - begin - @metric_configurations ||= Kalibro::MetricConfiguration.metric_configurations_of(configuration_id) - rescue Exception => error - errors.add_to_base(error.message) - @metric_configurations = [] - end - @metric_configurations - end - - def metric_configurations=(value) - @metric_configurations = value.kind_of?(Array) ? value : [value] - @metric_configurations = @metric_configurations.map { |element| to_metric_configuration(element) } - end - - private - - def self.to_metric_configuration value - value.kind_of?(Hash) ? Kalibro::MetricConfiguration.new(value) : value - end - - def validate_configuration_name - existing = configuration_names_and_ids.map { |a| a.first.downcase} - - if existing.include?(name.downcase) - errors.add_to_base("Configuration name already exists in Kalibro") - end - end - - def remove_configuration_from_service - kalibro_configuration.destroy unless kalibro_configuration.nil? - end - - def send_configuration_to_service - attributes = {:id => configuration_id, :name => name, :description => description} - created_configuration = Kalibro::Configuration.create attributes - self.configuration_id = created_configuration.id - clone_configuration if cloning_configuration? - end - - def cloning_configuration? - !configuration_to_clone_id.nil? - end - - def clone_configuration - metric_configurations_to_clone ||= Kalibro::MetricConfiguration.metric_configurations_of(configuration_to_clone_id) - clone_metric_configurations metric_configurations_to_clone - end - - def clone_metric_configurations metric_configurations_to_clone - metric_configurations_to_clone.each do |metric_configuration| - clonned_metric_configuration_id = metric_configuration.id - metric_configuration.id = nil - metric_configuration.configuration_id = self.configuration_id - metric_configuration.save - clone_ranges clonned_metric_configuration_id, metric_configuration.id - end - end - - def clone_ranges clonned_metric_configuration_id, new_metric_configuration_id - Kalibro::Range.ranges_of(clonned_metric_configuration_id).each do |range| - range.id = nil - range.save new_metric_configuration_id - end - end - -end - diff --git a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb b/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb deleted file mode 100644 index 1461589..0000000 --- a/plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb +++ /dev/null @@ -1,80 +0,0 @@ -class MezuroPlugin::Helpers::ContentViewerHelper - - MAX_NUMBER_OF_LABELS = 5 - - def self.format_grade(grade) - sprintf("%.2f", grade.to_f) - end - - def self.periodicity_options - [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]] - end - - def self.periodicity_option(periodicity) - periodicity_options.select {|x| x.last == periodicity}.first.first - end - - def self.license_options - options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yml") - options = options.split("; ") - options - end - - def self.generate_chart(score_history) - values = [] - labels = [] - score_history.each do |score_data| - values << score_data.result - labels << score_data.date - end - labels = discretize_array labels - Gchart.line( - :title_color => 'FF0000', - :size => '600x180', - :bg => {:color => 'efefef', :type => 'stripes'}, - :line_colors => 'c4a000', - :data => values, - :labels => labels, - :axis_with_labels => ['y','x'], - :max_value => values.max, - :min_value => values.min - ) - end - - def self.format_name(metric_configuration_snapshot) - metric_configuration_snapshot.metric.name.delete("() ") - end - - def self.format_time(miliseconds) - seconds = miliseconds/1000 - MezuroPluginModuleResultController.helpers.distance_of_time_in_words(0, seconds, include_seconds = true) - end - - def self.aggregation_options - [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] - end - - def self.scope_options - [["Software", "SOFTWARE"], ["Package", "PACKAGE"], ["Class", "CLASS"], ["Method", "METHOD"]] - end - - private - - def self.discretize_array(array) - if array.size > MAX_NUMBER_OF_LABELS - range_array.map { |i| discrete_element(array, i)} - else - array - end - end - - def self.range_array - (0..(MAX_NUMBER_OF_LABELS - 1)).to_a - end - - def self.discrete_element(array, i) - array[(i*(array.size - 1))/(MAX_NUMBER_OF_LABELS - 1)] - end - -end diff --git a/plugins/mezuro/lib/mezuro_plugin/helpers/module_result_helper.rb b/plugins/mezuro/lib/mezuro_plugin/helpers/module_result_helper.rb deleted file mode 100644 index 7eac61a..0000000 --- a/plugins/mezuro/lib/mezuro_plugin/helpers/module_result_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -class MezuroPlugin::Helpers::ModuleResultHelper - - def self.module_name name - name.is_a?(Array) ? name.last : name - end - -end diff --git a/plugins/mezuro/lib/mezuro_plugin/project_content.rb b/plugins/mezuro/lib/mezuro_plugin/project_content.rb deleted file mode 100644 index d36e341..0000000 --- a/plugins/mezuro/lib/mezuro_plugin/project_content.rb +++ /dev/null @@ -1,96 +0,0 @@ -class MezuroPlugin::ProjectContent < Article - include ActionView::Helpers::TagHelper - - settings_items :project_id - - before_save :send_project_to_service - after_destroy :destroy_project_from_service - - def self.short_description - 'Mezuro project' - end - - def self.description - 'Software project tracked by Kalibro' - end - - def to_html(options = {}) - lambda do - render :file => 'content_viewer/show_project.rhtml' - end - end - - def project - begin - @project ||= Kalibro::Project.find(project_id) - rescue Exception => error - errors.add_to_base(error.message) - end - @project - end - - def repositories - begin - @repositories ||= Kalibro::Repository.repositories_of(project_id) - rescue Exception => error - errors.add_to_base(error.message) - @repositories = [] - end - @repositories - end - - def description=(value) - @description=value - end - - def description - begin - @description ||= project.description - rescue - @description = "" - end - @description - end - - def repositories=(value) - @repositories = value.kind_of?(Array) ? value : [value] - @repositories = @repositories.map { |element| to_repository(element) } - end - - private - - def self.to_repository value - value.kind_of?(Hash) ? Kalibro::Repository.new(value) : value - end - - def validate_repository_address - repositories.each do |repository| - if (!repository.nil?) - address = repository.address - if(address.nil? || address == "") - errors.add_to_base("Repository Address is mandatory") - end - else - errors.add_to_base("Repository is mandatory") - end - end - end - - def send_project_to_service - created_project = create_kalibro_project - self.project_id = created_project.id - end - - def create_kalibro_project - Kalibro::Project.create( - :name => name, - :description => description, - :id => self.project_id - ) - end - - def destroy_project_from_service - project.destroy unless project.nil? - end - -end diff --git a/plugins/mezuro/lib/mezuro_plugin/reading_group_content.rb b/plugins/mezuro/lib/mezuro_plugin/reading_group_content.rb deleted file mode 100644 index 18b46c2..0000000 --- a/plugins/mezuro/lib/mezuro_plugin/reading_group_content.rb +++ /dev/null @@ -1,83 +0,0 @@ -class MezuroPlugin::ReadingGroupContent < Article - include ActionView::Helpers::TagHelper - - settings_items :reading_group_id - - before_save :send_reading_group_to_service - after_destroy :destroy_reading_group_from_service - - def self.short_description - 'Mezuro reading group' - end - - def self.description - 'Set of thresholds to interpret metric results' - end - - def to_html(options = {}) - lambda do - render :file => 'content_viewer/show_reading_group.rhtml' - end - end - - def reading_group - begin - @reading_group ||= Kalibro::ReadingGroup.find(reading_group_id) - rescue Exception => error - errors.add_to_base(error.message) - end - @reading_group - end - - def readings - begin - @readings ||= Kalibro::Reading.readings_of(reading_group_id) - rescue Exception => error - errors.add_to_base(error.message) - @readings = [] - end - @readings - end - - def description=(value) - @description=value - end - - def description - begin - @description ||= reading_group.description - rescue - @description = "" - end - @description - end - - def readings=(value) - @readings = value.kind_of?(Array) ? value : [value] - @readings = @readings.map { |element| to_reading(element) } - end - - private - - def self.to_reading value - value.kind_of?(Hash) ? Kalibro::Reading.new(value) : value - end - - def send_reading_group_to_service - created_reading_group = create_kalibro_reading_group - self.reading_group_id = created_reading_group.id - end - - def create_kalibro_reading_group - Kalibro::ReadingGroup.create( - :name => name, - :description => description, - :id => self.reading_group_id - ) - end - - def destroy_reading_group_from_service - reading_group.destroy unless reading_group.nil? - end - -end diff --git a/plugins/mezuro/licenses.yml.example b/plugins/mezuro/licenses.yml.example deleted file mode 100644 index df9efff..0000000 --- a/plugins/mezuro/licenses.yml.example +++ /dev/null @@ -1,69 +0,0 @@ -Academic Free License 3.0 (AFL-3.0); -Affero GNU Public License (AGPL-3.0); -Adaptive Public License (APL-1.0); -Apache License 2.0 (Apache-2.0); -Apple Public Source License (APSL-2.0); -Artistic license 2.0 (Artistic-2.0); -Attribution Assurance Licenses (AAL); -BSD 3-Clause "New" or "Revised" License (BSD-3-Clause); -BSD 2-Clause "Simplified" or "FreeBSD" License (BSD-2-Clause); -Boost Software License (BSL-1.0); -Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1); -Common Development and Distribution License 1.0 (CDDL-1.0); -Common Public Attribution License 1.0 (CPAL-1.0); -CUA Office Public License Version 1.0 (CUA-OPL-1.0); -EU DataGrid Software License (EUDatagrid); -Eclipse Public License 1.0 (EPL-1.0); -Educational Community License, Version 2.0 (ECL-2.0); -Eiffel Forum License V2.0 (EFL-2.0); -Entessa Public License (Entessa); -European Union Public License, Version 1.1 (EUPL-1.1); -Fair License (FAIR); -Frameworx License (Frameworx-1.0); -GNU Affero General Public License v3 (AGPL-3.0); -GNU General Public License version 2.0 (GPL-2.0); -GNU General Public License version 3.0 (GPL-3.0); -GNU Library or "Lesser" General Public License version 2.1 (LGPL-2.1); -GNU Library or "Lesser" General Public License version 3.0 (LGPL-3.0); -Historical Permission Notice and Disclaimer (HPND); -IBM Public License 1.0 (IPL-1.0); -IPA Font License (IPA); -ISC License (ISC); -LaTeX Project Public License 1.3c (LPPL-1.3c); -Lucent Public License Version 1.02 (LPL-1.02); -MirOS Licence (MirOS); -Microsoft Public License (Ms-PL); -Microsoft Reciprocal License (Ms-RL); -MIT license (MIT); -Motosoto License (Motosoto); -Mozilla Public License 2.0 (MPL-2.0); -Multics License (Multics); -NASA Open Source Agreement 1.3 (NASA 1.3); -NTP License (NTP); -Naumen Public License (Naumen); -Nethack General Public License (NGPL); -Nokia Open Source License (Nokia); -Non-Profit Open Software License 3.0 (NPOSL-3.0); -OCLC Research Public License 2.0 (OCLC-2.0); -Open Font License 1.1 (OFL 1.1); -Open Group Test Suite License (OGTSL); -Open Software License 3.0 (OSL-3.0); -PHP License 3.0 (PHP-3.0); -The PostgreSQL License (PostgreSQL); -Python License (Python-2.0); -CNRI Python license (CNRI-Python); -Q Public License (QPL-1.0); -RealNetworks Public Source License V1.0 (RPSL-1.0); -Reciprocal Public License 1.5 (RPL-1.5); -Ricoh Source Code Public License (RSCPL); -Simple Public License 2.0 (SimPL-2.0); -Sleepycat License (Sleepycat); -Sun Public License 1.0 (SPL-1.0); -Sybase Open Watcom Public License 1.0 (Watcom-1.0); -University of Illinois/NCSA Open Source License (NCSA); -Vovida Software License v. 1.0 (VSL-1.0); -W3C License (W3C); -wxWindows Library License (WXwindows); -X.Net License (Xnet); -Zope Public License 2.0 (ZPL-2.0); -zlib/libpng license (Zlib) diff --git a/plugins/mezuro/public/colorPicker.css b/plugins/mezuro/public/colorPicker.css deleted file mode 100644 index b16b98c..0000000 --- a/plugins/mezuro/public/colorPicker.css +++ /dev/null @@ -1,31 +0,0 @@ -div.colorPicker-picker { - height: 16px; - width: 16px; - padding: 0 !important; - border: 1px solid #ccc; - background: url(arrow.gif) no-repeat top right; - cursor: pointer; - line-height: 16px; -} - -div.colorPicker-palette { - width: 110px; - position: absolute; - border: 1px solid #598FEF; - background-color: #EFEFEF; - padding: 2px; - z-index: 9999; -} - div.colorPicker_hexWrap {width: 100%; float:left } - div.colorPicker_hexWrap label {font-size: 95%; color: #2F2F2F; margin: 5px 2px; width: 25%} - div.colorPicker_hexWrap input {margin: 5px 2px; padding: 0; font-size: 95%; border: 1px solid #000; width: 65%; } - -div.colorPicker-swatch { - height: 12px; - width: 12px; - border: 1px solid #000; - margin: 2px; - float: left; - cursor: pointer; - line-height: 12px; -} diff --git a/plugins/mezuro/public/icons/mezuro.png b/plugins/mezuro/public/icons/mezuro.png deleted file mode 100644 index dfa42f4..0000000 Binary files a/plugins/mezuro/public/icons/mezuro.png and /dev/null differ diff --git a/plugins/mezuro/public/images/file.png b/plugins/mezuro/public/images/file.png deleted file mode 100644 index e50c87f..0000000 Binary files a/plugins/mezuro/public/images/file.png and /dev/null differ diff --git a/plugins/mezuro/public/images/folder.png b/plugins/mezuro/public/images/folder.png deleted file mode 100644 index 30f0d5d..0000000 Binary files a/plugins/mezuro/public/images/folder.png and /dev/null differ diff --git a/plugins/mezuro/public/images/minus.png b/plugins/mezuro/public/images/minus.png deleted file mode 100644 index 6b8361e..0000000 Binary files a/plugins/mezuro/public/images/minus.png and /dev/null differ diff --git a/plugins/mezuro/public/images/plus.png b/plugins/mezuro/public/images/plus.png deleted file mode 100644 index c541e6e..0000000 Binary files a/plugins/mezuro/public/images/plus.png and /dev/null differ diff --git a/plugins/mezuro/public/javascripts/processing.js b/plugins/mezuro/public/javascripts/processing.js deleted file mode 100644 index a8fb39c..0000000 --- a/plugins/mezuro/public/javascripts/processing.js +++ /dev/null @@ -1,133 +0,0 @@ -var processingTree = false; -var metricName; -jQuery(function (){ - jQuery('.source-tree-link').live("click", reloadModule); - jQuery('[show-metric-history]').live("click", display_metric_history); - jQuery('[show-grade-history]').live("click", display_grade_history); - jQuery('#project_date_submit').live("click", reloadProcessingWithDate); - showLoadingProcess(true); - showProcessing(); -}); - -function showProcessing() { - repository_id = processingData('repository-id'); - callAction('processing', 'state', {repository_id: repository_id}, showProcessingFor); -} - -function display_metric_history() { - var module_result_id = jQuery(this).attr('data-module-id'); - var formatted_name = jQuery(this).attr('show-metric-history'); - var metric_name = jQuery(this).attr('data-metric-name'); - toggle_mezuro("." + formatted_name); - metricName = formatted_name; - callAction('module_result', 'metric_result_history', {metric_name: metric_name, module_result_id: module_result_id}, show_metrics); - return false; -} - -function display_grade_history() { - var module_result_id = jQuery(this).attr('data-module-id'); - toggle_mezuro("#historical-grade"); - callAction('module_result', 'module_result_history', {module_result_id: module_result_id}, show_grades); - return false; -} - -function show_metrics(content) { - jQuery('#historical-' + metricName).html(content); -} - -function show_grades(content) { - jQuery('#historical-grade').html(content); -} - -function toggle_mezuro(element){ - jQuery(element).toggle(); - return false; -} - -function reloadModule(){ - var module_result_id = jQuery(this).attr('data-module-id'); - showLoadingProcess(false); - processingTree = true; - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); - return false; -} - -function reloadProcessingWithDate(date){ - reloadProcessing(date + "T00:00:00+00:00"); - return false; -} - -function reloadProcessing(date){ - repository_id = processingData('repository-id'); - showLoadingProcess(true); - - callAction('processing', 'processing', {date: date, repository_id: repository_id}, function(content){ - showReadyProcessing(content); - var module_result_id = jQuery("#module_result_root_id").attr('module_result_root_id'); - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); - } - ); -} - -function showProcessingFor(state){ - repository_id = processingData('repository-id'); - if (state == 'ERROR') { - jQuery('#processing-state').html('
ERROR
'); - callAction('processing', 'processing', {repository_id: repository_id}, showReadyProcessing); - showModuleResult(''); - } - else if (state == 'READY') { - jQuery('#msg-time').html(''); - jQuery('#processing-state').html('
READY
'); - callAction('processing', 'processing', {repository_id: repository_id}, function(content){ - showReadyProcessing(content); - var module_result_id = jQuery("#module_result_root_id").attr('module_result_root_id'); - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); - } - ); - } - else if (state.endsWith("ING")) { - jQuery('#processing-state').html('
'+ state +'
'); - jQuery('#msg-time').html("The project analysis may take long.
You'll receive an e-mail when it's ready!"); - showProcessingAfter(20); - } -} - -function showProcessingAfter(seconds){ - if (seconds > 0){ - setTimeout(function() { showProcessingAfter(seconds - 10);}, 10000); - } else { - showProcessing(); - } -} - -function showReadyProcessing(content) { - jQuery('#processing').html(content); -} - -function showModuleResult(content){ - jQuery('#module-result').html(content); -} - -function callAction(controller, action, params, callback){ - var profile = processingData('profile'); - var content = processingData('content'); - var endpoint = '/profile/' + profile + '/plugin/mezuro/' + controller + '/' + action + '/' + content; - jQuery.get(endpoint, params, callback); -} - -function processingData(data){ - return jQuery('#processing').attr('data-' + data); -} - -function showLoadingProcess(firstLoad){ - if(firstLoad) - showReadyProcessing(""); - showModuleResult(""); -} - -function sourceNodeToggle(id){ - var suffixes = ['_hidden', '_plus', '_minus']; - for (var i in suffixes) - jQuery('#' + id + suffixes[i]).toggle(); -} diff --git a/plugins/mezuro/public/javascripts/validations.js b/plugins/mezuro/public/javascripts/validations.js deleted file mode 100644 index cde27d3..0000000 --- a/plugins/mezuro/public/javascripts/validations.js +++ /dev/null @@ -1,181 +0,0 @@ -jQuery(function (){ - jQuery('#range_submit').live("click", validate_new_range_configuration); - jQuery('#metric_configuration_submit').live("click", validate_metric_configuration); - jQuery('#repository_submit').live("click", validate_new_repository); - jQuery('#reading_submit').live("click", validate_new_reading); -}); - -function validate_code(code){ - return true; -} - -function allRequiredFieldsAreFilled() { - var name = jQuery('#repository_name').val(); - var address = jQuery('#repository_address').val(); - - if (is_null(name) || is_null(address)) { - alert("Please fill all fields marked with (*)."); - return false; - } - return true; -} - -function validate_new_reading() { - var name = jQuery('#reading_label').val(); - var grade = jQuery('#reading_grade').val(); - var color = jQuery('#reading_color').val(); - - if (is_null(name) || is_null(grade) || is_null(color)){ - alert("Please fill all fields marked with (*)."); - return false; - } - - var parser = jQuery('#labels_and_grades').attr('data-parser'); - var labels_and_grades = jQuery('#labels_and_grades').attr('data-list').split(parser); - for (var id = 0; id < labels_and_grades.length; id = id + 2) { - if (labels_and_grades[id] == name) { - alert("This label already exists! Please, choose another one."); - return false; - } - - if (labels_and_grades[id+1] == grade || labels_and_grades[id+1] == grade + ".0") { - alert("This grade already exists! Please, choose another one."); - return false; - } - } - - if (!color.match(/^[a-fA-F0-9]{6}$/)) { - alert("This is not a valid color."); - return false; - } - return true; -} - -function validate_new_repository() { - if (allRequiredFieldsAreFilled()) { - return addressAndTypeMatch(); - } - return false; -} - -function addressAndTypeMatch() { - var type = jQuery('#repository_type').val(); - var address = jQuery('#repository_address').val(); - - switch (type) { - case "BAZAAR": return matchBazaar(address); - case "CVS": return matchCVS(address); - case "GIT": return matchGIT(address); - case "MERCURIAL": return matchMercurial(address); - case "REMOTE_TARBALL": return matchRemoteTarball(address); - case "REMOTE_ZIP": return matchRemoteZIP(address); - case "SUBVERSION": return matchSubversion(address); - } -} - -function matchBazaar(address) { - if (address.match(/bzr/)) { - return true; - } - alert("Address does not match type BAZAAR chosen."); - return false; -} - -function matchCVS(address) { - if (address.match(/cvs/)) { - return true; - } - alert("Address does not match type CVS chosen."); - return false; -} - -function matchGIT(address) { - if (address.match(/^(http(s)?:\/\/git(hub)?\.|git:\/\/git(hub\.com|orious\.org)\/|git@git(hub\.com|orious\.org):).+.git$/)) { - return true; - } - alert("Address does not match type GIT chosen."); - return false; -} - -function matchMercurial(address) { - if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) { - return true; - } - alert("Address does not match type MERCURIAL chosen."); - return false; -} - -function matchRemoteTarball(address) { - if (address.match(/\.tar(\..+)*$/)) { - return true; - } - alert("Address does not match type REMOTE_TARBALL chosen."); - return false; -} - -function matchRemoteZIP(address) { - if (address.match(/\.zip$/)) { - return true; - } - alert("Address does not match type REMOTE_ZIP chosen."); - return false; -} - -function matchSubversion(address) { - if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) { - return true; - } - alert("Address does not match type SUBVERSION chosen."); - return false; -} - -function validate_metric_configuration() { - var code = jQuery('#metric_configuration_code').val(); - if (is_null(code)) { - alert("Code must be filled out"); - return false; - } - return true; -} - -function is_null(value) { - if (value == "" || value == null) { - return true; - } - return false; -} - -function IsNotNumeric(value) { - if (value.match(/[0-9]*\.?[0-9]+/)) { - return false; - } - return true; -} - -function IsNotInfinite(value) { - if (value.match(/INF/)) { - return false; - } - return true; -} - -function validate_new_range_configuration(event) { - var beginning = jQuery("#range_beginning").val(); - var end = jQuery("#range_end").val(); - - if (is_null(beginning) || is_null(end)) { - alert("Please fill all fields marked with (*)."); - return false; - } - if ( (IsNotNumeric(beginning) && IsNotInfinite(beginning)) || (IsNotNumeric(end) && IsNotInfinite(end))) { - alert("Beginning, End and Grade must be numeric values."); - return false; - } - if (parseInt(beginning) > parseInt(end)) { - if (IsNotInfinite(beginning) && IsNotInfinite(end)) { - alert("End must be greater than Beginning."); - return false; - } - } - return true; -} diff --git a/plugins/mezuro/public/style.css b/plugins/mezuro/public/style.css deleted file mode 100644 index 9f17144..0000000 --- a/plugins/mezuro/public/style.css +++ /dev/null @@ -1,37 +0,0 @@ -@import url('colorPicker.css'); - -.link { - cursor: pointer; -} - -.source-tree{ - background: #e7e7e7; - border: groove 1px #666; -} - -.icon { - width: 20px; -} - -.source-tree-text{ - font-family: Arial, Impact; - font-size: 12px; - border-left: solid 1px #666; -} - -a:link,active,visited .ancestor{ - font-family: Arial, Impact; - color: #5E5400; -} - -.path{ - font-family: Arial, Impact; - font-size: 14px; - font-style: underline; - display: inline; -} - -.controller-profile_editor a.control-panel-mezuro, - .controller-profile_editor .msie6 a.control-panel-mezuro { - background-image: url(/plugins/mezuro/icons/mezuro.png) -} diff --git a/plugins/mezuro/script/install/install-rvm.sh b/plugins/mezuro/script/install/install-rvm.sh deleted file mode 100644 index 152ef12..0000000 --- a/plugins/mezuro/script/install/install-rvm.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash --login - -#Ubuntu Package Dependencies -sudo apt-get update -sudo apt-get install build-essential curl libxslt1-dev git git-core tango-icon-theme sqlite3 libsqlite3-dev patch bzip2 openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev openjdk-6-jre - -#RVM Installation for Ubuntu 12.10 -curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --version 1.19.0 - -# Load RVM into a shell session *as a function* -if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then - # First try to load from a user install - source "$HOME/.rvm/scripts/rvm" -elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then - # Then try to load from a root install - source "/usr/local/rvm/scripts/rvm" -else - printf "ERROR: An RVM installation was not found.\n" -fi -rvm reload - -#Complements the RVM installation -rvm requirements run -#rvm pkg install zlib --verify-downloads 1 - -#Ruby installation and setup -CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rvm install 1.8.7-p302 -rvm use ruby-1.8.7-p302@global -gem install rubygems-update -v 1.3.7 -update_rubygems -gem install rake -v 0.8.7 -yes | gem uninstall rake -v 10.0.4 -rvm gemset create mezuro -rvm use ruby-1.8.7-p302@mezuro - -#Gems installation -#The order really matters here, so if you see an output like "2 gems instaled" something should be wrong -gem install --no-ri --no-rdoc rack -v 1.0.1 -gem install --no-ri --no-rdoc rack-test -v 0.6.2 -gem install --no-ri --no-rdoc httpi -v 1.0 -gem install --no-ri --no-rdoc nokogiri -v 1.5.5 -gem install --no-ri --no-rdoc wasabi -v 2.0.0 -gem install --no-ri --no-rdoc json -v 1.7.5 -gem install --no-ri --no-rdoc gherkin -v 2.5.4 -gem install --no-ri --no-rdoc multi_json -v 1.3.7 -gem install --no-ri --no-rdoc rubyzip -v 0.9.9 -gem install --no-ri --no-rdoc ffi -v 1.2.0 -gem install --no-ri --no-rdoc childprocess -v 0.3.6 -gem install --no-ri --no-rdoc websocket -v 1.0.4 -gem install --no-ri --no-rdoc libwebsocket -v 0.1.6.1 -gem install --no-ri --no-rdoc selenium-webdriver -v 2.30.0 -gem install --no-ri --no-rdoc activesupport -v 2.3.5 -gem install --no-ri --no-rdoc actionpack -v 2.3.5 -gem install --no-ri --no-rdoc actionmailer -v 2.3.5 -gem install --no-ri --no-rdoc activerecord -v 2.3.5 -gem install --no-ri --no-rdoc activeresource -v 2.3.5 -gem install --no-ri --no-rdoc addressable -v 2.2.2 -gem install --no-ri --no-rdoc builder -v 3.1.4 -gem install --no-ri --no-rdoc gyoku -v 0.4.6 -gem install --no-ri --no-rdoc akami -v 1.2.0 -gem install --no-ri --no-rdoc xpath -v 0.1.4 -gem install --no-ri --no-rdoc mime-types -v 1.19 -gem install --no-ri --no-rdoc capybara -v 1.1.1 -gem install --no-ri --no-rdoc term-ansicolor -v 1.0.7 -gem install --no-ri --no-rdoc diff-lcs -v 1.1.3 -gem install --no-ri --no-rdoc cucumber -v 1.1.0 -gem install --no-ri --no-rdoc cucumber-rails -v 0.3.2 -gem install --no-ri --no-rdoc culerity -v 0.2.15 -gem install --no-ri --no-rdoc database_cleaner -v 0.9.1 -gem install --no-ri --no-rdoc exception_notification -v 1.0.20090728 -gem install --no-ri --no-rdoc googlecharts -v 1.6.8 -gem install --no-ri --no-rdoc hpricot -v 0.8.2 -gem install --no-ri --no-rdoc httpi -v 0.9.7 -gem install --no-ri --no-rdoc i18n -v 0.4.1 -gem install --no-ri --no-rdoc metaclass -v 0.0.1 -gem install --no-ri --no-rdoc mocha -v 0.9.8 -gem install --no-ri --no-rdoc nori -v 1.1.3 -gem install --no-ri --no-rdoc ntlm-http -v 0.1.1 -gem install --no-ri --no-rdoc polyglot -v 0.3.3 -gem install --no-ri --no-rdoc rails -v 2.3.5 -gem install --no-ri --no-rdoc rcov -v 0.9.7.1 -gem install --no-ri --no-rdoc RedCloth -v 4.2.2 -gem install --no-ri --no-rdoc rspec -v 1.2.9 -gem install --no-ri --no-rdoc rspec-rails -v 1.2.9 -gem install --no-ri --no-rdoc savon -v 0.9.7 -gem install --no-ri --no-rdoc Selenium -v 1.1.14 -gem install --no-ri --no-rdoc selenium-client -v 1.2.18 -gem install --no-ri --no-rdoc sqlite3 -v 1.3.6 -gem install --no-ri --no-rdoc system_timer -v 1.2.4 -gem install --no-ri --no-rdoc tango -v 0.1.15 -gem install --no-ri --no-rdoc tidy -v 1.1.2 -gem install --no-ri --no-rdoc treetop -v 1.4.10 -gem install --no-ri --no-rdoc webrat -v 0.5.1 -gem install --no-ri --no-rdoc will_paginate -v 2.3.12 -gem install --no-ri --no-rdoc gettext -v 1.8.0 - -#Mezuro installation -git clone git@gitorious.org:+mezuro/noosfero/mezuro.git -cd mezuro -git checkout mezuro-dev -rvm use ruby-1.8.7-p302@mezuro -cp config/database.yml.sqlite3 config/database.yml -cp plugins/mezuro/service.yml.example plugins/mezuro/service.yml -cp plugins/mezuro/licenses.yml.example plugins/mezuro/licenses.yml -mkdir tmp -rake db:schema:load -rake db:migrate -rake makemo -./script/sample-data -./script/noosfero-plugins enable mezuro -cd public/designs/themes -rm -f default -git clone https://git.gitorious.org/mezuro/mezuro-theme.git -ln -s mezuro-theme/ default -cd ../../../ - -#Prepare Mezuro for running functional and unit tests -rake db:test:prepare diff --git a/plugins/mezuro/script/tests/delete_all_kalibro_entries.sh b/plugins/mezuro/script/tests/delete_all_kalibro_entries.sh deleted file mode 100755 index e2f25d9..0000000 --- a/plugins/mezuro/script/tests/delete_all_kalibro_entries.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -source plugins/mezuro/script/tests/kalibro_scripts.conf - -sudo su postgres -c "export PGPASSWORD=$PASSWORD && psql -q -d $DATABASE -f $QUERYFILE" diff --git a/plugins/mezuro/script/tests/kalibro_scripts.conf b/plugins/mezuro/script/tests/kalibro_scripts.conf deleted file mode 100644 index bf0d172..0000000 --- a/plugins/mezuro/script/tests/kalibro_scripts.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Definition of constants used in kalibro scripts. - -PSQLFILE=/tmp/PostgreSQL.sql -DATABASE="kalibro_test" -PASSWORD="kalibro" -QUERYFILE=/tmp/query \ No newline at end of file diff --git a/plugins/mezuro/script/tests/prepare_kalibro_query_file.sh b/plugins/mezuro/script/tests/prepare_kalibro_query_file.sh deleted file mode 100755 index f88c008..0000000 --- a/plugins/mezuro/script/tests/prepare_kalibro_query_file.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -source plugins/mezuro/script/tests/kalibro_scripts.conf -if ! [ -f $PSQLFILE ] - then wget http://gitorious.org/kalibro/kalibro/blobs/raw/master/KalibroCore/src/META-INF/PostgreSQL.sql -O $PSQLFILE -fi - -DROPLIMIT="END OF DROP TABLES" -RANGE=$(grep -n "$DROPLIMIT" $PSQLFILE | cut -d":" -f1) -START=1 -END=$(($RANGE - 1)) -CUT=$START,$END\!d -REPLACE="s/DROP TABLE IF EXISTS sequences,/TRUNCATE/" - -if [ -f $QUERYFILE ] - then sudo rm $QUERYFILE -fi - -sed -e "$CUT" -e "$REPLACE" $PSQLFILE > $QUERYFILE -sudo chown postgres.postgres $QUERYFILE \ No newline at end of file diff --git a/plugins/mezuro/script/tests/run_acceptance_tests.sh b/plugins/mezuro/script/tests/run_acceptance_tests.sh deleted file mode 100755 index 4b211bf..0000000 --- a/plugins/mezuro/script/tests/run_acceptance_tests.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -TEST_FILE=$1 -PROFILE=$2 - -if [ -z "$PROFILE" ]; then - PROFILE='default' -fi - -# where are your .kalibro dir? -KALIBRO_HOME='/usr/share/tomcat6/.kalibro' - -# create a kalibro test dir -echo "--> Creating tests directory" -sudo mkdir $KALIBRO_HOME/tests -echo "--> Copying test settings" -sudo cp $KALIBRO_HOME/kalibro_test.settings $KALIBRO_HOME/tests/kalibro.settings -echo "--> Changing owner of tests directory to tomcat6" -sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests - -# you must restart tomcat6 -#if you are using a tomcat installed from apt-get, for example: -sudo service tomcat6 restart - -#if you are using a tomcat installed a specific dir, for exemple: -#~/tomcat6/bin/shoutdown.sh -#~/tomcat6/bin/startup.sh - -# run test -cucumber $TEST_FILE -p $PROFILE - -#back to normal mode -echo "--> Removing tests directory" -sudo rm -rf $KALIBRO_HOME/tests - -# you must restart tomcat6 again -sudo service tomcat6 restart - -#or some thing like that... -#~/tomcat6/bin/shoutdown.sh -#~/tomcat6/bin/startup.sh - diff --git a/plugins/mezuro/service.yml.example b/plugins/mezuro/service.yml.example deleted file mode 100644 index e2127f2..0000000 --- a/plugins/mezuro/service.yml.example +++ /dev/null @@ -1 +0,0 @@ -http://localhost:8080/KalibroService/ diff --git a/plugins/mezuro/test/features/echo_port_test.rb b/plugins/mezuro/test/features/echo_port_test.rb deleted file mode 100644 index 286f25c..0000000 --- a/plugins/mezuro/test/features/echo_port_test.rb +++ /dev/null @@ -1,90 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" - -class EchoPortTest < ActiveSupport::TestCase - - def setup - @port = Kalibro::Client::Port.new('Echo') - address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yaml") - address['KalibroService'] = 'KalibroFake' - @port.service_address=(address); - end - - should 'echo base tool' do - test BaseToolFixtures.analizo, 'BaseTool' do |base_tool| - base_tool.name = "echo " + base_tool.name - end - end - - should 'echo configuration' do - test ConfigurationFixtures.kalibro_configuration, 'Configuration' do |configuration| - configuration.name = "echo " + configuration.name - end - end - - should 'echo metric configuration' do - test_metric_configuration(MetricConfigurationFixtures.amloc_configuration) - test_metric_configuration(MetricConfigurationFixtures.sc_configuration) - end - - should 'echo module result' do - test ModuleResultFixtures.create, 'ModuleResult' do |module_result| - module_result.module.name = "echo." + module_result.module.name - end - end - - should 'echo project' do - test(ProjectFixtures.qt_calculator, 'Project') do |project| - project.name = "echo " + project.name - end - end - - should 'echo project result' do - test(ProjectResultFixtures.qt_calculator, 'ProjectResult') do |project_result| - project_result.project.name = "echo " + project_result.project.name - end - end - - should 'echo raw project' do - project = ProjectFixtures.qt_calculator - echoed = @port.request(:echo_raw_project, {:project => project.to_hash})[:project] - project.name = "echo " + project.name - project.state = nil - project.error = nil - assert_equal project, Kalibro::Entities::Project.from_hash(echoed) - end - - should 'work with enums' do - test_granularity("METHOD", "CLASS") - test_granularity("CLASS", "PACKAGE") - test_granularity("PACKAGE", "PACKAGE") - test_granularity("APPLICATION", "APPLICATION") - end - - private - - def test_metric_configuration(fixture) - test fixture, 'MetricConfiguration' do |metric_configuration| - metric_configuration.code = "echo_" + metric_configuration.code - end - end - - def test(fixture, entity_name) - entity_symbol = entity_name.underscore.to_sym - request_body = {entity_symbol => fixture.to_hash} - echoed = @port.request("echo_#{entity_symbol}".to_sym, request_body)[entity_symbol] - yield fixture - entity_class = "Kalibro::Entities::#{entity_name}".constantize - assert_equal fixture, entity_class.from_hash(echoed) - end - - def test_granularity(granularity, parent) - body = {:granularity => granularity} - assert_equal parent, @port.request(:infer_parent_granularity, body)[:parent_granularity] - end - -end diff --git a/plugins/mezuro/test/fixtures/base_tool_fixtures.rb b/plugins/mezuro/test/fixtures/base_tool_fixtures.rb deleted file mode 100644 index 0a38a6b..0000000 --- a/plugins/mezuro/test/fixtures/base_tool_fixtures.rb +++ /dev/null @@ -1,19 +0,0 @@ -require File.dirname(__FILE__) + '/metric_fixtures' - -class BaseToolFixtures - - def self.base_tool - Kalibro::BaseTool.new base_tool_hash - end - - def self.base_tool_hash - { - :name => 'Analizo', - :supported_metric => [ - MetricFixtures.total_cof_hash, - MetricFixtures.amloc_hash], - :collector_class_name => "org.analizo.AnalizoMetricCollector" - } - end - -end diff --git a/plugins/mezuro/test/fixtures/configuration_content_fixtures.rb b/plugins/mezuro/test/fixtures/configuration_content_fixtures.rb deleted file mode 100644 index 1ab33e9..0000000 --- a/plugins/mezuro/test/fixtures/configuration_content_fixtures.rb +++ /dev/null @@ -1,23 +0,0 @@ -class ConfigurationContentFixtures - - def self.configuration_content - MezuroPlugin::ConfigurationContent.new configuration_content_hash - end - - def self.created_configuration_content - MezuroPlugin::ConfigurationContent.new( { - :name => 'Sample Configuration', - :description => 'Kalibro configuration for Java projects.', - :configuration_id => nil - } ) - end - - def self.configuration_content_hash - { - :name => 'Sample Configuration', - :description => 'Kalibro configuration for Java projects.', - :configuration_id => "42" - } - end - -end diff --git a/plugins/mezuro/test/fixtures/configuration_fixtures.rb b/plugins/mezuro/test/fixtures/configuration_fixtures.rb deleted file mode 100644 index 30e4f09..0000000 --- a/plugins/mezuro/test/fixtures/configuration_fixtures.rb +++ /dev/null @@ -1,28 +0,0 @@ -require File.dirname(__FILE__) + '/metric_configuration_fixtures' - -class ConfigurationFixtures - - def self.configuration - Kalibro::Configuration.new configuration_hash - end - - def self.created_configuration - Kalibro::Configuration.new({ - :name => 'Created Sample Configuration', - :description => 'Kalibro configuration for Java projects.' - }) - end - - def self.configuration_hash - { - :id => "42", - :name => 'Sample Configuration', - :description => 'Kalibro configuration for Java projects.' - } - end - - def self.all - [configuration] - end - -end diff --git a/plugins/mezuro/test/fixtures/date_metric_result_fixtures.rb b/plugins/mezuro/test/fixtures/date_metric_result_fixtures.rb deleted file mode 100644 index c537f9f..0000000 --- a/plugins/mezuro/test/fixtures/date_metric_result_fixtures.rb +++ /dev/null @@ -1,33 +0,0 @@ -require File.dirname(__FILE__) + '/metric_result_fixtures' - -class DateMetricResultFixtures - - def self.date_metric_result - Kalibro::DateMetricResult.new date_metric_result_hash - end - - def self.date_metric_result_hash - { - :date => '2011-10-20T18:26:43.151+00:00', - :metric_result => MetricResultFixtures.native_metric_result_hash, - :attributes! => - { - :metric_result => - { - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", - "xsi:type"=>"kalibro:metricResultXml" - } - } - } - end - - def self.score_history - result = [] - result << date_metric_result - newer_date_metric_result = date_metric_result - newer_date_metric_result.date = '2011-10-25T18:26:43.151+00:00' - newer_date_metric_result.metric_result.value = 5.0 - result << newer_date_metric_result - end - -end diff --git a/plugins/mezuro/test/fixtures/date_module_result_fixtures.rb b/plugins/mezuro/test/fixtures/date_module_result_fixtures.rb deleted file mode 100644 index d49b4c5..0000000 --- a/plugins/mezuro/test/fixtures/date_module_result_fixtures.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.dirname(__FILE__) + '/module_result_fixtures' - -class DateModuleResultFixtures - - def self.date_module_result - Kalibro::DateModuleResult.new date_module_result_hash - end - - def self.date_module_result_hash - { - :date => '2011-10-20T18:26:43.151+00:00', - :module_result => ModuleResultFixtures.module_result_hash, - :attributes! => - { - :module_result => - { - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", - "xsi:type"=>"kalibro:moduleResultXml" - } - } - } - end - -end diff --git a/plugins/mezuro/test/fixtures/metric_configuration_fixtures.rb b/plugins/mezuro/test/fixtures/metric_configuration_fixtures.rb deleted file mode 100644 index fdcf7ef..0000000 --- a/plugins/mezuro/test/fixtures/metric_configuration_fixtures.rb +++ /dev/null @@ -1,58 +0,0 @@ -require File.dirname(__FILE__) + '/metric_fixtures' - -class MetricConfigurationFixtures - - def self.amloc_metric_configuration - amloc = Kalibro::MetricConfiguration.new amloc_metric_configuration_hash - amloc.configuration_id = "13" - amloc - end - - def self.sc_metric_configuration - sc = Kalibro::MetricConfiguration.new sc_metric_configuration_hash - sc.configuration_id = "13" - sc - end - - def self.created_metric_configuration - Kalibro::MetricConfiguration.new({ - :code => 'amloc', - :metric => MetricFixtures.amloc_hash, - :base_tool_name => "Analizo", - :weight => "1.0", - :aggregation_form => 'AVERAGE', - :reading_group_id => "31", - :configuration_id => "13" - }) - end - - def self.amloc_metric_configuration_hash - { - :id => "42", - :code => 'amloc', - :metric => MetricFixtures.amloc_hash, - :base_tool_name => "Analizo", - :weight => "1.0", - :aggregation_form => 'AVERAGE', - :reading_group_id => "31", - :attributes! => {:metric => { - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:metricXml' }} - } - end - - def self.sc_metric_configuration_hash - { - :id => "42", - :code => 'sc', - :metric => MetricFixtures.compound_metric_hash, - :weight => "1.0", - :aggregation_form => 'AVERAGE', - :reading_group_id => "31", - :attributes! => {:metric => { - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:metricXml' }} - } - end - -end diff --git a/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb b/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb deleted file mode 100644 index 1aae495..0000000 --- a/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb +++ /dev/null @@ -1,62 +0,0 @@ -require File.dirname(__FILE__) + '/metric_fixtures' -require File.dirname(__FILE__) + '/range_snapshot_fixtures' - -class MetricConfigurationSnapshotFixtures - - def self.metric_configuration_snapshot - Kalibro::MetricConfigurationSnapshot.new metric_configuration_snapshot_hash - end - - def self.metric_configuration_snapshot_hash - { - :code => "code", - :weight => "1.0", - :aggregation_form => 'AVERAGE', - :metric => MetricFixtures.amloc_hash, - :base_tool_name => "Analizo", - :range => [RangeSnapshotFixtures.range_snapshot_hash], - :attributes! => { - :metric => { - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:metricXml' }, - :range => { - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:rangeSnapshotXml' } - } - } - end - - def self.metric_configuration_snapshot_with_2_elements - Kalibro::MetricConfigurationSnapshot.new metric_configuration_snapshot_hash_with_2_elements - end - - def self.metric_configuration_snapshot_hash_with_2_elements - hash = self.metric_configuration_snapshot_hash - hash[:range] << RangeSnapshotFixtures.range_snapshot_hash - hash - end - - def self.compound_metric_configuration_snapshot - Kalibro::MetricConfigurationSnapshot.new compound_metric_configuration_snapshot_hash - end - - def self.compound_metric_configuration_snapshot_hash - { - :code => "code", - :weight => "1.0", - :aggregation_form => 'AVERAGE', - :metric => MetricFixtures.compound_metric, - :base_tool_name => "Analizo", - :range => [RangeSnapshotFixtures.range_snapshot_hash], - :attributes! => { - :metric => { - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:metricXml' }, - :range => { - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:type' => 'kalibro:rangeSnapshotXml' } - } - } - end - -end diff --git a/plugins/mezuro/test/fixtures/metric_fixtures.rb b/plugins/mezuro/test/fixtures/metric_fixtures.rb deleted file mode 100644 index f036072..0000000 --- a/plugins/mezuro/test/fixtures/metric_fixtures.rb +++ /dev/null @@ -1,27 +0,0 @@ -class MetricFixtures - - def self.compound_metric - Kalibro::Metric.new compound_metric_hash - end - - def self.compound_metric_hash - {:name => 'Structural Complexity', :compound => "true", :scope => 'CLASS', :script => 'return 42;', :description => 'Calculate the Structural Complexity of the Code'} - end - - def self.total_cof - Kalibro::Metric.new total_cof_hash - end - - def self.total_cof_hash - {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']} - end - - def self.amloc - Kalibro::Metric.new amloc_hash - end - - def self.amloc_hash - {:name => 'Average Method LOC', :compound => "false", :scope => 'CLASS', :language => ['JAVA']} - end - -end diff --git a/plugins/mezuro/test/fixtures/metric_result_fixtures.rb b/plugins/mezuro/test/fixtures/metric_result_fixtures.rb deleted file mode 100644 index f34f0c0..0000000 --- a/plugins/mezuro/test/fixtures/metric_result_fixtures.rb +++ /dev/null @@ -1,54 +0,0 @@ -require File.dirname(__FILE__) + '/metric_configuration_snapshot_fixtures' -require File.dirname(__FILE__) + '/throwable_fixtures' - -class MetricResultFixtures - - def self.native_metric_result - Kalibro::MetricResult.new native_metric_result_hash - end - - def self.compound_metric_result - Kalibro::MetricResult.new compound_metric_result_hash - end - - def self.metric_result_with_error_hash - { - :id => "41", - :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash, - :error => ThrowableFixtures.throwable_hash - } - end - - def self.native_metric_result_hash - { - :id => "42", - :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash, - :value => "0.0", - :attributes! => - { - :configuration => - { - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", - "xsi:type"=>"kalibro:metricConfigurationSnapshotXml" - } - } - } - end - - def self.compound_metric_result_hash - { - :id => "43", - :configuration => MetricConfigurationSnapshotFixtures.compound_metric_configuration_snapshot_hash, - :value => "1.0", - :attributes! => - { - :configuration => - { - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", - "xsi:type"=>"kalibro:metricConfigurationSnapshotXml" - } - } - } - end - -end diff --git a/plugins/mezuro/test/fixtures/module_fixtures.rb b/plugins/mezuro/test/fixtures/module_fixtures.rb deleted file mode 100644 index c3ed98a..0000000 --- a/plugins/mezuro/test/fixtures/module_fixtures.rb +++ /dev/null @@ -1,14 +0,0 @@ -class ModuleFixtures - - def self.module - Kalibro::Module.new module_hash - end - - def self.module_hash - { - :name => 'Qt-Calculator', - :granularity => 'APPLICATION' - } - end - -end diff --git a/plugins/mezuro/test/fixtures/module_result_fixtures.rb b/plugins/mezuro/test/fixtures/module_result_fixtures.rb deleted file mode 100644 index bc04d34..0000000 --- a/plugins/mezuro/test/fixtures/module_result_fixtures.rb +++ /dev/null @@ -1,44 +0,0 @@ -require File.dirname(__FILE__) + '/module_fixtures' - -class ModuleResultFixtures - - def self.module_result - Kalibro::ModuleResult.new module_result_hash - end - - def self.module_result_hash - { - :id => "42", - :module => ModuleFixtures.module_hash, - :grade => "10.0", - :parent_id => "31", - :attributes! => - { - :module => - { - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", - "xsi:type"=>"kalibro:moduleXml" - } - } - } - end - - def self.parent_module_result_hash - { - :id => "31", - :module => { - :name => 'Qt-Calculator Parent', - :granularity => 'APPLICATION' - }, - :grade => "10.0", - :attributes! => - { - :module => - { - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", - "xsi:type"=>"kalibro:moduleXml" - } - } - } - end -end diff --git a/plugins/mezuro/test/fixtures/process_time_fixtures.rb b/plugins/mezuro/test/fixtures/process_time_fixtures.rb deleted file mode 100644 index ece195f..0000000 --- a/plugins/mezuro/test/fixtures/process_time_fixtures.rb +++ /dev/null @@ -1,11 +0,0 @@ -class ProcessTimeFixtures - - def self.process_time - Kalibro::ProcessTime.new process_time_hash - end - - def self.process_time_hash - {:state => "Ready", :time => "1"} - end - -end diff --git a/plugins/mezuro/test/fixtures/processing_fixtures.rb b/plugins/mezuro/test/fixtures/processing_fixtures.rb deleted file mode 100644 index b56dcd4..0000000 --- a/plugins/mezuro/test/fixtures/processing_fixtures.rb +++ /dev/null @@ -1,30 +0,0 @@ -require File.dirname(__FILE__) + '/process_time_fixtures' -require File.dirname(__FILE__) + '/throwable_fixtures' - -class ProcessingFixtures - - def self.processing - Kalibro::Processing.new processing_hash - end - - def self.processing_hash - { - :id => "31", - :date => '2011-10-20T18:26:43.151+00:00', - :state => 'READY', - :process_time => [ProcessTimeFixtures.process_time_hash], - :results_root_id => "13" - } - end - - def self.processing_with_error_hash - { - :id => "31", - :date => '2011-10-20T18:26:43.151+00:00', - :state => 'ERROR', - :process_time => [ProcessTimeFixtures.process_time_hash], - :error => ThrowableFixtures.throwable_hash - } - end - -end diff --git a/plugins/mezuro/test/fixtures/project_content_fixtures.rb b/plugins/mezuro/test/fixtures/project_content_fixtures.rb deleted file mode 100644 index 11e2265..0000000 --- a/plugins/mezuro/test/fixtures/project_content_fixtures.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ProjectContentFixtures - - def self.project_content - content = MezuroPlugin::ProjectContent.new - content.project_id = 42 - content - end - -end diff --git a/plugins/mezuro/test/fixtures/project_fixtures.rb b/plugins/mezuro/test/fixtures/project_fixtures.rb deleted file mode 100644 index 8c18f90..0000000 --- a/plugins/mezuro/test/fixtures/project_fixtures.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.dirname(__FILE__) + '/repository_fixtures' - -class ProjectFixtures - - def self.project - Kalibro::Project.new project_hash - end - - def self.created_project - Kalibro::Project.new :name => 'Qt-Calculator', :description => 'Calculator for Qt' - end - - def self.project_hash - { - :id => "42", - :name => 'Qt-Calculator', - :description => 'Calculator for Qt' - } - end -end diff --git a/plugins/mezuro/test/fixtures/range_fixtures.rb b/plugins/mezuro/test/fixtures/range_fixtures.rb deleted file mode 100644 index f57c51d..0000000 --- a/plugins/mezuro/test/fixtures/range_fixtures.rb +++ /dev/null @@ -1,19 +0,0 @@ -class RangeFixtures - - def self.range - Kalibro::Range.new range_hash - end - - def self.created_range - Kalibro::Range.new created_range_hash - end - - def self.created_range_hash - {:beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1"} - end - - def self.range_hash - {:id => "1", :beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1"} - end - -end diff --git a/plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb b/plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb deleted file mode 100644 index 6e0c236..0000000 --- a/plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb +++ /dev/null @@ -1,19 +0,0 @@ -class RangeSnapshotFixtures - - def self.range_snapshot - Kalibro::RangeSnapshot.new range_snapshot_hash - end - - def self.range_snapshot_with_infinite_range - Kalibro::RangeSnapshot.new range_snapshot_with_infinite_range_hash - end - - def self.range_snapshot_hash - { :beginning => "1.1", :end => "5.1", :label => "snapshot", :grade => "10.1", :color => "FF2284", :comments => "comment" } - end - - def self.range_snapshot_with_infinite_range_hash - { :beginning => "-INF", :end => "INF", :label => "snapshot", :grade => "10.1", :color => "FF2284", :comments => "comment" } - end - -end diff --git a/plugins/mezuro/test/fixtures/reading_fixtures.rb b/plugins/mezuro/test/fixtures/reading_fixtures.rb deleted file mode 100644 index 57faf53..0000000 --- a/plugins/mezuro/test/fixtures/reading_fixtures.rb +++ /dev/null @@ -1,16 +0,0 @@ -class ReadingFixtures - - def self.reading - Kalibro::Reading.new reading_hash - end - - def self.created_reading # A created object has no id before being sent to kalibro - Kalibro::Reading.new :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC", :group_id => "31" - end - - def self.reading_hash - {:id => "42", :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC", :group_id => "31"} - end - -end - diff --git a/plugins/mezuro/test/fixtures/reading_group_content_fixtures.rb b/plugins/mezuro/test/fixtures/reading_group_content_fixtures.rb deleted file mode 100644 index 2c306fe..0000000 --- a/plugins/mezuro/test/fixtures/reading_group_content_fixtures.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ReadingGroupContentFixtures - - def self.reading_group_content - content = MezuroPlugin::ReadingGroupContent.new - content.reading_group_id = 42 - content - end - -end diff --git a/plugins/mezuro/test/fixtures/reading_group_fixtures.rb b/plugins/mezuro/test/fixtures/reading_group_fixtures.rb deleted file mode 100644 index 41f68a5..0000000 --- a/plugins/mezuro/test/fixtures/reading_group_fixtures.rb +++ /dev/null @@ -1,15 +0,0 @@ -class ReadingGroupFixtures - - def self.reading_group - Kalibro::ReadingGroup.new reading_group_hash - end - - def self.created_reading_group # A created object has no id before being sent to kalibro - Kalibro::ReadingGroup.new :name => "Reading Group Test", :description => "Reading group in the fixtures" - end - - def self.reading_group_hash - {:id => "42", :name => "Reading Group Test", :description => "Reading group in the fixtures"} - end - -end diff --git a/plugins/mezuro/test/fixtures/repository_fixtures.rb b/plugins/mezuro/test/fixtures/repository_fixtures.rb deleted file mode 100644 index 4a5c515..0000000 --- a/plugins/mezuro/test/fixtures/repository_fixtures.rb +++ /dev/null @@ -1,28 +0,0 @@ -class RepositoryFixtures - - def self.repository - Kalibro::Repository.new repository_hash - end - - def self.created_repository - Kalibro::Repository.new({ - :name => "test created repository", - :description => "test description", - :license => "GPL", - :process_period => "1", - :type => 'SUBVERSION', - :address => 'https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator', - :configuration_id => "31", - :project_id => "32" - }) - end - - def self.repository_hash - {: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", :project_id => "32"} - end - - def self.types - ["SUBVERSION", "GIT"] - end - -end diff --git a/plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb b/plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb deleted file mode 100644 index 30777ad..0000000 --- a/plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb +++ /dev/null @@ -1,16 +0,0 @@ -class StackTraceElementFixtures - - def self.stack_trace_element - Kalibro::StackTraceElement.new stack_trace_element_hash - end - - def self.stack_trace_element_hash - { - :declaring_class => 'my.declaring.Class', - :method_name => 'my method name', - :file_name => 'MyFile.java', - :line_number => '42' - } - end - -end diff --git a/plugins/mezuro/test/fixtures/throwable_fixtures.rb b/plugins/mezuro/test/fixtures/throwable_fixtures.rb deleted file mode 100644 index 4de270f..0000000 --- a/plugins/mezuro/test/fixtures/throwable_fixtures.rb +++ /dev/null @@ -1,19 +0,0 @@ -require File.dirname(__FILE__) + '/stack_trace_element_fixtures' - -class ThrowableFixtures - - def self.throwable - Kalibro::Throwable.new throwable_hash - end - - def self.throwable_hash - { - :target_string => 'Target String', - :message => 'Throwable message from ThrowableTest', - :stack_trace_element => [ - StackTraceElementFixtures.stack_trace_element_hash, StackTraceElementFixtures.stack_trace_element_hash - ] - } - end - -end diff --git a/plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb b/plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb deleted file mode 100644 index d26f750..0000000 --- a/plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb +++ /dev/null @@ -1,228 +0,0 @@ -require 'test_helper' - -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" - -class MezuroPluginMyprofileControllerTest < ActionController::TestCase - - def setup - @controller = MezuroPluginMyprofileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Community) - - @base_tool = BaseToolFixtures.base_tool - @base_tool_hash = BaseToolFixtures.base_tool_hash - @metric = NativeMetricFixtures.amloc - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration - @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash - @compound_metric_configuration = MetricConfigurationFixtures.sc_metric_configuration - @compound_metric_configuration_hash = MetricConfigurationFixtures.sc_metric_configuration_hash - @configuration = ConfigurationFixtures.configuration - @configuration_hash = ConfigurationFixtures.configuration_hash - - Kalibro::Configuration.expects(:all_names).returns([]) - @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name) - @content.expects(:send_kalibro_configuration_to_service).returns(nil) - @content.stubs(:solr_save) - @content.save - - @native_hash = @metric_configuration.to_hash.merge({:configuration_name => @metric_configuration.configuration_name}) - @native_hash.delete :attributes! - @compound_hash = @compound_metric_configuration.to_hash.merge({:configuration_name => @compound_metric_configuration.configuration_name}) - @compound_hash.delete :attributes! - - @range = RangeFixtures.range_excellent - @range_hash = RangeFixtures.range_excellent_hash - end - - should 'test choose base tool' do - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool_names).returns({:base_tool_name => @base_tool.name}) - get :choose_base_tool, :profile => @profile.identifier, :id => @content.id - assert_equal [@base_tool.name], assigns(:base_tools) - assert_equal @content, assigns(:configuration_content) - assert_response 200 - end - - should 'test choose metric' do - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) - get :choose_metric, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name - assert_equal @content, assigns(:configuration_content) - assert_equal @base_tool.name, assigns(:base_tool) - assert_equal @base_tool.supported_metric[0].name, assigns(:supported_metrics)[0].name - assert_response 200 - end - - should 'test new metric configuration' do - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash}) - get :new_metric_configuration, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name, :metric_name => @metric.name - assert_equal @content, assigns(:configuration_content) - assert_equal @metric.name, assigns(:metric).name - assert_response 200 - end - - - should 'test new compound metric configuration' do - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) - get :new_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id - assert_equal @content, assigns(:configuration_content) - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code - assert_response 200 - end - - should 'test edit metric configuration' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) - get :edit_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name - assert_equal @content, assigns(:configuration_content) - assert_equal @metric_configuration.code, assigns(:metric_configuration).code - assert_equal @metric_configuration.metric.name, assigns(:metric).name - assert_response 200 - end - - should 'test edit compound metric configuration' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash}) - get :edit_compound_metric_configuration, - :profile => @profile.identifier, - :id => @content.id, - :metric_name => @compound_metric_configuration.metric.name - assert_equal @content, assigns(:configuration_content) - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code - assert_response 200 - end - - should 'test create native metric configuration' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { - :metric_configuration => @metric_configuration.to_hash, - :configuration_name => @metric_configuration.configuration_name}) - get :create_metric_configuration, - :profile => @profile.identifier, - :id => @content.id, - :metric_configuration => @native_hash - assert_response 302 - end - - should 'test compound metric creation' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { - :metric_configuration => @compound_metric_configuration.to_hash, - :configuration_name => @compound_metric_configuration.configuration_name}) - get :create_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, - :metric_configuration => @compound_hash - assert_response 302 - end - - should 'test update native metric configuration' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash}) - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { - :metric_configuration => @metric_configuration.to_hash, - :configuration_name => @metric_configuration.configuration_name}) - get :update_metric_configuration, :profile => @profile.identifier, :id => @content.id, - :metric_configuration => @native_hash - assert_equal @content, assigns(:configuration_content) - assert_response 302 - end - - should 'test update compound metric configuration' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash}) - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { - :metric_configuration => @compound_metric_configuration.to_hash, - :configuration_name => @compound_metric_configuration.configuration_name}) - get :update_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id, - :metric_configuration => @compound_hash - assert_equal @content, assigns(:configuration_content) - assert_response 302 - end - - should 'test remove metric configuration' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :remove_metric_configuration, { - :metric_name => @metric.name, - :configuration_name => @metric_configuration.configuration_name}) - get :remove_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name - assert_response 302 - end - - should 'test new range' do - get :new_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name - assert_equal @content, assigns(:configuration_content) - assert_equal @metric.name, assigns(:metric_name) - assert_response 200 - end - - should 'test edit range' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) - get :edit_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name, :beginning_id => @range.beginning - assert_equal @content, assigns(:configuration_content) - assert_equal @metric.name, assigns(:metric_name) - assert_equal @range.beginning, assigns(:beginning_id) - assert_equal @range.end, assigns(:range).end - assert_response 200 - end - - should 'test create instance range' do - metric_configuration = @metric_configuration - metric_configuration.add_range(@range) - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { - :metric_configuration => metric_configuration.to_hash, - :configuration_name => metric_configuration.configuration_name}) - get :create_range, :profile => @profile.identifier, :range => @range_hash, :id => @content.id, :metric_name => @metric.name - assert_equal @content, assigns(:configuration_content) - assert_equal @range.end, assigns(:range).end - assert_response 200 - end - - should 'test update range' do - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { - :metric_configuration => @metric_configuration.to_hash, - :configuration_name => @metric_configuration.configuration_name}) - get :update_range, - :profile => @profile.identifier, - :range => @range_hash, - :id => @content.id, - :metric_name => @metric.name, - :beginning_id => @range.beginning - assert_response 200 - end - - should 'test remove range' do - metric_configuration = @metric_configuration - metric_configuration.ranges.delete_if { |range| range.beginning == @range.beginning.to_f } - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, { - :configuration_name => @content.name, - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash}) - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, { - :metric_configuration => metric_configuration.to_hash, - :configuration_name => metric_configuration.configuration_name}) - get :remove_range, - :profile => @profile.identifier, - :id => @content.id, - :metric_name => @metric.name, - :beginning_id => @range.beginning - assert_response 302 - end - -end diff --git a/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb b/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb deleted file mode 100644 index 0ca11dd..0000000 --- a/plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb +++ /dev/null @@ -1,141 +0,0 @@ -require 'test_helper' - -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures" - -class MezuroPluginProfileControllerTest < ActionController::TestCase - - def setup - @controller = MezuroPluginProfileController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Community) - - @project_result = ProjectResultFixtures.project_result - @module_result = ModuleResultFixtures.module_result - @repository_url = RepositoryFixtures.repository.address - @project = @project_result.project - @date = "2012-04-13T20:39:41+04:00" - - Kalibro::Project.expects(:all_names).returns([]) - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @project.name, :repository_url => @repository_url) - @content.expects(:send_project_to_service).returns(nil) - @content.save - end - - should 'test project state without kalibro_error' do - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) - get :project_state, :profile => @profile.identifier, :id => @content.id - assert_response 200 - assert_equal @content, assigns(:content) - end - - should 'test project state with kalibro_error' do - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) - get :project_state, :profile => @profile.identifier, :id => @content.id - assert_response 200 - assert_equal "ERROR", @response.body - assert_equal @content, assigns(:content) - end - - should 'test project error' do - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})}) - get :project_error, :profile => @profile.identifier, :id => @content.id - assert_response 200 - assert_select('h3', 'ERROR') - assert_equal @content, assigns(:content) - assert_equal @project.name, assigns(:project).name - end - - should 'test project result without date' do - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => nil - assert_equal @content, assigns(:content) - assert_equal @project_result.project.name, assigns(:project_result).project.name - assert_response 200 - assert_select('h4', 'Last Result') - end - - should 'test project results from a specific date' do - request_body = {:project_name => @project.name, :date => @date} - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @date - assert_equal @content, assigns(:content) - assert_equal @project_result.project.name, assigns(:project_result).project.name - assert_response 200 - assert_select('h4', 'Last Result') - end - - - should 'get module result without date' do - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) - Kalibro::ProjectResult.expects(:request). - with("ProjectResult", :get_last_result_of, {:project_name => @project.name}). - returns({:project_result => @project_result.to_hash}) - Kalibro::ModuleResult.expects(:request). - with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}). - returns({:module_result => @module_result.to_hash}) - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil - assert_equal @content, assigns(:content) - assert_equal @module_result.grade, assigns(:module_result).grade - assert_response 200 - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') - end - - should 'get module result with a specific date' do - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) - request_body = {:project_name => @project.name, :date => @project_result.date} - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}).returns({:module_result => @module_result.to_hash}) - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date - assert_equal @content, assigns(:content) - assert_equal @module_result.grade, assigns(:module_result).grade - assert_response 200 - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') - end - - should 'test project tree without date' do - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil - assert_equal @content, assigns(:content) - assert_equal @project.name, assigns(:project_name) - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name - assert_response 200 - assert_select('h2', /Qt-Calculator/) - end - - should 'test project tree with a specific date' do - request_body = {:project_name => @project.name, :date => @project_result.date} - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date - assert_equal @content, assigns(:content) - assert_equal @project.name, assigns(:project_name) - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name - assert_response 200 - end - - should 'test module metrics history' do - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) - get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, - :metric_name => @module_result.metric_result.first.metric.name.delete("() ") - assert_equal @content, assigns(:content) - assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history) - assert_response 200 - end - - should 'test grade history' do - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) - get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name - assert_equal @content, assigns(:content) - assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history) - assert_response 200 - end - -end diff --git a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_metric_configuration_controller_test.rb b/plugins/mezuro/test/functional/myprofile/mezuro_plugin_metric_configuration_controller_test.rb deleted file mode 100644 index e9f6589..0000000 --- a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_metric_configuration_controller_test.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'test_helper' - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" - -class MezuroPluginMetricConfigurationControllerTest < ActionController::TestCase - - def setup - @controller = MezuroPluginMetricConfigurationController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Profile) - - @configuration = ConfigurationFixtures.configuration - @created_configuration = ConfigurationFixtures.created_configuration - @configuration_hash = ConfigurationFixtures.configuration_hash - - @configuration_content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name, :configuration_id => 42) - @configuration_content.expects(:send_configuration_to_service).returns(nil) - @configuration_content.expects(:validate_configuration_name).returns(true) - @configuration_content.save - - @base_tool = BaseToolFixtures.base_tool - @base_tool_hash = BaseToolFixtures.base_tool_hash - - @metric = MetricFixtures.amloc - - @reading_group = ReadingGroupFixtures.reading_group - @range = RangeFixtures.range - @reading = ReadingFixtures.reading - - @native_metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration - @native_metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash - @created_metric_configuration = MetricConfigurationFixtures.created_metric_configuration - @compound_metric_configuration = MetricConfigurationFixtures.sc_metric_configuration - @compound_metric_configuration_hash = MetricConfigurationFixtures.sc_metric_configuration_hash - end - - should 'choose metric' do - Kalibro::BaseTool.expects(:all).returns([@base_tool]) - get :choose_metric, :profile => @profile.identifier, :id => @configuration_content.id - assert_equal @configuration_content, assigns(:configuration_content) - assert_equal [@base_tool], assigns(:base_tools) - assert_response :success - end - - should 'initialize native' do - Kalibro::BaseTool.expects(:find_by_name).with(@base_tool.name).returns(@base_tool) - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) - get :new_native, :profile => @profile.identifier, :id => @configuration_content.id, :base_tool_name => @base_tool.name, :metric_name => @metric.name - assert_equal @configuration_content, assigns(:configuration_content) - assert_equal @metric.name, assigns(:metric).name - assert_equal @base_tool.name, assigns(:metric_configuration).base_tool_name - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) - assert_response :success - end - - should 'edit native' do - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@native_metric_configuration]) - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) - Kalibro::Range.expects(:ranges_of).with(@native_metric_configuration.id).returns([@range]) - Kalibro::Reading.expects(:find).with(@range.reading_id).returns(@reading) - get :edit_native, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @native_metric_configuration.id - assert_equal @configuration_content, assigns(:configuration_content) - assert_equal @native_metric_configuration.code, assigns(:metric_configuration).code - assert_equal @native_metric_configuration.metric.name, assigns(:metric).name - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) - assert_equal [@range], assigns(:ranges) - assert_response :success - end - - should 'initialize compound' do - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration_content.configuration_id).returns([@compound_metric_configuration]) - get :new_compound, :profile => @profile.identifier, :id => @configuration_content.id - assert_equal @configuration_content, assigns(:configuration_content) - assert_equal @compound_metric_configuration.code, assigns(:metric_configurations).first.code - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) - assert_response :success - end - - should 'edit compound' do - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@compound_metric_configuration]) - Kalibro::ReadingGroup.expects(:all).returns([@reading_group]) - Kalibro::Range.expects(:ranges_of).with(@compound_metric_configuration.id).returns([@range]) - Kalibro::Reading.expects(:find).with(@range.reading_id).returns(@reading) - get :edit_compound, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @compound_metric_configuration.id - assert_equal @configuration_content, assigns(:configuration_content) - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name - assert_equal [@compound_metric_configuration], assigns(:metric_configurations) - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids) - assert_equal [@range], assigns(:ranges) - assert_response :success - end - - should 'create' do - Kalibro::MetricConfiguration.expects(:create).returns(@compound_metric_configuration) #FIXME need .with(some_hash), should it mock the request?. - get :create, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration => @compound_metric_configuration_hash - assert_response :redirect - end - - should 'update' do - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration_content.configuration_id).returns([@native_metric_configuration]) - @native_metric_configuration.expects(:update_attributes).returns(true) #FIXME need .with(some_hash), should it mock the request?. - get :update, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration => @native_metric_configuration_hash - assert_equal @configuration_content, assigns(:configuration_content) - assert_response :redirect - end - - should 'remove' do - Kalibro::MetricConfiguration.expects(:new).with({:id => @native_metric_configuration.id}).returns(@native_metric_configuration) - @native_metric_configuration.expects(:destroy).returns() - get :remove, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @native_metric_configuration.id - assert_response :redirect - end - -end diff --git a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_range_controller_test.rb b/plugins/mezuro/test/functional/myprofile/mezuro_plugin_range_controller_test.rb deleted file mode 100644 index 39749b4..0000000 --- a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_range_controller_test.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'test_helper' - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" - -class MezuroPluginRangeControllerTest < ActionController::TestCase - - def setup - @controller = MezuroPluginRangeController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Profile) - - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration - @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash - @configuration = ConfigurationFixtures.configuration - - @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name, :configuration_id => 42) - @content.expects(:send_configuration_to_service).returns(nil) - @content.expects(:validate_configuration_name).returns(true) - @content.save - - @created_range = RangeFixtures.created_range - @range = RangeFixtures.range - @created_range_hash = RangeFixtures.created_range_hash - @range_hash = RangeFixtures.range_hash - - @reading = ReadingFixtures.reading - end - - should 'set correct attributes to create a new range' do - Kalibro::Reading.expects(:readings_of).with(@metric_configuration.reading_group_id).returns([@reading]) - get :new, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound - assert_equal @content.id, assigns(:content_id) - assert_equal @metric_configuration.id, assigns(:metric_configuration_id) - assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids) - assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id) - assert_equal @metric_configuration.metric.compound, assigns(:compound) - assert_response :success - end - - should 'set correct attributes to edit a range' do - Kalibro::Reading.expects(:readings_of).with(@metric_configuration.reading_group_id).returns([@reading]) - Kalibro::Range.expects(:ranges_of).with(@metric_configuration.id).returns([@range]) - get :edit, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :range_id => @range.id, :reading_group_id => @metric_configuration.reading_group_id - assert_equal @content.id, assigns(:content_id) - assert_equal @metric_configuration.id, assigns(:metric_configuration_id) - assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids) - assert_equal @range, assigns(:range) - assert_response :success - end - - should 'test create instance range' do - Kalibro::Range.expects(:request).with(:save_range, { - :metric_configuration_id => @metric_configuration.id, - :range => @created_range.to_hash}).returns(:range_id => @range.id) - Kalibro::Reading.expects(:find).with(@created_range.reading_id).returns(@reading) - get :create, :profile => @profile.identifier, :range => @created_range_hash, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound - assert_equal @range.id, assigns(:range).id - assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id) - assert_equal @metric_configuration.metric.compound, assigns(:compound) - assert_response :success - end - - should 'test update range' do - Kalibro::Range.expects(:request).with(:save_range, { - :metric_configuration_id => @metric_configuration.id, - :range => @range.to_hash}).returns(:range_id => @range.id) - get :update, :profile => @profile.identifier, :range => @range_hash, :metric_configuration_id => @metric_configuration.id - assert_equal @range.id, assigns(:range).id - assert_response :success - end - - should 'test remove range in native metric configuration' do - Kalibro::Range.expects(:new).with({:id => @range.id}).returns(@range) - @range.expects(:destroy).with().returns() - get :remove, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :range_id => @range.id, :compound => false - assert_response :redirect - end -end diff --git a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb b/plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb deleted file mode 100644 index 47b5f20..0000000 --- a/plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'test_helper' - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_content_fixtures" - -class MezuroPluginReadingControllerTest < ActionController::TestCase - - def setup - @controller = MezuroPluginReadingController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Profile) - - @reading = ReadingFixtures.reading - @created_reading = ReadingFixtures.created_reading - @reading_hash = ReadingFixtures.hash - @content = MezuroPlugin::ReadingGroupContent.new(:profile => @profile, :name => name) - @content.expects(:send_reading_group_to_service).returns(nil) - @content.save - end - - should 'set variables to create a new reading' do - parser = "|*|" - Kalibro::Reading.expects(:readings_of).with(@content.reading_group_id).returns([@reading]) - get :new, :profile => @profile.identifier, :id => @content.id - assert_equal parser, assigns(:parser) - assert_equal ["#{@reading.label}#{parser}#{@reading.grade}#{parser}"], assigns(:labels_and_grades) - assert_equal @content.id, assigns(:reading_group_content).id - assert_response :success - end - - should 'create a reading' do - Kalibro::Reading.expects(:new).with(@reading_hash.to_s).returns(@created_reading) - @created_reading.expects(:save).with(@content.reading_group_id).returns(true) - get :save, :profile => @profile.identifier, :id => @content.id, :reading => @reading_hash - assert @created_reading.errors.empty? - assert_response :redirect - end - - should 'put an Exception in reading when an error occurs in create action' do - @created_reading.errors = [Exception.new] - Kalibro::Reading.expects(:new).with(@reading_hash.to_s).returns(@created_reading) - @created_reading.expects(:save).with(@content.reading_group_id).returns(false) - get :save, :profile => @profile.identifier, :id => @content.id, :reading => @reading_hash - assert !@created_reading.errors.empty? - assert_response :redirect - end - - should 'set variables to edit a reading' do - parser = "|*|" - another_reading = ReadingFixtures.reading - another_reading.id = 10 - Kalibro::Reading.expects(:readings_of).with(@content.reading_group_id).returns([@reading, another_reading]) - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading) - get :edit, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id - assert_equal @content.id, assigns(:reading_group_content).id - assert_equal @reading, assigns(:reading) - assert_equal parser, assigns(:parser) - assert_equal ["#{another_reading.label}#{parser}#{another_reading.grade}#{parser}"], assigns(:labels_and_grades) - assert_response :success - end - - should 'destroy a reading' do - @reading.expects(:destroy) - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading) - - get :destroy, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id - - assert @reading.errors.empty? - assert_response :redirect - end - - should 'put an Exception in reading when an error occurs in destroy action' do - @reading.errors = [Exception.new] - @reading.expects(:destroy) - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading) - - get :destroy, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id - - assert !@reading.errors.empty? - assert_response :redirect - end -end diff --git a/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb b/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb deleted file mode 100644 index 6ef3bba..0000000 --- a/plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb +++ /dev/null @@ -1,58 +0,0 @@ -require 'test_helper' - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_module_result_fixtures" - -class MezuroPluginModuleResultControllerTest < ActionController::TestCase - - def setup - @controller = MezuroPluginModuleResultController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Community) - - @module_result_hash = ModuleResultFixtures.module_result_hash - @metric_result_hash = MetricResultFixtures.native_metric_result_hash - @date_metric_result_hash = DateMetricResultFixtures.date_metric_result_hash - @date_module_result_hash = DateModuleResultFixtures.date_module_result_hash - end - - should 'find module result on kalibro' do - parent_module_result = ModuleResultFixtures.parent_module_result_hash - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:id].to_i }). - returns({:module_result => @module_result_hash}) - Kalibro::MetricResult.expects(:request).with(:metric_results_of, { :module_result_id => @module_result_hash[:id].to_i }). - returns({:metric_result => @metric_result_hash}) - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:parent_id].to_i }). - returns({:module_result => parent_module_result}) - Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result_hash[:id].to_i}). - returns({:module_result => nil}) - get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] - assert_equal @module_result_hash[:grade].to_f, assigns(:module_result).grade - assert_equal @metric_result_hash[:value].to_f, assigns(:metric_results).first.value - assert_response :success - #TODO assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') - end - - should 'get metric result history' do - metric_name = @metric_result_hash[:configuration][:metric][:name] - Kalibro::MetricResult.expects(:request).with(:history_of_metric, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id].to_i }). - returns({:date_metric_result => @date_metric_result_hash}) - get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name - assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date - assert_response :success - #TODO assert_select - end - - should 'get module result history' do - Kalibro::ModuleResult.expects(:request).with(:history_of_module, { :module_result_id => @module_result_hash[:id].to_i }). - returns({:date_module_result => @date_module_result_hash}) - get :module_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id] - assert_equal DateTime.parse(@date_module_result_hash[:date]), assigns(:history).first.date - assert_response :success - #TODO assert_select - end - -end diff --git a/plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb b/plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb deleted file mode 100644 index 0fb8c96..0000000 --- a/plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'test_helper' - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" - - -class MezuroPluginProcessingControllerTest < ActionController::TestCase - def setup - @controller = MezuroPluginProcessingController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Community) - - @repository_id = RepositoryFixtures.repository.id - @processing = ProcessingFixtures.processing - @processing_hash = ProcessingFixtures.processing_hash - @processing_with_error_hash = ProcessingFixtures.processing_with_error_hash - end - - should 'render last processing state' do - Kalibro::Processing.expects(:processing_of).with(@repository_id).returns(@processing) - get :state, :profile => @profile.identifier, :repository_id => @repository_id - assert_response :success - assert_equal @processing.state, @response.body - end - - should 'render a processing state in a specific date' do - Kalibro::Processing.expects(:processing_with_date_of).with(@repository_id, @processing.date).returns(@processing) - get :state, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date - assert_response :success - assert_equal @processing.state, @response.body - end - - should 'render processing with error' do - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => false}) - Kalibro::Processing.expects(:request).with(:last_processing, :repository_id => @repository_id).returns({:processing => @processing_with_error_hash}) - get :processing, :profile => @profile.identifier, :repository_id => @repository_id - assert_response :success - assert_equal @processing_with_error_hash[:state], assigns(:processing).state - #TODO How to assert from view? assert_select('h3', 'ERROR') - end - - should 'test project result without date' do - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => true}) - Kalibro::Processing.expects(:request).with(:last_ready_processing, {:repository_id => @repository_id}).returns({:processing => @processing_hash}) - get :processing, :profile => @profile.identifier, :repository_id => @repository_id - assert_response :success - assert_select('h4', 'Last Result') - end - - should 'test project results from a specific date' do - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => @repository_id, :date => @processing.date}).returns({:exists => true}) - Kalibro::Processing.expects(:request).with(:first_processing_after, :repository_id => @repository_id, :date => @processing.date).returns({:processing => @processing_hash}) - get :processing, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date - assert_response :success - assert_select('h4', 'Last Result') - end - -end diff --git a/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb b/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb deleted file mode 100644 index f470297..0000000 --- a/plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'test_helper' - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_content_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" - -class MezuroPluginRepositoryControllerTest < ActionController::TestCase - - def setup - @controller = MezuroPluginRepositoryController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @profile = fast_create(Community) - - @configuration = ConfigurationFixtures.configuration - @repository_types = RepositoryFixtures.types - @all_configurations = ConfigurationFixtures.all - @repository = RepositoryFixtures.repository - @repository_hash = RepositoryFixtures.hash - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => name) - @content.expects(:send_project_to_service).returns(nil) - @content.save - end - - should 'set variables to create a new repository' do - Kalibro::Repository.expects(:repository_types).returns(@repository_types) - Kalibro::Configuration.expects(:all).returns(@all_configurations) - - get :new, :profile => @profile.identifier, :id => @content.id - - assert_equal @content.id, assigns(:project_content).id - assert_equal @repository_types, assigns(:repository_types) - assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first - assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last - assert_response :success - end - - should 'save a repository' do - Kalibro::Repository.expects(:new).returns(@repository) - @repository.expects(:save).with(@content.project_id).returns(true) - @repository.expects(:process) - get :save, :profile => @profile.identifier, :id => @content.id, :repository => @repository_hash - assert @repository.errors.empty? - assert_response :redirect - end - - should 'not save a repository' do - @repository.errors = [Exception.new] - Kalibro::Repository.expects(:new).returns(@repository) - @repository.expects(:save).with(@content.project_id).returns(false) - get :save, :profile => @profile.identifier, :id => @content.id, :repository => @repository_hash - assert !@repository.errors.empty? - assert_response :redirect - end - - should 'set variables to edit a repository' do - Kalibro::Repository.expects(:repository_types).returns(@repository_types) - Kalibro::Configuration.expects(:all).returns(@all_configurations) - Kalibro::Repository.expects(:repositories_of).with(@content.project_id).returns([@repository]) - - get :edit, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id - - assert_equal @content.id, assigns(:project_content).id - assert_equal @repository_types, assigns(:repository_types) - assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first - assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last - assert_equal @repository, assigns(:repository) - assert_response :success - end - - should 'set variables to show a repository' do - Kalibro::Repository.expects(:repositories_of).with(@content.project_id).returns([@repository]) - Kalibro::Configuration.expects(:find).with(@repository.configuration_id).returns(@configuration) - - get :show, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id - - assert_equal @content.id, assigns(:project_content).id - assert_equal @repository, assigns(:repository) - assert_equal @configuration.name, assigns(:configuration_name) - assert_response :success - end - - should 'destroy a repository' do - Kalibro::Repository.expects(:new).with(:id => @repository.id.to_s).returns(@repository) - @repository.expects(:destroy) - get :destroy, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id - - assert @repository.errors.empty? - assert_response :redirect - end - - should 'not destroy a repository' do - @repository.errors = [Exception.new] - Kalibro::Repository.expects(:new).with(:id => @repository.id.to_s).returns(@repository) - @repository.expects(:destroy) - get :destroy, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id - - #TODO verify if it is redirected to the right page - assert_response :redirect - end -end diff --git a/plugins/mezuro/test/unit/kalibro/base_tool_test.rb b/plugins/mezuro/test/unit/kalibro/base_tool_test.rb deleted file mode 100644 index 3ca3b76..0000000 --- a/plugins/mezuro/test/unit/kalibro/base_tool_test.rb +++ /dev/null @@ -1,27 +0,0 @@ -require "test_helper" -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures" - -class BaseToolTest < ActiveSupport::TestCase - - def setup - @hash = BaseToolFixtures.base_tool_hash - @base_tool = BaseToolFixtures.base_tool - end - - should 'create base tool from hash' do - assert_equal @hash[:name], Kalibro::BaseTool.new(@hash).name - end - - should 'get base tool names' do - names = ['Analizo', 'Checkstyle'] - Kalibro::BaseTool.expects(:request).with(:all_base_tool_names).returns({:base_tool_name => names}) - assert_equal names, Kalibro::BaseTool.all_names - end - - should 'get base tool by name' do - request_body = {:base_tool_name => @base_tool.name} - Kalibro::BaseTool.expects(:request).with(:get_base_tool, request_body).returns({:base_tool => @hash}) - assert_equal @base_tool.name, Kalibro::BaseTool.find_by_name(@base_tool.name).name - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb b/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb deleted file mode 100644 index 3573f8e..0000000 --- a/plugins/mezuro/test/unit/kalibro/compound_metric_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_fixtures" - -class CompoundMetricTest < ActiveSupport::TestCase - - def setup - @hash = CompoundMetricFixtures.compound_metric_hash - @metric = CompoundMetricFixtures.compound_metric - end - - should 'create compound metric from hash' do - assert_equal @hash[:script], Kalibro::CompoundMetric.new(@hash).script - end - - should 'convert compound metric to hash' do - assert_equal @hash, @metric.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb b/plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb deleted file mode 100644 index 9fb8c34..0000000 --- a/plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_with_error_fixtures" - -class CompoundMetricWithErrorTest < ActiveSupport::TestCase - - def setup - @hash = CompoundMetricWithErrorFixtures.compound_metric_with_error_hash - @compound_metric_with_error = CompoundMetricWithErrorFixtures.compound_metric_with_error - end - - should 'create error from hash' do - assert_equal @hash[:error][:message], Kalibro::CompoundMetricWithError.new(@hash).error.message - end - - should 'convert error to hash' do - assert_equal @hash, @compound_metric_with_error.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/configuration_test.rb b/plugins/mezuro/test/unit/kalibro/configuration_test.rb deleted file mode 100644 index 5617f37..0000000 --- a/plugins/mezuro/test/unit/kalibro/configuration_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" - -class ConfigurationTest < ActiveSupport::TestCase - - def setup - @hash = ConfigurationFixtures.configuration_hash - @configuration = ConfigurationFixtures.configuration - @created_configuration = ConfigurationFixtures.created_configuration - end - - should 'initialize configuration' do - assert_equal @hash[:name], Kalibro::Configuration.new(@hash).name - end - - should 'convert configuration to hash' do - assert_equal @hash, @configuration.to_hash - end - - should 'answer if configuration exists in kalibro' do - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => true}) - assert Kalibro::Configuration.exists?(@configuration.id) - end - - should 'find a configuration' do - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => true}) - Kalibro::Configuration.expects(:request).with(:get_configuration, {:configuration_id => @configuration.id}).returns(:configuration => @hash) - assert_equal @hash[:name], Kalibro::Configuration.find(@configuration.id).name - end - - should 'return exception when configuration doesnt exist' do - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => false}) - assert_raise(Kalibro::Errors::RecordNotFound){Kalibro::Configuration.find(@configuration.id)} - end - - should 'get all configurations' do - Kalibro::Configuration.expects(:request).with(:all_configurations).returns({:configuration => [@hash]}) - assert_equal @hash[:name], Kalibro::Configuration.all.first.name - end - - should 'return true when configuration is saved successfully' do - id_from_kalibro = 1 - Kalibro::Configuration.expects(:request).with(:save_configuration, {:configuration => @created_configuration.to_hash}).returns(:configuration_id => id_from_kalibro) - assert @created_configuration.save - assert_equal id_from_kalibro, @created_configuration.id - end - - should 'return false when configuration is not saved successfully' do - Kalibro::Configuration.expects(:request).with(:save_configuration, {:configuration => @created_configuration.to_hash}).raises(Exception.new) - assert !(@created_configuration.save) - assert_nil @created_configuration.id - end - - should 'remove existent configuration from service' do - Kalibro::Configuration.expects(:request).with(:delete_configuration, {:configuration_id => @configuration.id}) - @configuration.destroy - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/date_metric_result_test.rb b/plugins/mezuro/test/unit/kalibro/date_metric_result_test.rb deleted file mode 100644 index 18218c5..0000000 --- a/plugins/mezuro/test/unit/kalibro/date_metric_result_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" - -class DateMetricResultTest < ActiveSupport::TestCase - - def setup - @hash = DateMetricResultFixtures.date_metric_result_hash - @date_metric_result = DateMetricResultFixtures.date_metric_result - end - - should 'create date_metric_result from hash' do - assert_equal @hash[:metric_result][:id].to_i, Kalibro::DateMetricResult.new(@hash).metric_result.id - end - - should 'convert date_metric_result to hash' do - assert_equal @hash, @date_metric_result.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/date_module_result_test.rb b/plugins/mezuro/test/unit/kalibro/date_module_result_test.rb deleted file mode 100644 index 97a482c..0000000 --- a/plugins/mezuro/test/unit/kalibro/date_module_result_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_module_result_fixtures" - -class DateModuleResultTest < ActiveSupport::TestCase - - def setup - @hash = DateModuleResultFixtures.date_module_result_hash - @date_module_result = DateModuleResultFixtures.date_module_result - end - - should 'create date_module_result from hash' do - assert_equal @hash[:module_result][:id].to_i, Kalibro::DateModuleResult.new(@hash).module_result.id - end - - should 'convert date_module_result to hash' do - assert_equal @hash, @date_module_result.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/error_test.rb b/plugins/mezuro/test/unit/kalibro/error_test.rb deleted file mode 100644 index 121e14f..0000000 --- a/plugins/mezuro/test/unit/kalibro/error_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures" - -class ErrorTest < ActiveSupport::TestCase - - def setup - @hash = ErrorFixtures.error_hash - @error = ErrorFixtures.error - end - - should 'create error from hash' do - assert_equal @hash[:message], Kalibro::Error.new(@hash).message - end - - should 'convert error to hash' do - assert_equal @hash, @error.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/metric_configuration_snapshot_test.rb b/plugins/mezuro/test/unit/kalibro/metric_configuration_snapshot_test.rb deleted file mode 100644 index a8f1018..0000000 --- a/plugins/mezuro/test/unit/kalibro/metric_configuration_snapshot_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures" - -class MetricConfigurationSnapshotTest < ActiveSupport::TestCase - - def setup - @hash = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash - @hash2 = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash_with_2_elements - @metric_configuration_snapshot = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot - @metric_configuration_snapshot2 = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_with_2_elements - end - - should 'create and convert metric configuration snapshot from hash' do - assert_equal @hash[:code], Kalibro::MetricConfigurationSnapshot.new(@hash).code - assert_equal @hash[:weight].to_f, @metric_configuration_snapshot.weight - end - - should 'create and convert metric configuration snapshot from hash with 2 elements' do - assert_equal @hash2[:code], Kalibro::MetricConfigurationSnapshot.new(@hash2).code - assert_equal @hash2, @metric_configuration_snapshot2.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb b/plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb deleted file mode 100644 index 2bdbca9..0000000 --- a/plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb +++ /dev/null @@ -1,52 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" - -class MetricConfigurationTest < ActiveSupport::TestCase - - def setup - @native_metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration - @native_metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash - @created_metric_configuration = MetricConfigurationFixtures.created_metric_configuration - end - - should 'create metric configuration from hash' do - metric_configuration = Kalibro::MetricConfiguration.new(@native_metric_configuration_hash) - assert_equal @native_metric_configuration_hash[:code], metric_configuration.code - assert_equal @native_metric_configuration_hash[:id].to_i, metric_configuration.id - assert_equal @native_metric_configuration_hash[:reading_group_id].to_i, metric_configuration.reading_group_id - end - - should 'convert metric configuration to hash' do - assert_equal @native_metric_configuration_hash, @native_metric_configuration.to_hash - end - - should 'get all metric configurations of a configuration' do - configuration_id = 13 - request_body = { :configuration_id => configuration_id } - response_hash = {:metric_configuration => [@native_metric_configuration_hash]} - Kalibro::MetricConfiguration.expects(:request).with(:metric_configurations_of, request_body).returns(response_hash) - assert_equal @native_metric_configuration.code, Kalibro::MetricConfiguration.metric_configurations_of(configuration_id).first.code - end - - should 'return true when metric configuration is saved successfully' do - id_from_kalibro = 1 - configuration_id = @created_metric_configuration.configuration_id - Kalibro::MetricConfiguration.expects(:request).with(:save_metric_configuration, {:metric_configuration => @created_metric_configuration.to_hash, :configuration_id => configuration_id}).returns(:metric_configuration_id => id_from_kalibro) - assert @created_metric_configuration.save - assert_equal id_from_kalibro, @created_metric_configuration.id - end - - should 'return false when metric configuration is not saved successfully' do - configuration_id = @created_metric_configuration.configuration_id - Kalibro::MetricConfiguration.expects(:request).with(:save_metric_configuration, {:metric_configuration => @created_metric_configuration.to_hash, :configuration_id => configuration_id}).raises(Exception.new) - assert !(@created_metric_configuration.save) - assert_nil @created_metric_configuration.id - end - - should 'destroy metric configuration' do - Kalibro::MetricConfiguration.expects(:request).with(:delete_metric_configuration, :metric_configuration_id => @native_metric_configuration.id) - @native_metric_configuration.destroy - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/metric_result_test.rb b/plugins/mezuro/test/unit/kalibro/metric_result_test.rb deleted file mode 100644 index ff5762c..0000000 --- a/plugins/mezuro/test/unit/kalibro/metric_result_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_result_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" - -class MetricResultTest < ActiveSupport::TestCase - - def setup - @native_hash = MetricResultFixtures.native_metric_result_hash - @compound_hash = MetricResultFixtures.compound_metric_result_hash - @result = MetricResultFixtures.native_metric_result - end - - should 'create metric result from hash' do - metric_result = Kalibro::MetricResult.new(@native_hash) - assert_equal @native_hash[:configuration][:code], metric_result.configuration.code - assert_equal @native_hash[:id].to_i, metric_result.id - assert_equal @native_hash[:value].to_f, metric_result.value - end - - should 'create metric result with aggregated value from hash' do - hash = @native_hash - hash[:aggregated_value] = "2.0" - hash[:value] = "NaN" - metric_result = Kalibro::MetricResult.new(hash) - assert_equal @native_hash[:aggregated_value].to_f, metric_result.value - end - - should 'convert metric result to hash' do - assert_equal @native_hash, @result.to_hash - end - - should 'return descendant results of a metric result' do - descendant = [31, 13] - Kalibro::MetricResult.expects(:request).with(:descendant_results_of, {:metric_result_id => @result.id}).returns({:descendant_result => descendant}) - assert_equal descendant, @result.descendant_results - end - - should 'return metric results of a module result' do - id = 31 - Kalibro::MetricResult.expects(:request).with(:metric_results_of, {:module_result_id => id}).returns(:metric_result => [@native_hash, @compound_hash]) - assert_equal @native_hash[:id].to_i, Kalibro::MetricResult.metric_results_of(id).first.id - end - - should 'return history of a metric with a module result id' do - module_result_id = 31 - Kalibro::MetricResult.expects(:request).with(:history_of_metric, {:metric_name => @result.configuration.metric.name, :module_result_id => module_result_id}).returns({:date_metric_result => DateMetricResultFixtures.date_metric_result_hash}) - assert_equal DateMetricResultFixtures.date_metric_result_hash[:metric_result][:id].to_i, Kalibro::MetricResult.history_of(@result.configuration.metric.name, module_result_id).first.metric_result.id - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/metric_test.rb b/plugins/mezuro/test/unit/kalibro/metric_test.rb deleted file mode 100644 index 11c2759..0000000 --- a/plugins/mezuro/test/unit/kalibro/metric_test.rb +++ /dev/null @@ -1,29 +0,0 @@ -require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures" - -class MetricTest < ActiveSupport::TestCase - - def setup - @native_hash = MetricFixtures.amloc_hash - @native = MetricFixtures.amloc - @compound_hash = MetricFixtures.compound_metric_hash - @compound = MetricFixtures.compound_metric - end - - should 'create native metric from hash' do - assert_equal @native_hash[:name], Kalibro::Metric.new(@native_hash).name - end - - should 'convert native metric to hash' do - assert_equal @native_hash, @native.to_hash - end - - should 'create compound metric from hash' do - assert_equal @compound_hash[:script], Kalibro::Metric.new(@compound_hash).script - end - - should 'convert compound metric to hash' do - assert_equal @compound_hash, @compound.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/module_node_test.rb b/plugins/mezuro/test/unit/kalibro/module_node_test.rb deleted file mode 100644 index c26dfde..0000000 --- a/plugins/mezuro/test/unit/kalibro/module_node_test.rb +++ /dev/null @@ -1,19 +0,0 @@ -require "test_helper" -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_node_fixtures" - -class ModuleNodeTest < ActiveSupport::TestCase - - def setup - @hash = ModuleNodeFixtures.module_node_hash - @node = ModuleNodeFixtures.module_node - end - - should 'create module node from hash' do - assert_equal( @node.child[0].module.name, Kalibro::ModuleNode.new(@hash).child[0].module.name) - end - - should 'convert children hash to array of ModuleNode' do - assert_equal @hash, @node.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/module_result_test.rb b/plugins/mezuro/test/unit/kalibro/module_result_test.rb deleted file mode 100644 index 3ee2756..0000000 --- a/plugins/mezuro/test/unit/kalibro/module_result_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require "test_helper" -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_module_result_fixtures" - -class ModuleResultTest < ActiveSupport::TestCase - - def setup - @hash = ModuleResultFixtures.module_result_hash - @module_result = ModuleResultFixtures.module_result - end - - should 'create module result' do - module_result = Kalibro::ModuleResult.new(@hash) - assert_equal @hash[:id].to_i , module_result.id - assert_equal @hash[:grade].to_f , module_result.grade - assert_equal @hash[:parent_id].to_i , module_result.parent_id - end - - should 'convert module result to hash' do - assert_equal @hash, @module_result.to_hash - end - - should 'find module result' do - response = {:module_result => @hash} - Kalibro::ModuleResult.expects(:request).with(:get_module_result, {:module_result_id => @module_result.id}).returns(response) - assert_equal @module_result.grade, Kalibro::ModuleResult.find(@module_result.id).grade - end - - should 'return children of a module result' do - response = {:module_result => [@hash]} - Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result.id}).returns(response) - assert @hash[:id], @module_result.children.first.id - end - - should 'return parents of a module result' do - parent_module_result = ModuleResultFixtures.parent_module_result_hash - response = {:module_result => parent_module_result} - Kalibro::ModuleResult.expects(:request).with(:get_module_result, {:module_result_id => @module_result.parent_id}).returns(response) - parents = @module_result.parents - assert parent_module_result[:module][:name], parents.first.module.name - assert parent_module_result[:module][:name], parents.last.module.name - end - - should 'return history of a module result' do - Kalibro::ModuleResult.expects(:request).with(:history_of_module, {:module_result_id => @module_result.id}).returns({:date_module_result => [DateModuleResultFixtures.date_module_result_hash]}) - assert_equal DateModuleResultFixtures.date_module_result_hash[:module_result][:id].to_i, Kalibro::ModuleResult.history_of(@module_result.id).first.module_result.id - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/module_test.rb b/plugins/mezuro/test/unit/kalibro/module_test.rb deleted file mode 100644 index d3e4e2e..0000000 --- a/plugins/mezuro/test/unit/kalibro/module_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures" - -class ModuleTest < ActiveSupport::TestCase - - def setup - @hash = ModuleFixtures.module_hash - @module = ModuleFixtures.module - end - - should 'create module from hash' do - assert_equal @hash[:name], Kalibro::Module.new(@hash).name - end - - should 'convert module to hash' do - assert_equal @hash, @module.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/native_metric_test.rb b/plugins/mezuro/test/unit/kalibro/native_metric_test.rb deleted file mode 100644 index 5f6e0bb..0000000 --- a/plugins/mezuro/test/unit/kalibro/native_metric_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures" - -class NativeMetricTest < ActiveSupport::TestCase - - def setup - @hash = NativeMetricFixtures.amloc_hash - @metric = NativeMetricFixtures.amloc - end - - should 'create native metric from hash' do - assert_equal @hash[:name], Kalibro::NativeMetric.new(@hash).name - end - - should 'convert native metric to hash' do - assert_equal @hash, @metric.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/process_time_test.rb b/plugins/mezuro/test/unit/kalibro/process_time_test.rb deleted file mode 100644 index 449e425..0000000 --- a/plugins/mezuro/test/unit/kalibro/process_time_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/process_time_fixtures" - -class ProcessTimeTest < ActiveSupport::TestCase - - def setup - @hash = ProcessTimeFixtures.process_time_hash - @process_time = ProcessTimeFixtures.process_time - end - - should 'create process time from hash' do - assert_equal @hash[:state], Kalibro::ProcessTime.new(@hash).state - assert_equal @hash[:time].to_i, Kalibro::ProcessTime.new(@hash).time - end - - should 'convert process time to hash' do - assert_equal @hash, @process_time.to_hash - end - - should 'get time as an integer' do - assert_equal 1.class, @process_time.time.class - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/processing_test.rb b/plugins/mezuro/test/unit/kalibro/processing_test.rb deleted file mode 100644 index 22b63a3..0000000 --- a/plugins/mezuro/test/unit/kalibro/processing_test.rb +++ /dev/null @@ -1,98 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures" -class ProcessingTest < ActiveSupport::TestCase - - def setup - @hash = ProcessingFixtures.processing_hash - @processing = ProcessingFixtures.processing - - @repository_id = 31 - end - - should 'create processing from hash' do - processing = Kalibro::Processing.new(@hash) - assert_equal @hash[:results_root_id].to_i, processing.results_root_id - assert_equal @hash[:process_time].first[:state], processing.process_times.first.state - assert_equal @hash[:id].to_i, processing.id - end - - should 'convert processing to hash' do - assert_equal @hash, @processing.to_hash - end - - should 'verify if a repository has a processing' do - true_repository_id = 31 - false_repository_id = 32 - - Kalibro::Processing.expects(:request).with(:has_processing, {:repository_id => true_repository_id}).returns({:exists => true}) - Kalibro::Processing.expects(:request).with(:has_processing, {:repository_id => false_repository_id}).returns({:exists => false}) - - assert Kalibro::Processing.has_processing(true_repository_id) - assert !Kalibro::Processing.has_processing(false_repository_id) - end - - should 'verify if a repository has a ready processing' do - true_repository_id = 31 - false_repository_id = 32 - - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => true_repository_id}).returns({:exists => true}) - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => false_repository_id}).returns({:exists => false}) - - assert Kalibro::Processing.has_ready_processing(true_repository_id) - assert !Kalibro::Processing.has_ready_processing(false_repository_id) - end - - should 'verify if a repository has a processing after a date' do - true_repository_id = 31 - false_repository_id = 32 - - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => true_repository_id, :date => @processing.date}).returns({:exists => true}) - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => false_repository_id, :date => @processing.date}).returns({:exists => false}) - - assert Kalibro::Processing.has_processing_after(true_repository_id, @processing.date) - assert !Kalibro::Processing.has_processing_after(false_repository_id, @processing.date) - end - - should 'verify if a repository has a processing before a date' do - true_repository_id = 31 - false_repository_id = 32 - - Kalibro::Processing.expects(:request).with(:has_processing_before, {:repository_id => true_repository_id, :date => @processing.date}).returns({:exists => true}) - Kalibro::Processing.expects(:request).with(:has_processing_before, {:repository_id => false_repository_id, :date => @processing.date}).returns({:exists => false}) - - assert Kalibro::Processing.has_processing_before(true_repository_id, @processing.date) - assert !Kalibro::Processing.has_processing_before(false_repository_id, @processing.date) - end - - should 'get last processing state of a repository' do - Kalibro::Processing.expects(:request).with(:last_processing_state, {:repository_id => @repository_id}).returns({:process_state => @processing.state}) - assert_equal @processing.state, Kalibro::Processing.last_processing_state_of(@repository_id) - end - - should 'get last ready processing of a repository' do - Kalibro::Processing.expects(:request).with(:last_ready_processing, {:repository_id => @repository_id}).returns({:processing => @hash}) - assert_equal @processing.id, Kalibro::Processing.last_ready_processing_of(@repository_id).id - end - - should 'get first processing of a repository' do - Kalibro::Processing.expects(:request).with(:first_processing, {:repository_id => @repository_id}).returns({:processing => @hash}) - assert_equal @processing.id, Kalibro::Processing.first_processing_of(@repository_id).id - end - - should 'get last processing of a repository' do - Kalibro::Processing.expects(:request).with(:last_processing, {:repository_id => @repository_id}).returns({:processing => @hash}) - assert_equal @processing.id, Kalibro::Processing.last_processing_of(@repository_id).id - end - - should 'get first processing after a date of a repository' do - Kalibro::Processing.expects(:request).with(:first_processing_after, {:repository_id => @repository_id, :date => @processing.date}).returns({:processing => @hash}) - assert_equal @processing.id, Kalibro::Processing.first_processing_after(@repository_id, @processing.date).id - end - - should 'get last processing before a date of a repository' do - Kalibro::Processing.expects(:request).with(:last_processing_before, {:repository_id => @repository_id, :date => @processing.date}).returns({:processing => @hash}) - assert_equal @processing.id, Kalibro::Processing.last_processing_before(@repository_id, @processing.date).id - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/project_result_test.rb b/plugins/mezuro/test/unit/kalibro/project_result_test.rb deleted file mode 100644 index 5024db2..0000000 --- a/plugins/mezuro/test/unit/kalibro/project_result_test.rb +++ /dev/null @@ -1,88 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures" - -class ProjectResultTest < ActiveSupport::TestCase - - def setup - @hash = ProjectResultFixtures.project_result_hash - @project_result = ProjectResultFixtures.project_result - - @project_name = @project_result.project.name - @date = @project_result.date - @flag = DateTime.now.sec % 2 == 0 #random choose between true or false - - @request = {:project_name => @project_name} - @request_with_date = {:project_name => @project_name, :date => @date} - @flag_response = {:has_results => @flag} - @result_response = {:project_result => @project_result.to_hash} - end - - should 'create project result from hash' do - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.new(@hash).analysis_time - end - - should 'convert project result to hash' do - assert_equal @hash, @project_result.to_hash - end - - should 'get last result' do - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_last_result_of, @request).returns(@result_response) - assert_equal @project_result.analysis_time , Kalibro::ProjectResult.last_result(@project_name).analysis_time - end - - should 'get first result' do - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_first_result_of, @request).returns(@result_response) - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.first_result(@project_name).analysis_time - end - - should 'get first result after date' do - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_first_result_after, @request_with_date).returns(@result_response) - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.first_result_after(@project_name, @date).analysis_time - end - - should 'get last result before date' do - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_last_result_before, @request_with_date).returns(@result_response) - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.last_result_before(@project_name, @date).analysis_time - end - - should 'verify if project has results' do - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_for, @request).returns(@flag_response) - assert_equal @flag, Kalibro::ProjectResult.has_results?(@project_name) - end - - should 'verify if project has results before date' do - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_before, @request_with_date).returns(@flag_response) - assert_equal @flag, Kalibro::ProjectResult.has_results_before?(@project_name, @date) - end - - should 'verify if project has results after date' do - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_after, @request_with_date).returns(@flag_response) - assert_equal @flag, Kalibro::ProjectResult.has_results_after?(@project_name, @date) - end - - should 'retrieve formatted load time' do - assert_equal '00:00:14', @project_result.formatted_load_time - end - - should 'retrieve formatted analysis time' do - assert_equal '00:00:01', @project_result.formatted_analysis_time - end - - should 'retrive complex module' do - assert_equal @hash[:source_tree][:child][0][:child].first, @project_result.node("org.Window").to_hash - end - - should 'return source tree node when nil is given' do - assert_equal @hash[:source_tree], @project_result.node(nil).to_hash - end - - should 'return source tree node when project name is given' do - assert_equal @hash[:source_tree], @project_result.node(@project_result.project.name).to_hash - end - - should 'return correct node when module name is given' do - assert_equal @hash[:source_tree][:child][2], @project_result.node("main").to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/project_test.rb b/plugins/mezuro/test/unit/kalibro/project_test.rb deleted file mode 100644 index 818b494..0000000 --- a/plugins/mezuro/test/unit/kalibro/project_test.rb +++ /dev/null @@ -1,75 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures" - -class ProjectTest < ActiveSupport::TestCase - - def setup - @hash = ProjectFixtures.project_hash - @project = ProjectFixtures.project - @created_project = ProjectFixtures.created_project - end - - should 'initialize new project from hash' do - project = Kalibro::Project.new @hash - assert_equal @hash[:name], project.name - assert_equal @hash[:id].to_i, project.id - end - - should 'convert project to hash' do - hash = @project.to_hash - assert_equal @project.name, hash[:name] - end - - should 'answer if project exists in kalibro' do - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => true}) - assert Kalibro::Project.exists?(@project.id) - end - - should 'find project' do - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => true}) - Kalibro::Project.expects(:request).with(:get_project, {:project_id => @project.id}).returns(:project => @hash) - assert_equal @hash[:name], Kalibro::Project.find(@project.id).name - end - - should 'raise RecordNotFound exception when project doesnt exist' do - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => false}) - assert_raise(Kalibro::Errors::RecordNotFound){Kalibro::Project.find(@project.id)} - end - - should 'get all projects when there is only one project' do - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => @hash}) - assert_equal @hash[:name], Kalibro::Project.all.first.name - end - - should 'get all projects when there are many projects' do - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => [@hash, @hash]}) - projects = Kalibro::Project.all - assert_equal @hash[:name], projects.first.name - assert_equal @hash[:name], projects.last.name - end - - should 'return empty when there are no projects' do - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => nil}) - assert_equal [], Kalibro::Project.all - end - - should 'return true when project is saved successfully' do - id_from_kalibro = 1 - Kalibro::Project.expects(:request).with(:save_project, {:project => @created_project.to_hash}).returns(:project_id => id_from_kalibro) - assert @created_project.save - assert_equal id_from_kalibro, @created_project.id - end - - should 'return false when project is not saved successfully' do - Kalibro::Project.expects(:request).with(:save_project, {:project => @created_project.to_hash}).raises(Exception.new) - assert !(@created_project.save) - assert_nil @created_project.id - end - - should 'remove existent project from service' do - Kalibro::Project.expects(:request).with(:delete_project, {:project_id => @project.id}) - @project.destroy - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb b/plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb deleted file mode 100644 index 2b9a42d..0000000 --- a/plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb +++ /dev/null @@ -1,32 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_snapshot_fixtures" - -class RangeSnapshotTest < ActiveSupport::TestCase - - def setup - @hash = RangeSnapshotFixtures.range_snapshot_hash - @range_snapshot_with_infinite_range_hash = RangeSnapshotFixtures.range_snapshot_with_infinite_range_hash - @range_snapshot = RangeSnapshotFixtures.range_snapshot - @range_snapshot_with_infinite_range = RangeSnapshotFixtures.range_snapshot_with_infinite_range - end - - should 'create range_snapshot from hash' do - range_snapshot = Kalibro::RangeSnapshot.new(@hash) - assert_equal @hash[:comments], range_snapshot.comments - assert_equal @hash[:beginning].to_f, range_snapshot.beginning - assert_equal @hash[:end].to_f, range_snapshot.end - assert_equal @hash[:grade].to_f, range_snapshot.grade - end - - should 'create range_snapshot from hash with infinity values' do - range_snapshot = Kalibro::RangeSnapshot.new(@range_snapshot_with_infinite_range_hash) - assert_equal -1.0/0, range_snapshot.beginning - assert_equal 1.0/0, range_snapshot.end - end - - should 'convert range_snapshot to hash' do - assert_equal @hash, @range_snapshot.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/range_test.rb b/plugins/mezuro/test/unit/kalibro/range_test.rb deleted file mode 100644 index a605c2b..0000000 --- a/plugins/mezuro/test/unit/kalibro/range_test.rb +++ /dev/null @@ -1,47 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" - -class RangeTest < ActiveSupport::TestCase - - def setup - @hash = RangeFixtures.range_hash - @range = RangeFixtures.range - @created_range = RangeFixtures.created_range - end - - should 'create range from hash' do - assert_equal @hash[:comments], Kalibro::Range.new(@hash).comments - end - - should 'convert range to hash' do - assert_equal @hash, @range.to_hash - end - - should 'get ranges of a metric configuration' do - metric_configuration_id = 31 - Kalibro::Range.expects(:request).with(:ranges_of, {:metric_configuration_id => metric_configuration_id}).returns({:range => [@hash]}) - assert_equal @hash[:comments], Kalibro::Range.ranges_of(metric_configuration_id).first.comments - end - - should 'return true when range is saved successfully' do - id_from_kalibro = 1 - metric_configuration_id = 2 - Kalibro::Range.expects(:request).with(:save_range, {:range => @created_range.to_hash, :metric_configuration_id => metric_configuration_id}).returns(:range_id => id_from_kalibro) - assert @created_range.save(metric_configuration_id) - assert_equal id_from_kalibro, @created_range.id - end - - should 'return false when range is not saved successfully' do - metric_configuration_id = 2 - Kalibro::Range.expects(:request).with(:save_range, {:range => @created_range.to_hash, :metric_configuration_id => metric_configuration_id}).raises(Exception.new) - assert !(@created_range.save(metric_configuration_id)) - assert_nil @created_range.id - end - - should 'destroy range by id' do - Kalibro::Range.expects(:request).with(:delete_range, {:range_id => @range.id}) - @range.destroy - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/reading_group_test.rb b/plugins/mezuro/test/unit/kalibro/reading_group_test.rb deleted file mode 100644 index 814595a..0000000 --- a/plugins/mezuro/test/unit/kalibro/reading_group_test.rb +++ /dev/null @@ -1,78 +0,0 @@ -require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures" - -class ReadingGroupTest < ActiveSupport::TestCase - - def setup - @hash = ReadingGroupFixtures.reading_group_hash - @reading_group = ReadingGroupFixtures.reading_group - @created_reading_group = ReadingGroupFixtures.created_reading_group - end - - should 'create reading group from hash' do - assert_equal @hash[:name], Kalibro::ReadingGroup.new(@hash).name - assert_equal @hash[:id].to_i, Kalibro::ReadingGroup.new(@hash).id - end - - should 'convert reading group to hash' do - assert_equal @hash, @reading_group.to_hash - end - - should 'verify existence of reading group' do - fake_id = 0 - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => fake_id}).returns({:exists => false}) - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => @hash[:id].to_i}).returns({:exists => true}) - assert !Kalibro::ReadingGroup.exists?(fake_id) - assert Kalibro::ReadingGroup.exists?(@hash[:id].to_i) - end - - should 'get reading group' do - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => @hash[:id]}).returns({:exists => true}) - Kalibro::ReadingGroup.expects(:request).with(:get_reading_group, {:group_id => @hash[:id]}). - returns({:reading_group => @hash}) - assert_equal @hash[:name], Kalibro::ReadingGroup.find(@hash[:id]).name - end - - should 'get all reading groups when there is only one reading group' do - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => @hash}) - assert_equal @hash[:name], Kalibro::ReadingGroup.all.first.name - end - - should 'get all reading groups when there are many reading groups' do - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => [@hash, @hash]}) - reading_groups = Kalibro::ReadingGroup.all - assert_equal @hash[:name], reading_groups.first.name - assert_equal @hash[:name], reading_groups.last.name - end - - should 'return empty when there are no reading groups' do - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => nil}) - assert_equal [], Kalibro::ReadingGroup.all - end - - should 'get reading group of a metric configuration' do - id = 31 - Kalibro::ReadingGroup.expects(:request).with(:reading_group_of, {:metric_configuration_id => id}).returns({:reading_group => @hash}) - assert_equal @hash[:name], Kalibro::ReadingGroup.reading_group_of(id).name - end - - should 'return true when reading group is saved successfully' do - id_from_kalibro = 1 - Kalibro::ReadingGroup.expects(:request).with(:save_reading_group, {:reading_group => @created_reading_group.to_hash}).returns(:reading_group_id => id_from_kalibro) - assert @created_reading_group.save - assert_equal id_from_kalibro, @created_reading_group.id - end - - should 'return false when reading group is not saved successfully' do - Kalibro::ReadingGroup.expects(:request).with(:save_reading_group, {:reading_group => @created_reading_group.to_hash}).raises(Exception.new) - assert !(@created_reading_group.save) - assert_nil @created_reading_group.id - end - - should 'destroy reading group by id' do - Kalibro::ReadingGroup.expects(:request).with(:delete_reading_group, {:group_id => @reading_group.id}) - @reading_group.destroy - end - -end - diff --git a/plugins/mezuro/test/unit/kalibro/reading_test.rb b/plugins/mezuro/test/unit/kalibro/reading_test.rb deleted file mode 100644 index 0149b47..0000000 --- a/plugins/mezuro/test/unit/kalibro/reading_test.rb +++ /dev/null @@ -1,59 +0,0 @@ -require "test_helper" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" - -class ReadingTest < ActiveSupport::TestCase - - def setup - @hash = ReadingFixtures.reading_hash - @reading = ReadingFixtures.reading - @created_reading = ReadingFixtures.created_reading - end - - should 'create reading from hash' do - assert_equal @hash[:label], Kalibro::Reading.new(@hash).label - assert_equal @hash[:id].to_i, Kalibro::Reading.new(@hash).id - assert_equal @hash[:grade].to_f, Kalibro::Reading.new(@hash).grade - end - - should 'convert reading to hash' do - assert_equal @hash, @reading.to_hash - end - - should 'get reading' do - Kalibro::Reading.expects(:request).with(:get_reading, {:reading_id => @hash[:id]}). - returns({:reading => @hash}) - assert_equal @hash[:label], Kalibro::Reading.find(@hash[:id]).label - end - - should 'get reading of a range' do - range_id = 31 - Kalibro::Reading.expects(:request).with(:reading_of, {:range_id => range_id}).returns({:reading => @hash}) - assert_equal @hash[:label], Kalibro::Reading.reading_of(range_id).label - end - - should 'get readings of a reading group' do - reading_group_id = 31 - Kalibro::Reading.expects(:request).with(:readings_of, {:group_id => reading_group_id}).returns({:reading => [@hash]}) - assert_equal @hash[:label], Kalibro::Reading.readings_of(reading_group_id).first.label - end - - should 'return true when reading is saved successfully' do - id_from_kalibro = 1 - Kalibro::Reading.expects(:request).with(:save_reading, {:group_id => @created_reading.group_id, :reading => @created_reading.to_hash}).returns(:reading_id => id_from_kalibro) - assert @created_reading.save - assert_equal id_from_kalibro, @created_reading.id - end - - should 'return false when reading is not saved successfully' do - Kalibro::Reading.expects(:request).with(:save_reading, {:group_id => @created_reading.group_id, :reading => @created_reading.to_hash}).raises(Exception.new) - assert !(@created_reading.save) - assert_nil @created_reading.id - end - - should 'destroy reading by id' do - Kalibro::Reading.expects(:request).with(:delete_reading, {:reading_id => @reading.id}) - @reading.destroy - end - -end - diff --git a/plugins/mezuro/test/unit/kalibro/repository_test.rb b/plugins/mezuro/test/unit/kalibro/repository_test.rb deleted file mode 100644 index 3a0862e..0000000 --- a/plugins/mezuro/test/unit/kalibro/repository_test.rb +++ /dev/null @@ -1,65 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures" - -class RepositoryTest < ActiveSupport::TestCase - - def setup - @hash = RepositoryFixtures.repository_hash - @repository = RepositoryFixtures.repository - @created_repository = RepositoryFixtures.created_repository - end - - should 'new repository from hash' do - repository = Kalibro::Repository.new(@hash) - assert_equal @hash[:type], repository.type - assert_equal @hash[:id].to_i, repository.id - assert_equal @hash[:process_period].to_i, repository.process_period - assert_equal @hash[:configuration_id].to_i, repository.configuration_id - end - - should 'convert repository to hash' do - assert_equal @hash, @repository.to_hash - end - - should 'get supported repository types' do - types = ['BAZAAR', 'GIT', 'SUBVERSION'] - Kalibro::Repository.expects(:request).with(:supported_repository_types).returns({:supported_type => types}) - assert_equal types, Kalibro::Repository.repository_types - end - - should 'get repositories of a project' do - project_id = 31 - Kalibro::Repository.expects(:request).with(:repositories_of, {:project_id => project_id}).returns({:repository => [@hash]}) - assert_equal @hash[:name], Kalibro::Repository.repositories_of(project_id).first.name - end - - should 'return true when repository is saved successfully' do - id_from_kalibro = 1 - Kalibro::Repository.expects(:request).with(:save_repository, {:repository => @created_repository.to_hash, :project_id => @created_repository.project_id}).returns(:repository_id => id_from_kalibro) - assert @created_repository.save - assert_equal id_from_kalibro, @created_repository.id - end - - should 'return false when repository is not saved successfully' do - Kalibro::Repository.expects(:request).with(:save_repository, {:repository => @created_repository.to_hash, :project_id => @created_repository.project_id}).raises(Exception.new) - assert !(@created_repository.save) - assert_nil @created_repository.id - end - - should 'destroy repository by id' do - Kalibro::Repository.expects(:request).with(:delete_repository, {:repository_id => @repository.id}) - @repository.destroy - end - - should 'process repository' do - Kalibro::Repository.expects(:request).with(:process_repository, {:repository_id => @repository.id}); - @repository.process - end - - should 'cancel processing of a repository' do - Kalibro::Repository.expects(:request).with(:cancel_processing_of_repository, {:repository_id => @repository.id}); - @repository.cancel_processing_of_repository - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb b/plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb deleted file mode 100644 index fb1b4cf..0000000 --- a/plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/stack_trace_element_fixtures" - -class StackTraceElementTest < ActiveSupport::TestCase - - def setup - @hash = StackTraceElementFixtures.stack_trace_element_hash - @stack_trace_element = StackTraceElementFixtures.stack_trace_element - end - - should 'create stack trace element from hash' do - assert_equal @hash[:method_name], Kalibro::StackTraceElement.new(@hash).method_name - end - - should 'convert stack trace element to hash' do - assert_equal @hash, @stack_trace_element.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/kalibro/throwable_test.rb b/plugins/mezuro/test/unit/kalibro/throwable_test.rb deleted file mode 100644 index 040805b..0000000 --- a/plugins/mezuro/test/unit/kalibro/throwable_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures" - -class ThrowableTest < ActiveSupport::TestCase - - def setup - @hash = ThrowableFixtures.throwable_hash - @throwable = ThrowableFixtures.throwable - end - - should 'create throwable from hash' do - assert_equal @hash[:message], Kalibro::Throwable.new(@hash).message - end - - should 'convert throwable to hash' do - assert_equal @hash, @throwable.to_hash - end - -end diff --git a/plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb deleted file mode 100644 index 5fe286b..0000000 --- a/plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb +++ /dev/null @@ -1,90 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_content_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures" - -class ConfigurationContentTest < ActiveSupport::TestCase - - def setup - @configuration = ConfigurationFixtures.configuration - @content = ConfigurationContentFixtures.configuration_content - @created_configuration = ConfigurationFixtures.created_configuration - @content_hash = ConfigurationContentFixtures.configuration_content_hash - @configuration_hash = {:name => @content_hash[:name], :description => @content_hash[:description], :id => @content_hash[:configuration_id]} - @created_content = ConfigurationContentFixtures.created_configuration_content - - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration - @range = RangeFixtures.range - end - - should 'be an article' do - assert_kind_of Article, @content - end - - should 'provide proper short description' do - assert_equal 'Mezuro configuration', MezuroPlugin::ConfigurationContent.short_description - end - - should 'provide proper description' do - assert_equal 'Set of metric configurations to interpret a Kalibro project', MezuroPlugin::ConfigurationContent.description - end - - should 'have an html view' do - assert_not_nil @content.to_html - end - - should 'not save a configuration with an existing cofiguration name in kalibro' do - Kalibro::Configuration.expects(:all).returns([@configuration]) - @content.send :validate_configuration_name - assert_equal "Configuration name already exists in Kalibro", @content.errors.on_base - end - - should 'get configuration from service' do - Kalibro::Configuration.expects(:find).with(@content.configuration_id).returns(@configuration) - assert_equal @configuration, @content.kalibro_configuration - end - - should 'send configuration to service after saving' do - @content.expects :send_configuration_to_service - @content.run_callbacks :before_save - end - - should 'create new configuration' do - Kalibro::Configuration.expects(:create).with(:name => @created_content.name, :description => @created_content.description, :id => nil).returns(@configuration) - @created_content.send :send_configuration_to_service - assert_equal @configuration.id, @created_content.configuration_id - end - - should 'clone configuration' do - clone_id = @configuration.id - @content.configuration_to_clone_id = clone_id - Kalibro::Configuration.expects(:create).with(:id => @content.configuration_id, :name => @content.name, :description => @content.description).returns(@configuration) - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@metric_configuration]) - Kalibro::MetricConfiguration.expects(:request).returns(:metric_configuration_id => @metric_configuration.id) - Kalibro::Range.expects(:ranges_of).with(@metric_configuration.id).returns([@range]) - @range.expects(:save).with(@metric_configuration.id).returns(true) - @content.send :send_configuration_to_service - end - - should 'edit configuration' do - Kalibro::Configuration.expects(:new).with(@configuration_hash).returns(@configuration) - @configuration.expects(:save).returns(true) - @content.send :send_configuration_to_service - assert_equal @configuration.id, @content.configuration_id - end - - should 'send correct configuration to service but comunication fails' do - Kalibro::Configuration.expects(:new).with(@configuration_hash).returns(@created_configuration) - @created_configuration.expects(:save).returns(false) - @content.send :send_configuration_to_service - end - - should 'remove configuration from service' do - Kalibro::Configuration.expects(:find).with(@content.configuration_id).returns(@configuration) - @configuration.expects(:destroy) - @content.send :remove_configuration_from_service - end - -end diff --git a/plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb deleted file mode 100644 index 3354423..0000000 --- a/plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb +++ /dev/null @@ -1,65 +0,0 @@ -require "test_helper" -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" - -class ContentViewerHelperTest < ActiveSupport::TestCase - - def setup - @helper = MezuroPlugin::Helpers::ContentViewerHelper - end - - should 'get the number rounded by two decimal points' do - assert_equal '4.22', @helper.format_grade('4.22344') - assert_equal '4.10', @helper.format_grade('4.1') - assert_equal '4.00', @helper.format_grade('4') - end - - should 'create the periodicity options array' do - assert_equal [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]], @helper.periodicity_options - end - - should 'return the correct string for a given periodicity' do - assert_equal "Not Periodically", @helper.periodicity_option(0) - assert_equal "1 day", @helper.periodicity_option(1) - assert_equal "2 days", @helper.periodicity_option(2) - assert_equal "Weekly", @helper.periodicity_option(7) - assert_equal "Biweekly", @helper.periodicity_option(15) - assert_equal "Monthly", @helper.periodicity_option(30) - end - - should 'create the license options array' do - options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yml") - options = options.split("; ") - assert_equal options, @helper.license_options - end - - should 'generate chart from metric result history' do - chart = "http://chart.apis.google.com/chart?chxt=y,x&chco=c4a000&chf=bg,ls,90,efefef,0.2,ffffff,0.2&chd=s:A9&chl=2011-10-20T18%3A26%3A43%2B00%3A00|2011-10-25T18%3A26%3A43%2B00%3A00&cht=lc&chs=600x180&chxr=0,0.0,5.0" - metric_history = DateMetricResultFixtures.score_history - - assert_equal chart, @helper.generate_chart(metric_history) - end - - should 'format time to show a sentence' do - assert_equal 'less than 5 seconds', @helper.format_time(0) - assert_equal 'less than 5 seconds', @helper.format_time(4999) - assert_equal 'less than 10 seconds', @helper.format_time(5000) - assert_equal '1 minute', @helper.format_time(70000) - assert_equal 'about 2 hours', @helper.format_time(7000000) - end - - should 'format metric name for metric configuration snapshot' do - metric_configuration_snapshot = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot - assert_equal 'AverageMethodLOC', @helper.format_name(metric_configuration_snapshot) - end - - should 'create aggregation options array' do - assert_equal [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]], @helper.aggregation_options - end - - should 'create scope options' do - assert_equal [["Software", "SOFTWARE"], ["Package", "PACKAGE"], ["Class", "CLASS"], ["Method", "METHOD"]], @helper.scope_options - end - -end diff --git a/plugins/mezuro/test/unit/mezuro_plugin/helpers/module_result_helper_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/helpers/module_result_helper_test.rb deleted file mode 100644 index 63d84ec..0000000 --- a/plugins/mezuro/test/unit/mezuro_plugin/helpers/module_result_helper_test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require "test_helper" - -class ModuleResultHelperTest < ActiveSupport::TestCase - - should 'return last module name when receive a string' do - name = 'Class' - assert_equal name, MezuroPlugin::Helpers::ModuleResultHelper.module_name(name) - end - - should 'return last module name when receive an array of strings' do - name = ['Class', 'Module'] - assert_equal name.last, MezuroPlugin::Helpers::ModuleResultHelper.module_name(name) - end - -end diff --git a/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb deleted file mode 100644 index 515bf53..0000000 --- a/plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb +++ /dev/null @@ -1,59 +0,0 @@ -require "test_helper" - -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_content_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/processing_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures" - -class ProjectContentTest < ActiveSupport::TestCase - - def setup - @project_content = ProjectContentFixtures.project_content - @project = ProjectFixtures.project - @repository = RepositoryFixtures.repository - @processing = ProcessingFixtures.processing - @date = @processing.date - @module = ModuleFixtures.module - @module_result = ModuleResultFixtures.module_result - @date_metric_result = DateMetricResultFixtures.date_metric_result - end - - should 'provide proper short description' do - assert_equal 'Mezuro project', MezuroPlugin::ProjectContent.short_description - end - - should 'provide proper description' do - assert_equal 'Software project tracked by Kalibro', MezuroPlugin::ProjectContent.description - end - - should 'have an html view' do - assert_not_nil @project_content.to_html - end - - should 'get project from service' do - Kalibro::Project.expects(:find).with(@project.id).returns(@project) - assert_equal @project, @project_content.project - end - - should 'add error to base when the project does not exist' do - Kalibro::Project.expects(:find).with(@project.id).raises(Kalibro::Errors::RecordNotFound) - assert_nil @project_content.errors[:base] - @project_content.project - assert_not_nil @project_content.errors[:base] - end - - should 'get repositories of the project from service' do - Kalibro::Repository.expects(:repositories_of).with(@project.id).returns([@repository]) - assert_equal [@repository], @project_content.repositories - end - - should 'add error to base when getting the repositories of a project that does not exist' do - Kalibro::Repository.expects(:repositories_of).with(@project.id).raises(Kalibro::Errors::RecordNotFound) - assert_nil @project_content.errors[:base] - @project_content.repositories - assert_not_nil @project_content.errors[:base] - end - -end diff --git a/plugins/mezuro/test/unit/mezuro_plugin/reading_group_content_test.rb b/plugins/mezuro/test/unit/mezuro_plugin/reading_group_content_test.rb deleted file mode 100644 index 8305807..0000000 --- a/plugins/mezuro/test/unit/mezuro_plugin/reading_group_content_test.rb +++ /dev/null @@ -1,51 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_content_fixtures" - -class ReadingGroupContentTest < ActiveSupport::TestCase - - def setup - @reading_group_content = ReadingGroupContentFixtures.reading_group_content - @reading_group = ReadingGroupFixtures.reading_group - @reading = ReadingFixtures.reading - end - - should 'provide proper short description' do - assert_equal 'Mezuro reading group', MezuroPlugin::ReadingGroupContent.short_description - end - - should 'provide proper description' do - assert_equal 'Set of thresholds to interpret metric results', MezuroPlugin::ReadingGroupContent.description - end - - should 'have an html view' do - assert_not_nil @reading_group_content.to_html - end - - should 'get reading_group from service' do - Kalibro::ReadingGroup.expects(:find).with(@reading_group.id).returns(@reading_group) - assert_equal @reading_group, @reading_group_content.reading_group - end - - should 'add error to base when the reading_group does not exist' do - Kalibro::ReadingGroup.expects(:find).with(@reading_group.id).raises(Kalibro::Errors::RecordNotFound) - assert_nil @reading_group_content.errors[:base] - @reading_group_content.reading_group - assert_not_nil @reading_group_content.errors[:base] - end - - should 'get readings of the reading_group from service' do - Kalibro::Reading.expects(:readings_of).with(@reading_group.id).returns([@reading]) - assert_equal [@reading], @reading_group_content.readings - end - - should 'add error to base when getting the readings of a reading_group that does not exist' do - Kalibro::Reading.expects(:readings_of).with(@reading_group.id).raises(Kalibro::Errors::RecordNotFound) - assert_nil @reading_group_content.errors[:base] - @reading_group_content.readings - assert_not_nil @reading_group_content.errors[:base] - end - -end diff --git a/plugins/mezuro/test/unit/mezuro_plugin_test.rb b/plugins/mezuro/test/unit/mezuro_plugin_test.rb deleted file mode 100644 index f8b3a8c..0000000 --- a/plugins/mezuro/test/unit/mezuro_plugin_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require "test_helper" - -class MezuroPluginTest < ActiveSupport::TestCase - - def setup - @plugin = MezuroPlugin.new - end - - should 'be a noosfero plugin' do - assert_kind_of Noosfero::Plugin, @plugin - end - - should 'have name' do - assert_equal 'Mezuro', MezuroPlugin.plugin_name - end - - should 'have description' do - assert_equal _('A metric analizer plugin.'), MezuroPlugin.plugin_description - end - - should 'have stylesheet' do - assert @plugin.stylesheet? - end - -end diff --git a/plugins/mezuro/views/cms/mezuro_plugin/_configuration_content.html.erb b/plugins/mezuro/views/cms/mezuro_plugin/_configuration_content.html.erb deleted file mode 100644 index 4f5e3d8..0000000 --- a/plugins/mezuro/views/cms/mezuro_plugin/_configuration_content.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -

<%= _(MezuroPlugin::ConfigurationContent.short_description) %>

- -<% - kalibro_configuration = @article.title.nil? ? nil : @article.kalibro_configuration - configuration_names_and_ids = @article.configuration_names_and_ids -%> - -<%= error_messages_for 'kalibro_configuration' %> - - -<%= hidden_field_tag 'configuration_content[profile_id]', profile.id %> -<%= hidden_field_tag 'configuration_id', @article.configuration_id %> -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %> - -
-<%= if kalibro_configuration.nil? - required labelled_form_field _('Clone Configuration'), - f.select(:configuration_to_clone_id, configuration_names_and_ids) -end %> diff --git a/plugins/mezuro/views/cms/mezuro_plugin/_mezuro_content_form.html.erb b/plugins/mezuro/views/cms/mezuro_plugin/_mezuro_content_form.html.erb deleted file mode 100644 index 149de85..0000000 --- a/plugins/mezuro/views/cms/mezuro_plugin/_mezuro_content_form.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= hidden_field_tag 'id', @article.id %> -<%= required_fields_message %> -<%= required f.text_field(:name) %> -<%= f.text_field :description %>
diff --git a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb b/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb deleted file mode 100644 index acce453..0000000 --- a/plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

<%= _(MezuroPlugin::ProjectContent.short_description) %>

- -<% - @project = @article.title.nil? ? nil : @article.project -%> - -<%= error_messages_for 'project_content' %> - -<%= hidden_field_tag 'project_content[profile_id]', profile.id %> -<%= hidden_field_tag 'project_id', @article.project_id %> -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %> diff --git a/plugins/mezuro/views/cms/mezuro_plugin/_reading_group_content.html.erb b/plugins/mezuro/views/cms/mezuro_plugin/_reading_group_content.html.erb deleted file mode 100644 index 61fc7e8..0000000 --- a/plugins/mezuro/views/cms/mezuro_plugin/_reading_group_content.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -

<%= _(MezuroPlugin::ReadingGroupContent.short_description) %>

- -<% - reading_group = @article.title.nil? ? nil : @article.reading_group -%> - -<%= error_messages_for 'reading_group_content' %> - -<%= hidden_field_tag 'reading_group_content[profile_id]', profile.id %> -<%= hidden_field_tag 'reading_group_id', (reading_group.id unless reading_group.nil?) %> -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %> diff --git a/plugins/mezuro/views/content_viewer/show_configuration.rhtml b/plugins/mezuro/views/content_viewer/show_configuration.rhtml deleted file mode 100644 index ee63d9e..0000000 --- a/plugins/mezuro/views/content_viewer/show_configuration.rhtml +++ /dev/null @@ -1,77 +0,0 @@ -<% @configuration_content = @page -@kalibro_configuration = @page.kalibro_configuration %> - -<% owner = (not user.nil?) && user.id == @profile.id %> -<% unless @page.errors[:base].nil? %> - <% if @page.errors[:base] =~ /Kalibro::Errors::RecordNotFound/ %> -

Warning:

-

This Configuration doesn't exist on the Web Service.

- <% if owner %> -

Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?

- <% end %> - <% else %> - <%= @page.errors[:base] %> - <% end %> -<% else %> - - - - - - - - - - -
<%= _('Name') %><%= @kalibro_configuration.name %>
<%= _('Description') %><%= @kalibro_configuration.description %>
- -
- - <% if owner %> - <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_metric_configuration", - :profile => @page.profile.identifier, - :action => "choose_metric", - :id => @configuration_content.id %>
- <% end %> - - - - - - - - - - <% @configuration_content.metric_configurations.each do |metric_configuration| %> - - <% if metric_configuration.metric.compound - edit_action = "edit_compound" - else - edit_action = "edit_native" - end - %> - - <% if metric_configuration.metric.compound %> - - <% else %> - - <% end %> - - - - <% if owner %> - - <% end %> - - <% end %> -
Metric Name
Collector Name
Metric Code
Weight
Aggregation Form
-
<%= link_to metric_configuration.metric.name, :controller => "mezuro_plugin_metric_configuration", :action => edit_action, - :metric_configuration_id => metric_configuration.id, :id => @configuration_content.id, - :profile => @page.profile.identifier %> - Compound Metric - - <%= metric_configuration.base_tool_name %> - <%= metric_configuration.code %><%= metric_configuration.weight %><%= metric_configuration.aggregation_form %><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove", - :metric_configuration_id => metric_configuration.id, :id => @configuration_content.id, - :profile => @page.profile.identifier %>
-<% end %> diff --git a/plugins/mezuro/views/content_viewer/show_project.rhtml b/plugins/mezuro/views/content_viewer/show_project.rhtml deleted file mode 100644 index 89824a9..0000000 --- a/plugins/mezuro/views/content_viewer/show_project.rhtml +++ /dev/null @@ -1,52 +0,0 @@ -<% @project = @page.project %> -<% unless @page.errors[:base].nil? %> - - <% if @page.errors[:base] == "Kalibro::Errors::RecordNotFound" %> -

Warning:

-

This project doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?

- <% else %> - <%= @page.errors[:base] %> - <% end %> -<% else %> - - - - - - - - - - -
<%= _('Name') %><%= @project.name %>
<%= _('Description') %><%= @project.description %>
-
-
<%= _('Repositories') %>
- - <% @page.repositories.each do |repository| %> - - - - - - <% end %> -
<%= link_to repository.name, :controller => "mezuro_plugin_repository", - :profile => @page.profile.identifier, - :action => "show", - :id => @page.id, - :repository_id => repository.id %><%= link_to _('Edit'), {:controller => "mezuro_plugin_repository", - :profile => @page.profile.identifier, - :action => "edit", - :id => @page.id, - :repository_id => repository.id}, :class=>"button with-text icon-edit" %><%= link_to _('Remove'), {:controller => "mezuro_plugin_repository", - :profile => @page.profile.identifier, - :action => "destroy", - :id => @page.id, - :repository_id => repository.id}, :class=>"button with-text icon-delete" %>
- -
- <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Repository", :controller => "mezuro_plugin_repository", - :profile => @page.profile.identifier, - :action => "new", - :id => @page.id %>
- -<% end %> diff --git a/plugins/mezuro/views/content_viewer/show_reading_group.rhtml b/plugins/mezuro/views/content_viewer/show_reading_group.rhtml deleted file mode 100644 index 6743e55..0000000 --- a/plugins/mezuro/views/content_viewer/show_reading_group.rhtml +++ /dev/null @@ -1,49 +0,0 @@ -<% @reading_group = @page.reading_group %> - -<% unless @page.errors[:base].nil? %> - <% if @page.errors[:base] == "Kalibro::Errors::RecordNotFound" %> -

Warning:

-

This reading group doesn't exist on the Web Service. Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?

- <% else %> - <%= @page.errors[:base] %> - <% end %> -<% else %> - - - - - - - - - - -
<%= _('Name') %><%= @reading_group.name %>
<%= _('Description') %><%= @reading_group.description %>
-
-
<%= _('Readings') %>
- - <% @page.readings.each do |reading| %> - - - - - - - <% end %> -
<%= link_to reading.label, :controller => "mezuro_plugin_reading", - :profile => @page.profile.identifier, - :action => "edit", - :id => @page.id, - :reading_id => reading.id %><%= reading.grade %><%= link_to _('Remove'), {:controller => "mezuro_plugin_reading", - :profile => @page.profile.identifier, - :action => "destroy", - :id => @page.id, - :reading_id => reading.id}, :class=>"button with-text icon-delete" %>
- -
- <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Reading", :controller => "mezuro_plugin_reading", - :profile => @page.profile.identifier, - :action => "new", - :id => @page.id %>
- -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_compound_metric_configuration_form.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/_compound_metric_configuration_form.html.erb deleted file mode 100644 index 8c184fe..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_compound_metric_configuration_form.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<%= hidden_field_tag :id, @configuration_content.id %> -<%= f.hidden_field :configuration_id, :value => @configuration_content.configuration_id %> - -<% f.fields_for :metric do |m| %> - <%= m.hidden_field :compound, :value => "true" %> - <%= required labelled_form_field _('Metric Name:'), m.text_field(:name, :value => @metric_configuration.metric.name) %> - <%= labelled_form_field _('Description:'), m.text_field(:description, :value => @metric_configuration.metric.description) %> - <%= required labelled_form_field _('Script:'), m.text_area(:script, :rows => 5, :value => @metric_configuration.metric.script) %> - <%= required labelled_form_field _('Scope:'), - m.select(:scope, MezuroPlugin::Helpers::ContentViewerHelper.scope_options, :selected => @metric_configuration.metric.scope) %> -<% end %> - -<%= required labelled_form_field _('Code:'), f.text_field(:code) %> -<%= required labelled_form_field _('Aggregation Form:'), - f.select(:aggregation_form, MezuroPlugin::Helpers::ContentViewerHelper.aggregation_options) %> -<%= required labelled_form_field _('Weight:'), f.text_field(:weight) %> -<%= required labelled_form_field _('Reading Group:'), f.select(:reading_group_id, @reading_group_names_and_ids) %> - -

<%= f.submit "Save" %>

diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/_error_page.html.erb deleted file mode 100644 index 089af13..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_error_page.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

An error occured:

-<%= @message %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_metric_codes.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/_metric_codes.html.erb deleted file mode 100644 index 630b914..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_metric_codes.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - <% metric_configurations.each do |metric_configuration| %> - - - - - <% end %> -
Metric Name
Metric Code
<%= metric_configuration.metric.name %><%= metric_configuration.code %>
diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_form.rhtml b/plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_form.rhtml deleted file mode 100644 index b54bd42..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_form.rhtml +++ /dev/null @@ -1,26 +0,0 @@ -<%= hidden_field_tag :id, @configuration_content.id %> -<%= f.hidden_field :configuration_id, :value => @configuration_content.configuration_id %> - -<%= labelled_form_field _('Collector Name:'), f.text_field(:base_tool_name, :readonly => true) %> - -<% f.fields_for :metric do |m| %> - <%= m.hidden_field :compound, :value => "false" %> - <% @metric_configuration.metric.language.each do |language| %> - <%= m.hidden_field :language, :multiple => true, :value => language %> - <% end %> - <%= m.hidden_field "scope", :value => @metric.scope %> - <%= required labelled_form_field _('Metric Name:'), m.text_field(:name, :readonly => true, :value => @metric.name) %> - <%= labelled_form_field _('Description:'), m.text_field(:description, :readonly => true, :value => @metric.description) %> -<% end %> - -<%= required labelled_form_field _('Code:'), f.text_field(:code) %> - -<%= required labelled_form_field _('Aggregation Form:'), -f.select(:aggregation_form, MezuroPlugin::Helpers::ContentViewerHelper.aggregation_options) %> - -<%= required labelled_form_field _('Weight:'), f.text_field(:weight) %> - -<%= required labelled_form_field _('Reading Group:'), -f.select(:reading_group_id, @reading_group_names_and_ids) %> - -

<%= f.submit "Save" %>

diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_view.rhtml b/plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_view.rhtml deleted file mode 100644 index 5a8fcd0..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_view.rhtml +++ /dev/null @@ -1,15 +0,0 @@ -

- Collector Name: <%= @metric_configuration.base_tool_name %> -

-

- Metric Name: <%= @metric.name %> -

-

- Code: <%= @metric_configuration.code %> -

-

- Aggregation Form: <%= @metric_configuration.aggregation_form %> -

-

- Weight: <%= @metric_configuration.weight %> -

diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb deleted file mode 100644 index 2075e60..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

- -<%= link_to "New Compound Metric", :controller => "mezuro_plugin_metric_configuration", :action => "new_compound", - :id => @configuration_content.id %> - -
Base Tools:
-<% @base_tools.each do |base_tool| %> -

<%= link_to base_tool.name, "#", :onclick => "jQuery(\"\##{base_tool.name}\").toggle();"%>

-
- - -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb deleted file mode 100644 index 0e1589d..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb +++ /dev/null @@ -1,16 +0,0 @@ - - - - -

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

- -<% owner = (not user.nil?) && user.id == @profile.id %> - -<% form_for :metric_configuration, :url => {:action =>"update", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> - <%= f.hidden_field :id %> - <%= render :partial => "compound_metric_configuration_form", :locals => {:f => f} %> -<% end %> - -<%= render :partial => "mezuro_plugin_range/ranges", :locals => {:owner => owner} %> -
-<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb deleted file mode 100644 index 0f5e39b..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb +++ /dev/null @@ -1,18 +0,0 @@ - - - - -

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

- -<% owner = (not user.nil?) && user.id == @profile.id %> - -<% if owner %> - <% form_for :metric_configuration, :url => {:action =>"update", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> - <%= f.hidden_field :id %> - <%= render :partial => "native_metric_configuration_form", :locals => {:f => f} %> - <% end %> -<% else %> - <%= render :partial => "native_metric_configuration_view" %> -<% end %> - -<%= render :partial => "mezuro_plugin_range/ranges", :locals => {:owner => owner} %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb deleted file mode 100644 index 5a749a3..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

- -<% form_for :metric_configuration, :url => {:action =>"create", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> - <%= render :partial => "compound_metric_configuration_form", :locals => {:f => f} %> -<% end %> - -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> diff --git a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb b/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb deleted file mode 100644 index 8b74013..0000000 --- a/plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - - -

<%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %>

- -<% form_for :metric_configuration, :url => {:action =>"create", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %> - <%= render :partial => "native_metric_configuration_form", :locals => {:f => f} %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_module_result/_error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_module_result/_error_page.html.erb deleted file mode 100644 index 089af13..0000000 --- a/plugins/mezuro/views/mezuro_plugin_module_result/_error_page.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

An error occured:

-<%= @message %> diff --git a/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml b/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml deleted file mode 100644 index 603769c..0000000 --- a/plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml +++ /dev/null @@ -1,41 +0,0 @@ - - - Metric - Value - Weight - Threshold - - - - <% @metric_results.each do |metric_result| %> - <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%> - <% range_snapshots = metric_configuration_snapshot.range_snapshot %> - <% metric_name = metric_configuration_snapshot.metric.name %> - <% formatted_name = metric_name.delete("() ") %> - <% if !range_snapshots.nil? %> - - <%= metric_name %> - <%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %> - <%= metric_configuration_snapshot.weight %> - <% range_snapshots.each do |range_snapshot| %> - <% if range_snapshot.beginning <= metric_result.value and range_snapshot.end > metric_result.value %> - - - <%= range_snapshot.label %> - - - - - -
-
- - - <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %> - - - <% end %> - <% end %> - <% end %> - <% end %> - diff --git a/plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml b/plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml deleted file mode 100644 index f0bf1ce..0000000 --- a/plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml +++ /dev/null @@ -1,24 +0,0 @@ -<%= render :partial => "source_tree", :locals => {:module_result => @module_result} %> -
<%= _"Metric results for: #{MezuroPlugin::Helpers::ModuleResultHelper.module_name(@module_result.module.name)} (#{@module_result.module.granularity})" %>
- -
-
- - <%= render :partial => "metric_results", :locals => {:metric_results => @metric_results, :module_result_id => @module_result.id} %> - - - - - - -
- - - - - <%= _('Grade:') %> - <%= "%.02f" % @module_result.grade %> - - -
-
diff --git a/plugins/mezuro/views/mezuro_plugin_module_result/_score_history.rhtml b/plugins/mezuro/views/mezuro_plugin_module_result/_score_history.rhtml deleted file mode 100644 index b30fc6a..0000000 --- a/plugins/mezuro/views/mezuro_plugin_module_result/_score_history.rhtml +++ /dev/null @@ -1 +0,0 @@ -<%= image_tag(MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(@history)) %> diff --git a/plugins/mezuro/views/mezuro_plugin_module_result/_source_tree.rhtml b/plugins/mezuro/views/mezuro_plugin_module_result/_source_tree.rhtml deleted file mode 100644 index ae5c448..0000000 --- a/plugins/mezuro/views/mezuro_plugin_module_result/_source_tree.rhtml +++ /dev/null @@ -1,34 +0,0 @@ -

<%= _('Source tree') %>

-<% helper = MezuroPlugin::Helpers::ModuleResultHelper %> -<% module_name = helper.module_name(module_result.module.name) %> -<% module_label = "#{module_name} (#{module_result.module.granularity})" %> - -

-

- <% module_result.parents.each do |parent| %> - / - <%= helper.module_name parent.module.name %> - - <% end %>/ <%= helper.module_name module_name %> -

-

- - - <% module_result.children.each do |child| %> - <% if child.module.granularity=='PACKAGE' %> - - - - - <% else %> - - - - - <% end %> - <% end %> -
<%= image_tag('/plugins/mezuro/images/folder.png')%><%= helper.module_name child.module.name %>
<%= image_tag('/plugins/mezuro/images/file.png') %> - - <%= helper.module_name child.module.name %> - -
diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb deleted file mode 100644 index f8dac25..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<%= remote_form_for :range, :url => {:action =>"update_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> - <%= hidden_field_tag :beginning_id, beginning_id %> - <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :id => id, :beginning_id => beginning_id, :range => range } %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/_error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/_error_page.html.erb deleted file mode 100644 index 089af13..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/_error_page.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

An error occured:

-<%= @message %> diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/_new_range.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/_new_range.html.erb deleted file mode 100644 index 1835998..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/_new_range.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= remote_form_for :range, :url => {:action =>"create_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> - <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :id => id } %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb deleted file mode 100644 index 0c7e812..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb +++ /dev/null @@ -1,81 +0,0 @@ - - - - -

<%= @configuration_content.name %> Configuration

- -<%= form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @configuration_content.id %> - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> - -

- <%= "Metric Name:" + @metric.name %> -

- <% f.fields_for :metric do |m| %> - <%= m.hidden_field :name, :value => @metric.name %> -

- <%= m.label :description, "Description:" %> - <%= m.text_field "description", :value => @metric.description %> -

-

- <%= m.label :scope, "Scope:" %> - <%= m.select :scope, [["Class", "CLASS"]], :selected => @metric.scope %> -

-

- <%= m.label :script, "Script:" %> - <%= m.text_area "script", :value => @metric.script %> -

- <% end %> -

- <%= f.label :code, "Code:" %> - <%= f.text_field "code" %> -

-

- <%= f.label :aggregation_form, "Aggregation Form:" %> - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> -

-

- <%= f.label :weight, "Weight:" %> - <%= f.text_field :weight %> -

-

- <%= f.submit "Save" %> -

-<% end %> - - -
Ranges

- - - - - - - - - - <% if (@metric_configuration.ranges!=nil) - @metric_configuration.ranges.each do |range| %> - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, - :metric_name => @metric_configuration.metric.name} %> - <% end - end %> -
- Label - - Beginning - - End - - Grade - - Color -
- -
-<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :id => @configuration_content.id, :metric_name => @metric.name} %> - - -
-<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb deleted file mode 100644 index e706583..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb +++ /dev/null @@ -1,89 +0,0 @@ - - - - -

<%= @configuration_content.name %> Configuration

- -<%= form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @configuration_content.id %> - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> - - <% f.fields_for :metric do |m| %> - - <% @metric.language.each do |language| %> - <%= m.hidden_field :language, :multiple => true, :value => language %> - <% end %> - - <%= m.hidden_field "scope", :value => @metric.scope %> -

- <%= m.label :origin, "Collector Name:" %> - <%= @metric.origin %> - <%= m.hidden_field "origin", :value => @metric.origin %> -

-

- <%= m.label :metric_name, "Metric Name:" %> - <%= @metric.name %> - <%= m.hidden_field "name", :value => @metric.name %> -

- - <% m.label :description, "Description:" %> - <% @metric.description %> - <% m.hidden_field "description", :value => @metric.description %> - - <% end %> -

- <%= f.label :code, "Code:" %> - <%= @metric_configuration.code %> - <%= f.hidden_field "code", :value => @metric_configuration.code %> -

-

- <%= f.label :aggregation_form, "Aggregation Form:" %> - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> -

-

- <%= f.label :weight, "Weight:" %> - <%= f.text_field "weight", :value => @metric_configuration.weight %> -

- -

- <%= f.submit "Save" %> -

-<% end %> - - -
Ranges

- - - - - - - - - - - - <% if (@metric_configuration.ranges!=nil) - @metric_configuration.ranges.each do |range| %> - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id, - :metric_name => @metric.name} %> - <% end - end %> -
- Label - - Beginning - - End - - Grade - - Color -
- -
-<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :id => @configuration_content.id, :metric_name => @metric.name} %> - - - diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/error_page.html.erb deleted file mode 100644 index 1d3c248..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/error_page.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -

An error occured:

-<%= @message %> - diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric_configuration.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric_configuration.html.erb deleted file mode 100644 index 933f94a..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric_configuration.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -

<%= @configuration_content.name %> Configuration

- -<%= form_for :metric_configuration, :url => {:action =>"create_compound_metric_configuration", -:controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @configuration_content.id %> - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> - - <% f.fields_for :metric do |m| %> -

- <%= m.label :name, "Name:" %> - <%= m.text_field "name" %> -

-

- <%= m.label :description, "Description:" %> - <%= m.text_field "description" %> -

-

- <%= m.label :scope, "Scope:" %> - <%= m.select :scope, [["Class", "CLASS"]] %> -

-

- <%= m.label :script, "Script:" %> - <%= m.text_area "script" %> -

- <% end %> -

- <%= f.label :code, "Code:" %> - <%= f.text_field "code" %> -

-

- <%= f.label :aggregation_form, "Aggregation Form:" %> - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> -

-

- <%= f.label :weight, "Weight:" %> - <%= f.text_field :weight %> -

-

- <%= f.submit "Add" %> -

-<% end %> - -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %> diff --git a/plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb b/plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb deleted file mode 100644 index eb640c7..0000000 --- a/plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb +++ /dev/null @@ -1,51 +0,0 @@ - - -

<%= @configuration_content.name %> Configuration

- -<%= form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> - <%= hidden_field_tag :id, @configuration_content.id %> - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %> - - <% f.fields_for :metric do |m| %> - - <% @metric.language.each do |language| %> - <%= m.hidden_field :language, :multiple => true, :value => language %> - <% end %> - - <%= m.hidden_field "scope", :value => @metric.scope %> -

- <%= m.label :origin, "Collector Name:" %> - <%= @metric.origin %> - <%= m.hidden_field "origin", :value => @metric.origin %> -

-

- <%= m.label :name, "Metric Name:" %> - <%= @metric.name %> - <%= m.hidden_field "name", :value => @metric.name %> -

- - <% m.label :description, "Description:" %> - <% @metric.description %> - <% m.hidden_field "description", :value => @metric.description %> - - <% end %> -

- <%= f.label :code, "Code:" %> - <%= f.text_field :code %> -

-

- <%= f.label :aggregation_form, "Aggregation Form:" %> - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> -

-

- <%= f.label :weight, "Weight:" %> - <%= f.text_field :weight %> -

- -

- <%= f.submit "Add" %> -

- -<% end %> - diff --git a/plugins/mezuro/views/mezuro_plugin_processing/_error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_processing/_error_page.html.erb deleted file mode 100644 index 55bdf75..0000000 --- a/plugins/mezuro/views/mezuro_plugin_processing/_error_page.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

An error occured:

-<%= @processing.error.message %> diff --git a/plugins/mezuro/views/mezuro_plugin_processing/_processing.rhtml b/plugins/mezuro/views/mezuro_plugin_processing/_processing.rhtml deleted file mode 100644 index f5cc6bd..0000000 --- a/plugins/mezuro/views/mezuro_plugin_processing/_processing.rhtml +++ /dev/null @@ -1,36 +0,0 @@ -
- -

<%= _('Last Result') %>

- - - - - - - <% @processing.process_time.each do |process_time| %> - - - - - <% end %> - - - - -
<%= _('Date') %><%= @processing.date.inspect %>
<%= _(process_time.state + ' time') %><%= MezuroPlugin::Helpers::ContentViewerHelper.format_time(process_time.time) %>
Click to choose specific date:<%= link_to(image_tag('/images/calendar_date_select/calendar.png', :width => 20, :height => 20, :onClick => "$( 'datepicker' ).toggle();"), "javascript:void(0)") %>
- -
- - - - diff --git a/plugins/mezuro/views/mezuro_plugin_processing/_processing_error.rhtml b/plugins/mezuro/views/mezuro_plugin_processing/_processing_error.rhtml deleted file mode 100644 index 1a4eaca..0000000 --- a/plugins/mezuro/views/mezuro_plugin_processing/_processing_error.rhtml +++ /dev/null @@ -1,12 +0,0 @@ -

<%= _('ERROR') %>

-

- <%= "State when error ocurred: #{@processing.state}" %> -
- <% error = @processing.error %> - <%= error.message %> -

    - <% error.stack_trace.each do |trace| %> -
  • <%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %>
  • - <% end %> -
-

diff --git a/plugins/mezuro/views/mezuro_plugin_profile/_error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_profile/_error_page.html.erb deleted file mode 100644 index 089af13..0000000 --- a/plugins/mezuro/views/mezuro_plugin_profile/_error_page.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

An error occured:

-<%= @message %> diff --git a/plugins/mezuro/views/mezuro_plugin_range/_edit.html.erb b/plugins/mezuro/views/mezuro_plugin_range/_edit.html.erb deleted file mode 100644 index 8b02ace..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/_edit.html.erb +++ /dev/null @@ -1,4 +0,0 @@ -<% remote_form_for :range, :url => {:action =>"update", :controller => "mezuro_plugin_range"}, :method => :get do |f| %> - <%= hidden_field_tag :beginning_id, @beginning_id %> - <%= render :partial => "form", :locals => {:f => f} %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_range/_error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_range/_error_page.html.erb deleted file mode 100644 index 089af13..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/_error_page.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

An error occured:

-<%= @message %> diff --git a/plugins/mezuro/views/mezuro_plugin_range/_form.html.erb b/plugins/mezuro/views/mezuro_plugin_range/_form.html.erb deleted file mode 100644 index 142fdc3..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/_form.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%= hidden_field_tag :id, @content_id %> -<%= hidden_field_tag :metric_configuration_id, @metric_configuration_id %> -<%= hidden_field_tag :reading_group_id, @reading_group_id %> -<%= hidden_field_tag :compound, @compound %> - -<%= f.hidden_field :id %> - - <%= required labelled_form_field _('Label'), - f.select(:reading_id, @reading_labels_and_ids) %>
- - - - - - - - - - - - - -
- <%= f.label :beginning, "(*) Beginning:" %> - - <%= required f.text_field :beginning, :id => "range_beginning" %> <%= link_to('-∞', 'javascript:void(0)', :onClick => "jQuery( '#range_beginning' ).val('-INF');") %> -
- <%= f.label :end, "(*) End:" %> - - <%= required f.text_field(:end, :id => "range_end") %> <%= link_to('+∞', 'javascript:void(0)', :onClick => "jQuery( '#range_end' ).val('+INF');") %> -
- <%= f.label :comments, "(*) Comments:" %> - - <%= required f.text_area :comments, :rows => 3 %> -
-
-<%= f.submit "Save Range" %> diff --git a/plugins/mezuro/views/mezuro_plugin_range/_new.html.erb b/plugins/mezuro/views/mezuro_plugin_range/_new.html.erb deleted file mode 100644 index 1ae8d95..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/_new.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<% remote_form_for :range, :url => {:action =>"create", :controller => "mezuro_plugin_range"}, :method => :get do |f| %> - <%= render :partial => "form", :locals => {:f => f} %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_range/_range.html.erb b/plugins/mezuro/views/mezuro_plugin_range/_range.html.erb deleted file mode 100644 index 8994aec..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/_range.html.erb +++ /dev/null @@ -1,24 +0,0 @@ - - - <%=range.label%> - - - <%=range.beginning%> - - - <%=range.end%> - - - <%=range.grade%> - - - <% if (not user.nil?) && user.id == @profile.id %> - <%= link_to_remote "Edit", :url => {:action =>"edit", :controller => "mezuro_plugin_range", :id => params[:id], :metric_configuration_id => params[:metric_configuration_id], :range_id => range.id, :reading_group_id => reading_group_id} %> - - <%= link_to "Remove", :action =>"remove", :controller => "mezuro_plugin_range", :id => params[:id], :metric_configuration_id => params[:metric_configuration_id], :range_id => range.id, :compound => compound %> - - <% else %> - - - <% end %> - diff --git a/plugins/mezuro/views/mezuro_plugin_range/_ranges.html.erb b/plugins/mezuro/views/mezuro_plugin_range/_ranges.html.erb deleted file mode 100644 index 5589184..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/_ranges.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -
Ranges

- - - - - - - - - - <% @ranges.each do |range| %> - <%= render :partial => "mezuro_plugin_range/range", :locals => {:range => range, :id => @configuration_content.id, - :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound} %> - <% end %> -
- Label - - Beginning - - End - - Grade - - Color -
- -
-<% if owner %> - <%= link_to_remote "New Range", :url => {:action =>"new", :controller => "mezuro_plugin_range", :id => @configuration_content.id, :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound} %> -<% end %> - diff --git a/plugins/mezuro/views/mezuro_plugin_range/create.rjs b/plugins/mezuro/views/mezuro_plugin_range/create.rjs deleted file mode 100644 index a4c68cf..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/create.rjs +++ /dev/null @@ -1,6 +0,0 @@ -if @error.nil? - page.visual_effect :toggle_slide, "form" - page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range, :reading_group_id => @reading_group_id, :compound => @compound} -else - page.alert @error -end diff --git a/plugins/mezuro/views/mezuro_plugin_range/edit.rjs b/plugins/mezuro/views/mezuro_plugin_range/edit.rjs deleted file mode 100644 index db71861..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/edit.rjs +++ /dev/null @@ -1,3 +0,0 @@ -page.replace_html 'form', :partial => "edit", :locals => {:range => @range} -page.visual_effect :slide_down, "form" - diff --git a/plugins/mezuro/views/mezuro_plugin_range/new.rjs b/plugins/mezuro/views/mezuro_plugin_range/new.rjs deleted file mode 100644 index 43bf549..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/new.rjs +++ /dev/null @@ -1,3 +0,0 @@ -page.replace_html 'form', :partial => "new" -page.visual_effect :slide_down, "form" - diff --git a/plugins/mezuro/views/mezuro_plugin_range/update.rjs b/plugins/mezuro/views/mezuro_plugin_range/update.rjs deleted file mode 100644 index 3000105..0000000 --- a/plugins/mezuro/views/mezuro_plugin_range/update.rjs +++ /dev/null @@ -1,5 +0,0 @@ -if @error.nil? - page.reload() -else - page.alert @error -end diff --git a/plugins/mezuro/views/mezuro_plugin_reading/_form.html.erb b/plugins/mezuro/views/mezuro_plugin_reading/_form.html.erb deleted file mode 100644 index 9840b0b..0000000 --- a/plugins/mezuro/views/mezuro_plugin_reading/_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%= hidden_field_tag :id, @reading_group_content.id %> -<%= f.hidden_field(:group_id, :value => @reading_group_content.reading_group_id) %> - -<%= required labelled_form_field _('Label:'), f.text_field(:label) %> - -<%= required labelled_form_field _('Grade:'), f.text_field(:grade) %> - -<%= required labelled_form_field _('Color:'), -colorpicker_field(:reading, :color) %>Click in the field to change Color - -
- -

<%= f.submit "Save" %>

diff --git a/plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb b/plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb deleted file mode 100644 index 233dc80..0000000 --- a/plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ - - - - -

<%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %>

- -<% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> - <%= f.hidden_field :id %> - <%= render :partial => "form", :locals => {:f => f} %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_reading/new.html.erb b/plugins/mezuro/views/mezuro_plugin_reading/new.html.erb deleted file mode 100644 index 78ecf16..0000000 --- a/plugins/mezuro/views/mezuro_plugin_reading/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - -

<%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %>

- -<% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %> - <%= render :partial => "form", :locals => {:f => f} %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_repository/_error_page.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/_error_page.html.erb deleted file mode 100644 index 089af13..0000000 --- a/plugins/mezuro/views/mezuro_plugin_repository/_error_page.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

An error occured:

-<%= @message %> diff --git a/plugins/mezuro/views/mezuro_plugin_repository/_form.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/_form.html.erb deleted file mode 100644 index abb66f0..0000000 --- a/plugins/mezuro/views/mezuro_plugin_repository/_form.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<%= hidden_field_tag :id, @project_content.id %> -<%= f.hidden_field(:project_id, :value => @project_content.project_id) %> - -<%= required labelled_form_field _('Name'), f.text_field(:name) %> - -<%= labelled_form_field _("Description"), f.text_field(:description) %> - -<%= required labelled_form_field _('License'), -f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.license_options) %> - -<%= required labelled_form_field _('Process Period'), -f.select(:process_period, MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options) %> - -<%= required labelled_form_field _('Type'), -f.select(:type, @repository_types) %> - -<%= required labelled_form_field _('Address'), -f.text_field(:address) %> - -<%= required labelled_form_field _('Configuration'), -f.select(:configuration_id, @configuration_select) %> - -

<%= f.submit "Add" %>

diff --git a/plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb deleted file mode 100644 index 0b483e6..0000000 --- a/plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - - -

<%= link_to("#{@project_content.name} Project", @project_content.view_url) %>

-<% form_for :repository, :url => {:action =>"save", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> - <%= f.hidden_field :id %> - <%= render :partial => "form", :locals => {:f => f} %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_repository/new.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/new.html.erb deleted file mode 100644 index 0bc4b07..0000000 --- a/plugins/mezuro/views/mezuro_plugin_repository/new.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - - -

<%= link_to("#{@project_content.name} Project", @project_content.view_url) %>

-<% form_for :repository, :url => {:action =>"save", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %> - <%= render :partial => "form", :locals => {:f => f} %> -<% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_repository/show.html.erb b/plugins/mezuro/views/mezuro_plugin_repository/show.html.erb deleted file mode 100644 index 8d8a72c..0000000 --- a/plugins/mezuro/views/mezuro_plugin_repository/show.html.erb +++ /dev/null @@ -1,45 +0,0 @@ - -

<%= link_to("#{@project_content.name} Project", @project_content.view_url) %>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<%= _('Name') %><%= @repository.name %>
<%= _('Description') %><%= @repository.description %>
<%= _('License') %><%= @repository.license %>
<%= _('Process Period') %><%= MezuroPlugin::Helpers::ContentViewerHelper.periodicity_option(@repository.process_period.to_i) %>
<%= _('Type') %><%= @repository.type %>
<%= _('Address') %><%= @repository.address %>
<%= _('Configuration') %><%= @configuration_name %>
<%= _('Status')%> -
Retrieving
-
-
-
- -
-
-- libgit2 0.21.2