Commit e9371699d8dcb40f2230beae59d3d79a514231b1

Authored by Antonio Terceiro
1 parent f3a5d0e9

Remove mezuro plugin by request of its authors

Mezuro is now a standalone application.
Showing 181 changed files with 0 additions and 7634 deletions   Show diff stats
plugins/mezuro/AUTHORS
@@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
1 -Mezuro Authors  
2 -==============  
3 -  
4 -Copyright 2010-2013  
5 --------------------  
6 -  
7 - Almir Alves Pereira (almir.sne at gmail.com)  
8 - Alessandro Palmeira (alessandro.palmeira at gmail.com)  
9 - Andre Casimiro (ah.casimiro at gmail.com)  
10 - Antonio Terceiro (terceiro at colivre.coop.br)  
11 - Caio Salgado (caio.csalgado at gmail.com)  
12 - Carlos Morais (carlos88morais at gmail.com)  
13 - Daniel Alves (danpaulalves at gmail.com)  
14 - Daniela Feitosa (daniela at colivre.coop.br)  
15 - Diego Araújo (diegoamc90 at gmail.com)  
16 - Everton Santos (everton2x4 at gmail.com)  
17 - Guilherme Rojas (guilhermehrojas at gmail.com)  
18 - Jefferson Fernandes (jeffs.fernandes at gmail.com)  
19 - Joao Machini (joao.machini at gmail.com)  
20 - João da Silva (jaodsilv@linux.ime.usp.br)  
21 - Paulo Meirelles (paulo at softwarelivre.org)  
22 - Pedro Leal (pedrombl at gmail.com)  
23 - Rafael Manso (rr.manzo at gmail.com)  
24 - Rafael Messias (rmmartins at gmail.com)  
25 - Renan Teruo (renanteruoc at gmail.com)  
26 - Rodrigo Souto (rodrigo at colivre.coop.br)  
27 -  
28 -Collaborators (from USP Lab XP course 2010 on another code)  
29 ------------------------------------------------------------  
30 -  
31 - Ana Paula Oliveira dos Santos (anapaulao.santos at gmail.com)  
32 - Lucianna Almeida (lucianna.th at gmail.com)  
33 - Thiago Colucci (ticolucci at gmail.com)  
34 - Vinicius Daros (vinicius.k.daros at gmail.com)  
35 - Viviane Almeida Santos (viviane.almeida at gmail.com)  
36 -  
37 -Advisors  
38 ---------  
39 -  
40 - Fabio Kon (fabio.kon at ime.usp.br)  
41 - Alfredo Goldman (gold at ime.usp.br)  
42 -  
plugins/mezuro/README.md
@@ -1,144 +0,0 @@ @@ -1,144 +0,0 @@
1 -README - Mezuro Plugin  
2 -======================  
3 -  
4 -Mezuro is a source code tracking platform based on Noosfero social networking  
5 -platform with Mezuro Plugin actived to access Kalibro Web Service.  
6 -  
7 -  
8 -INSTALL  
9 -=======  
10 -  
11 -Dependences  
12 ------------  
13 -  
14 -See the Noosfero INSTALL (and HACKING) file. After install Noosfero, you must  
15 -install Mezuro dependences:  
16 -  
17 -$ gem install --no-ri --no-rdoc nokogiri -v 1.5.0  
18 -$ gem install --no-ri --no-rdoc wasabi -v 2.0.0  
19 -$ gem install --no-ri --no-rdoc savon -v 0.9.7  
20 -$ gem install --no-ri --no-rdoc googlecharts  
21 -  
22 -$ gem uninstall rack  
23 -$ gem install --no-ri --no-rdoc rack -v 1.0.1  
24 -  
25 -  
26 -*with RVM*  
27 -  
28 -if you want to use RVM (Ruby Version Manager) environment, just run:  
29 -  
30 -$ plugins/mezuro/script/install/install-rvm.sh  
31 -  
32 -  
33 -Enable Mezuro Plugin  
34 ---------------------  
35 -  
36 -Also, you need to enable Mezuro Plugin at your Noosfero installation:  
37 -  
38 -cd <your_noosfero_dir>  
39 -./script/noosfero-plugins enable mezuro  
40 -  
41 -  
42 -Install Service  
43 ----------------  
44 -  
45 -To run Mezuro (Noosfero with Mezuro Plugin), you need to install the Kalibro  
46 -Service. For that, see:  
47 -https://gitorious.org/kalibro/kalibro/blobs/master/INSTALL  
48 -  
49 -  
50 -Configure Service Address  
51 --------------------------  
52 -  
53 -Addictionaly, copy service.yml.example to service.yml and define your Kalibro  
54 -Service address:  
55 -  
56 -$ cd <your_noosfero_dir>/plugin/mezuro  
57 -$ cp service.yml.example service.yml  
58 -  
59 -If you install Kalibro Service at localhost, just keep the default  
60 -adress:  
61 -  
62 -http://localhost:8080/KalibroService/  
63 -  
64 -  
65 -Set Licences list  
66 ------------------  
67 -  
68 -$ cd <your_noosfero_dir>/plugin/mezuro  
69 -$ cp licence.yml.example licence.yml  
70 -  
71 -  
72 -Apply Mezuro Theme  
73 ----------------------  
74 -  
75 -(Our RVM install script already do that)  
76 -  
77 -If you want, you can use the Mezuro default theme:  
78 -  
79 -$ cd public/designs/themes && rm -f default  
80 -$ git clone git://gitorious.org/mezuro/mezuro-theme.git  
81 -$ ln -s mezuro-theme/ default && cd ../../../  
82 -  
83 -  
84 -Active Mezuro Plugin on Noosfero Environment  
85 ---------------------------------------------  
86 -  
87 -As a Noosfero administrator user, go to administrator panel:  
88 -  
89 -- Click on "Enable/disable plugins" option  
90 -- Click on "Mezuro Plugin" check-box  
91 -  
92 -  
93 -DEVELOPMENT  
94 -===========  
95 -  
96 -Get the Mezuro (Noosfero with Mezuro Plugin) development repository:  
97 -  
98 -$ git clone https://gitorious.org/+mezuro/noosfero/mezuro  
99 -$ cd mezuro  
100 -$ git checkout mezuro  
101 -  
102 -Running Mezuro tests  
103 ---------------------  
104 -  
105 -$ rake test:noosfero_plugins:mezuro  
106 -  
107 -or just:  
108 -  
109 -$ rake test:noosfero_plugin_mezuro:units  
110 -$ rake test:noosfero_plugin:mezuro:functionals  
111 -  
112 -  
113 -Get Involved  
114 -============  
115 -  
116 -If you found any bug and/or want to collaborate, please send an e-mail to  
117 -paulo@softwarelivre.org  
118 -  
119 -  
120 -LICENSE  
121 -=======  
122 -  
123 -Copyright (c) The Author developers.  
124 -  
125 -See Noosfero license.  
126 -  
127 -  
128 -AUTHORS  
129 -=======  
130 -  
131 -Please, see the Mezuro AUTHORS file.  
132 -  
133 -  
134 -ACKNOWLEDGMENTS  
135 -===============  
136 -  
137 -The authors have been supported by organizations:  
138 -  
139 -University of São Paulo (USP)  
140 -FLOSS Competence Center  
141 -http://ccsl.ime.usp.br  
142 -  
143 -Brazilian National Research Council (CNPQ)  
144 -http://www.cnpq.br/  
plugins/mezuro/TODO
@@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
1 -README/TODO do branch cucumber_tests  
2 -  
3 -Tarefas:  
4 -- Escrever uma história (procurar uma já escrita) para isso  
5 -- Descobrir o porquê dos erros nos testes do mezuro (repository_url)  
6 -- Dar rebase com o mezuro-dev (os tais testes passam no mezuro-dev)  
7 -- Fazer mais testes  
8 -- Ver como/quando o selenium pode ser integrado ao projeto (conversar com noosfero/ talvez até tentar implementar alguma coisa??)  
9 -  
10 -  
11 -Testes de aceitação a serem feitos: (* já feito)  
12 -  
13 -Projetos:  
14 - Criar  
15 - * correto  
16 - * errado  
17 - duplicado  
18 - Editar  
19 - correto  
20 - errado  
21 - Deletar(não precisa fazer - problema do noosfero)  
22 -  
23 -Configurações:  
24 - criar  
25 - *correta  
26 - *errado (sem titulo)  
27 - *duplicada  
28 - editar - verificar se mantem as metricas  
29 - correto  
30 - não é possível mudar o titulo  
31 - deletar (não precisa fazer - problema do noosfero)  
32 - metricas:  
33 - criar  
34 - nativa:  
35 - *correta  
36 - *errada  
37 - duplicada (é pra funcionar?)  
38 - composta:  
39 - *correta  
40 - errada  
41 - duplicada  
42 - editar  
43 - para metrica correta  
44 - para metrica errada  
45 - *deletar  
46 - ranges:  
47 - criar  
48 - *range correto  
49 - range errado  
50 - todos os casos  
51 - editar  
52 - para range correto  
53 - para range errado  
54 - deletar  
55 -  
56 -Testes falhando:  
57 -  
58 -Arquivo adding_metric_configuration.feature:  
59 - Scenario: adding a native metric configuration without code  
60 - Precisa do selenium para ver em qual página está.  
61 - Scenario: adding a compound metric configuration  
62 - Scenario: adding a compound metric configuration with invalid script  
63 - As métricas compostas não estão salvando direito.  
64 -  
65 -  
66 -Arquivo creating_project.feature:  
67 - Scenario: I create a Kalibro project with valid attributes  
68 - ás vezes falha por erro de já existir na Kalibro. Esse erro teóricamente já havia sido resolvido.  
69 -  
70 -  
71 -Arquivo adding_ranges.feature:  
72 - Scenario: adding a range to a metric configuration  
73 - Precisa do selenium para esperar a página carregar.  
plugins/mezuro/controllers/myprofile/mezuro_plugin_metric_configuration_controller.rb
@@ -1,109 +0,0 @@ @@ -1,109 +0,0 @@
1 -class MezuroPluginMetricConfigurationController < MezuroPluginMyprofileController  
2 -  
3 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
4 -  
5 - def choose_metric  
6 - @configuration_content = profile.articles.find(params[:id])  
7 - @base_tools = Kalibro::BaseTool.all  
8 - end  
9 -  
10 - def new_native  
11 - @configuration_content = profile.articles.find(params[:id])  
12 - @reading_group_names_and_ids = reading_group_names_and_ids  
13 - @metric = Kalibro::BaseTool.find_by_name(params[:base_tool_name]).metric params[:metric_name]  
14 - @metric_configuration = Kalibro::MetricConfiguration.new :base_tool_name => params[:base_tool_name], :metric => @metric  
15 - end  
16 -  
17 - def edit_native  
18 - params_to_edit_view  
19 - end  
20 -  
21 - def new_compound  
22 - @configuration_content = profile.articles.find(params[:id])  
23 - @metric_configurations = @configuration_content.metric_configurations  
24 - @reading_group_names_and_ids = reading_group_names_and_ids  
25 - metric = Kalibro::Metric.new :compound => true  
26 - @metric_configuration = Kalibro::MetricConfiguration.new :metric => metric  
27 - if configuration_content_has_errors?  
28 - redirect_to_error_page @configuration_content.errors[:base]  
29 - end  
30 - end  
31 -  
32 - def edit_compound  
33 - params_to_edit_view  
34 - end  
35 -  
36 - def create  
37 - configuration_content = profile.articles.find(params[:id])  
38 - metric_configuration = Kalibro::MetricConfiguration.create(params[:metric_configuration])  
39 -  
40 - if metric_configuration_has_errors? metric_configuration  
41 - redirect_to_error_page metric_configuration.errors[0].message  
42 - else  
43 - redirect_to(metric_configuration_url(configuration_content, metric_configuration.id))  
44 - end  
45 - end  
46 -  
47 - def update  
48 - @configuration_content = profile.articles.find(params[:id])  
49 - metric_configurations = @configuration_content.metric_configurations  
50 - metric_configuration = find_metric_configuration(metric_configurations, params[:metric_configuration][:id].to_i)  
51 - metric_configuration.update_attributes params[:metric_configuration]  
52 - if metric_configuration_has_errors? metric_configuration  
53 - redirect_to_error_page metric_configuration.errors[0].message  
54 - else  
55 - redirect_to @configuration_content.view_url  
56 - end  
57 - end  
58 -  
59 - def remove  
60 - configuration_content = profile.articles.find(params[:id])  
61 - configuration_id = configuration_content.configuration_id  
62 - metric_configuration = Kalibro::MetricConfiguration.new({:id => params[:metric_configuration_id].to_i})  
63 - metric_configuration.destroy  
64 - if metric_configuration_has_errors? metric_configuration  
65 - redirect_to_error_page metric_configuration.errors[0].message  
66 - else  
67 - redirect_to configuration_content.view_url  
68 - end  
69 - end  
70 -  
71 - private  
72 -  
73 - def find_metric_configuration (metric_configurations, metric_configuration_id)  
74 - metric_configurations.select {|metric_configuration| metric_configuration.id == metric_configuration_id }.first  
75 - end  
76 -  
77 - def reading_group_names_and_ids  
78 - array = Kalibro::ReadingGroup.all.map { |reading_group| [reading_group.name, reading_group.id] }  
79 - array.sort { |x,y| x.first.downcase <=> y.first.downcase }  
80 - end  
81 -  
82 - def metric_configuration_has_errors? metric_configuration  
83 - not metric_configuration.errors.empty?  
84 - end  
85 -  
86 - def configuration_content_has_errors?  
87 - not @configuration_content.errors[:base].nil?  
88 - end  
89 -  
90 - def metric_configuration_url(configuration_content, metric_configuration_id)  
91 - url = configuration_content.view_url  
92 - url[:controller] = controller_name  
93 - url[:id] = configuration_content.id  
94 - url[:metric_configuration_id] = metric_configuration_id  
95 - url[:action] = (params[:metric_configuration][:metric][:compound] == "true" ? "edit_compound" : "edit_native")  
96 - url  
97 - end  
98 -  
99 - def params_to_edit_view  
100 - @configuration_content = profile.articles.find(params[:id])  
101 - @metric_configurations = @configuration_content.metric_configurations  
102 - @metric_configuration = find_metric_configuration(@metric_configurations, params[:metric_configuration_id].to_i)  
103 - @metric = @metric_configuration.metric  
104 - @reading_group_names_and_ids = reading_group_names_and_ids  
105 - @ranges = Kalibro::Range.ranges_of(@metric_configuration.id)  
106 - end  
107 -  
108 -end  
109 -  
plugins/mezuro/controllers/myprofile/mezuro_plugin_myprofile_controller.rb
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -class MezuroPluginMyprofileController < ProfileController #MyprofileController?  
2 -  
3 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
4 -  
5 -# rescue_from Exception do |exception|  
6 -# @message = process_error_message exception.message  
7 -# render :partial => "error_page"  
8 -# end  
9 -  
10 - def error_page  
11 - @message = params[:message]  
12 - end  
13 -  
14 - protected  
15 -  
16 - def redirect_to_error_page(message)  
17 - message = URI.escape(CGI.escape(process_error_message(message)),'.')  
18 - redirect_to "/myprofile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}"  
19 - end  
20 -  
21 - def process_error_message message #FIXME  
22 - if message =~ /bla/  
23 - message  
24 - else  
25 - message  
26 - end  
27 - end  
28 -  
29 -end  
plugins/mezuro/controllers/myprofile/mezuro_plugin_range_controller.rb
@@ -1,66 +0,0 @@ @@ -1,66 +0,0 @@
1 -class MezuroPluginRangeController < MezuroPluginMyprofileController  
2 -  
3 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
4 -  
5 - def new  
6 - params_to_range_form  
7 - params_to_redirect  
8 - end  
9 -  
10 - def edit  
11 - params_to_range_form  
12 - ranges = Kalibro::Range.ranges_of params[:metric_configuration_id].to_i  
13 - @range = (ranges.select { |range| range.id == params[:range_id].to_i }).first  
14 - end  
15 -  
16 - def create  
17 - params_to_redirect  
18 - save_range  
19 - end  
20 -  
21 - def update  
22 - save_range  
23 - end  
24 -  
25 - def remove  
26 - configuration_content = profile.articles.find(params[:id])  
27 - Kalibro::Range.new({:id => params[:range_id].to_i}).destroy  
28 - redirect_to(metric_configuration_url(configuration_content))  
29 - end  
30 -  
31 - private  
32 -  
33 - def metric_configuration_url configuration_content  
34 - url = configuration_content.view_url  
35 - url[:controller] = "mezuro_plugin_metric_configuration"  
36 - url[:id] = configuration_content.id  
37 - url[:metric_configuration_id] = params[:metric_configuration_id].to_i  
38 - url[:action] = (params[:compound] ? "edit_compound" : "edit_native")  
39 - url  
40 - end  
41 -  
42 - def reading_labels_and_ids  
43 - Kalibro::Reading.readings_of(params[:reading_group_id].to_i).map { |reading| [reading.label, reading.id] }  
44 - end  
45 -  
46 - def save_range  
47 - metric_configuration_id = params[:metric_configuration_id].to_i  
48 - @range = Kalibro::Range.new params[:range]  
49 - @range.save metric_configuration_id  
50 - if !@range.errors.empty?  
51 - @error = @range.errors[0].message  
52 - end  
53 - end  
54 -  
55 - def params_to_range_form  
56 - @content_id = params[:id].to_i  
57 - @metric_configuration_id = params[:metric_configuration_id].to_i  
58 - @reading_labels_and_ids = reading_labels_and_ids  
59 - end  
60 -  
61 - def params_to_redirect  
62 - @reading_group_id = params[:reading_group_id].to_i  
63 - @compound = params[:compound]  
64 - end  
65 -  
66 -end  
plugins/mezuro/controllers/myprofile/mezuro_plugin_reading_controller.rb
@@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
1 -class MezuroPluginReadingController < MezuroPluginMyprofileController  
2 -  
3 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
4 -  
5 - def new  
6 - @reading_group_content = profile.articles.find(params[:id])  
7 -  
8 - readings = Kalibro::Reading.readings_of @reading_group_content.reading_group_id  
9 - @parser="|*|"  
10 - @labels_and_grades = readings.map {|reading| "#{reading.label}#{@parser}#{reading.grade}#{@parser}"}  
11 - end  
12 -  
13 - def save  
14 - reading_group_content = profile.articles.find(params[:id])  
15 - reading = Kalibro::Reading.new params[:reading]  
16 -  
17 - if( reading.save )  
18 - redirect_to reading_group_content.view_url  
19 - else  
20 - redirect_to_error_page reading.errors[0].message  
21 - end  
22 - end  
23 -  
24 - def edit  
25 - @reading_group_content = profile.articles.find(params[:id])  
26 - @reading = Kalibro::Reading.find params[:reading_id]  
27 -  
28 - readings = Kalibro::Reading.readings_of @reading_group_content.reading_group_id  
29 - readings = readings.select {|reading| (reading.id != @reading.id)}  
30 - @parser="|*|"  
31 - @labels_and_grades = readings.map do |reading|  
32 - if(reading.id != @reading.id)  
33 - "#{reading.label}#{@parser}#{reading.grade}#{@parser}"  
34 - end  
35 - end  
36 - end  
37 -  
38 - def destroy  
39 - reading_group_content = profile.articles.find(params[:id])  
40 - reading = Kalibro::Reading.find params[:reading_id]  
41 - reading.destroy  
42 - if( reading.errors.empty? )  
43 - redirect_to reading_group_content.view_url  
44 - else  
45 - redirect_to_error_page reading.errors[0].message  
46 - end  
47 - end  
48 -end  
plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb
@@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
1 -class MezuroPluginModuleResultController < MezuroPluginProfileController  
2 -  
3 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
4 -  
5 - def module_result  
6 - @module_result = Kalibro::ModuleResult.find(params[:module_result_id].to_i)  
7 - @metric_results = Kalibro::MetricResult.metric_results_of(@module_result.id)  
8 - render :partial => 'module_result'  
9 - end  
10 -  
11 - def metric_result_history  
12 - @history = Kalibro::MetricResult.history_of(params[:metric_name], params[:module_result_id].to_i)  
13 - render :partial => 'score_history'  
14 - end  
15 -  
16 - def module_result_history  
17 - @history = Kalibro::ModuleResult.history_of(params[:module_result_id].to_i)  
18 - render :partial => 'score_history'  
19 - end  
20 -  
21 -end  
plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -class MezuroPluginProcessingController < MezuroPluginProfileController  
2 -  
3 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
4 -  
5 - def state  
6 - processing = processing_for_date(params[:repository_id].to_i, params[:date])  
7 - if processing.error.nil?  
8 - render :text => processing.state  
9 - else  
10 - render :text => 'ERROR'  
11 - end  
12 - end  
13 -  
14 - def processing  
15 - @processing = processing_for_date(params[:repository_id].to_i, params[:date])  
16 - if @processing.error.nil?  
17 - render :partial => 'processing'  
18 - else  
19 - render :partial => 'processing_error'  
20 - end  
21 - end  
22 -  
23 - private  
24 -  
25 - def processing_for_date(repository_id, date = nil)  
26 - processing_class = Kalibro::Processing  
27 - if date.nil?  
28 - processing_class.processing_of(repository_id)  
29 - else  
30 - processing_class.processing_with_date_of(repository_id, date)  
31 - end  
32 - end  
33 -  
34 -end  
plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb
@@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
1 -#TODO Ver quais metodos precisam estar aqui e fazer os testes  
2 -class MezuroPluginProfileController < ProfileController  
3 -  
4 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
5 -  
6 -=begin  
7 - rescue_from Exception do |exception|  
8 - @message = process_error_message exception.message  
9 - render :partial => "error_page"  
10 - end  
11 -  
12 - def error_page  
13 - @message = params[:message]  
14 - end  
15 -=end  
16 - protected  
17 -  
18 - def process_error_message message  
19 - if message =~ /undefined method `module' for nil:NilClass/  
20 - "Kalibro did not return any result. Verify if the selected configuration is correct."  
21 - else  
22 - message  
23 - end  
24 - end  
25 -  
26 - def project_content_has_errors?  
27 - not @content.errors[:base].nil?  
28 - end  
29 -  
30 - def redirect_to_error_page(message)  
31 - message = URI.escape(CGI.escape(process_error_message(message)),'.')  
32 - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/error_page?message=#{message}"  
33 - end  
34 -  
35 -end  
36 -  
plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
@@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
1 -class MezuroPluginRepositoryController < MezuroPluginProfileController  
2 -  
3 - append_view_path File.join(File.dirname(__FILE__) + '/../../views')  
4 -  
5 - def new  
6 - params_repository_form  
7 - end  
8 -  
9 - def edit  
10 - params_repository_form  
11 - @repository = @project_content.repositories.select{ |repository| repository.id == params[:repository_id].to_i }.first  
12 - end  
13 -  
14 - def save  
15 - project_content = profile.articles.find(params[:id])  
16 - repository = Kalibro::Repository.new( params[:repository] )  
17 -  
18 - if( repository.save )  
19 - repository.process  
20 - redirect_to(repository_url(project_content, repository.id))  
21 - else  
22 - redirect_to_error_page repository.errors[0].message  
23 - end  
24 - end  
25 -  
26 - def show  
27 - @project_content = profile.articles.find(params[:id])  
28 - @repository = @project_content.repositories.select{ |repository| repository.id == params[:repository_id].to_i }.first  
29 - @configuration_name = Kalibro::Configuration.find(@repository.configuration_id).name  
30 - end  
31 -  
32 - def destroy  
33 - project_content = profile.articles.find(params[:id])  
34 - repository = Kalibro::Repository.new :id => params[:repository_id]  
35 - repository.destroy  
36 - if( repository.errors.empty? )  
37 - redirect_to project_content.view_url  
38 - else  
39 - redirect_to_error_page repository.errors[0].message  
40 - end  
41 - end  
42 -  
43 - private  
44 -  
45 - def repository_url(project_content, repository_id)  
46 - url = project_content.view_url  
47 - url[:controller] = controller_name  
48 - url[:id] = project_content.id  
49 - url[:repository_id] = repository_id  
50 - url[:action] = "show"  
51 - url  
52 - end  
53 -  
54 - def params_repository_form  
55 - @project_content = profile.articles.find(params[:id])  
56 - @repository_types = Kalibro::Repository.repository_types  
57 -  
58 - configurations = Kalibro::Configuration.all  
59 - configurations = [] if (configurations.nil?)  
60 - @configuration_select = configurations.map do |configuration|  
61 - [configuration.name,configuration.id]  
62 - end  
63 - end  
64 -  
65 -end  
plugins/mezuro/dependencies.rb
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -require 'rubygems'  
2 -require 'savon'  
3 -require 'googlecharts'  
plugins/mezuro/features/configuration.feature
@@ -1,158 +0,0 @@ @@ -1,158 +0,0 @@
1 -Feature: Configuration  
2 - As a mezuro user  
3 - I want to create, edit and remove a Mezuro configuration  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - Given I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 -  
12 - Scenario: I see Mezuro configurantion's input form  
13 - Given I am on joaosilva's control panel  
14 - When I follow "Mezuro configuration"  
15 - Then I should see "Title"  
16 - And I should see "Description"  
17 - And I should see "Clone Configuration"  
18 -  
19 - @selenium @kalibro_restart  
20 - Scenario: I create a Mezuro configuration with valid attributes without cloning  
21 - Given I am on joaosilva's control panel  
22 - And I follow "Mezuro configuration"  
23 - When I fill the fields with the new following data  
24 - | article_name | Sample Configuration |  
25 - | article_description | Sample Description |  
26 - | article_configuration_to_clone_id | None |  
27 - And I press "Save"  
28 - Then I should see "Sample Configuration"  
29 - And I should see "Sample Description"  
30 - And I should see "Add Metric"  
31 -  
32 - @selenium @kalibro_restart  
33 - Scenario: I create a Mezuro configuration with valid attributes with cloning  
34 - Given I have a Mezuro configuration with the following data  
35 - | name | Sample Configuration|  
36 - | description | Sample Description |  
37 - | user | joaosilva |  
38 - And I have a Mezuro reading group with the following data  
39 - | name | Sample Reading group |  
40 - | description | Sample Description |  
41 - | user | joaosilva |  
42 - And I have a Mezuro metric configuration with previous created configuration and reading group  
43 - And I am on joaosilva's control panel  
44 - And I follow "Mezuro configuration"  
45 - When I fill the fields with the new following data  
46 - | article_name | Another Configuration |  
47 - | article_description | Another Description |  
48 - | article_configuration_to_clone_id | Sample Configuration |  
49 - And I press "Save"  
50 - Then I should see "Another Configuration"  
51 - And I should see "Another Description"  
52 - And I should see "Total Coupling Factor"  
53 - And I should see "Add Metric"  
54 -  
55 - Scenario: I try to create a Mezuro configuration without title  
56 - Given I am on joaosilva's control panel  
57 - And I follow "Mezuro configuration"  
58 - And the field "article_name" is empty  
59 - When I press "Save"  
60 - Then I should see "Title can't be blank"  
61 -  
62 - @kalibro_restart  
63 - Scenario: I try to create a Mezuro configuration with title already in use  
64 - Given I have a Mezuro configuration with the following data  
65 - | name | Sample Configuration |  
66 - | description | Sample Description |  
67 - | user | joaosilva |  
68 - And I am on joaosilva's control panel  
69 - When I create a Mezuro configuration with the following data  
70 - | Title | Sample Configuration |  
71 - | Description | Sample Description |  
72 - | Clone | None |  
73 - Then I should see "Slug The title (article name) is already being used by another article, please use another title."  
74 -  
75 - @selenium @kalibro_restart  
76 - Scenario: I see a Mezuro configuration edit form  
77 - Given I have a Mezuro configuration with the following data  
78 - | name | Sample Configuration |  
79 - | description | Sample Description |  
80 - | user | joaosilva |  
81 - And I am on article "Sample Configuration"  
82 - When I follow "Edit"  
83 - Then I should see "Sample Configuration" in the "article_name"  
84 - And I should see "Sample Description" in the "article_description"  
85 - And I should see "Save" button  
86 -  
87 - @selenium @kalibro_restart  
88 - Scenario: I edit a Mezuro configuration with valid attributes  
89 - Given I have a Mezuro configuration with the following data  
90 - | name | Sample Configuration |  
91 - | description | Sample Description |  
92 - | user | joaosilva |  
93 - And I am on article "Sample Configuration"  
94 - And I follow "Edit"  
95 - When I fill the fields with the new following data  
96 - | article_name | Another Configuration |  
97 - | article_description | Another Description |  
98 - And I press "Save"  
99 - Then I should see "Another Configuration"  
100 - And I should see "Another Description"  
101 - And I should see "Add Metric"  
102 -  
103 - @selenium @kalibro_restart  
104 - Scenario: I try to edit a Mezuro configuration leaving empty its title  
105 - Given I have a Mezuro configuration with the following data  
106 - | name | Sample Configuration |  
107 - | description | Sample Description |  
108 - | user | joaosilva |  
109 - And I am on article "Sample Configuration"  
110 - And I follow "Edit"  
111 - When I erase the "article_name" field  
112 - And I press "Save"  
113 - Then I should see "Title can't be blank"  
114 -  
115 - @selenium @kalibro_restart  
116 - Scenario: I try to edit a Mezuro configuration with title of an existing Mezuro Configuration  
117 - Given I have a Mezuro configuration with the following data  
118 - | name | Sample Configuration |  
119 - | description | Sample Description |  
120 - | user | joaosilva |  
121 - And I have a Mezuro configuration with the following data  
122 - | name | Another Configuration |  
123 - | description | Another Description |  
124 - | user | joaosilva |  
125 - And I am on article "Sample Configuration"  
126 - And I follow "Edit"  
127 - When I fill the fields with the new following data  
128 - | article_name | Another Configuration |  
129 - | article_description | Another Description |  
130 - And I press "Save"  
131 - Then I should see "Slug The title (article name) is already being used by another article, please use another title."  
132 -  
133 - @selenium @kalibro_restart  
134 - Scenario: I delete a Mezuro configuration that belongs to me  
135 - Given I have a Mezuro configuration with the following data  
136 - | name | Sample Configuration |  
137 - | description | Sample Description |  
138 - | user | joaosilva |  
139 - And I am on article "Sample Configuration"  
140 - When I follow "Delete"  
141 - And I confirm the "Are you sure that you want to remove the item "Sample Configuration"?" dialog  
142 - Then I go to /joaosilva/sample-configuration  
143 - And I should see "There is no such page: /joaosilva/sample-configuration"  
144 -  
145 - @selenium @kalibro_restart  
146 - Scenario: I cannot edit or delete a Mezuro configuration that doesn't belong to me  
147 - Given I have a Mezuro configuration with the following data  
148 - | name | Sample Configuration |  
149 - | description | Sample Description |  
150 - | user | joaosilva |  
151 - And the following users  
152 - | login | name |  
153 - | adminuser | Admin |  
154 - And I am logged in as "adminuser"  
155 - When I am on article "Sample Configuration"  
156 - Then I should not see "Delete"  
157 - And I should not see "Edit"  
158 -  
plugins/mezuro/features/project.feature
@@ -1,134 +0,0 @@ @@ -1,134 +0,0 @@
1 -Feature: Project  
2 - As a mezuro user  
3 - I want to create, edit and remove a Mezuro project  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - And I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 - And the following community  
12 - | identifier | name |  
13 - | mycommunity | My Community |  
14 - And "Joao Silva" is admin of "My Community"  
15 -  
16 - Scenario: I see the Mezuro project input form  
17 - Given I am on mycommunity's control panel  
18 - When I follow "Mezuro project"  
19 - Then I should see "Title"  
20 - And I should see "Description"  
21 -  
22 - @kalibro_restart  
23 - Scenario: I create a Mezuro project with valid attributes  
24 - Given I am on mycommunity's control panel  
25 - When I create a Mezuro project with the following data  
26 - | Title | Sample Project |  
27 - | Description | Sample Description |  
28 - Then I should see "Sample Project"  
29 - And I should see "Sample Description"  
30 - And I should see "Add Repository"  
31 -  
32 - Scenario: I try to create a Mezuro project without title  
33 - Given I am on mycommunity's control panel  
34 - And I follow "Mezuro project"  
35 - And the field "article_name" is empty  
36 - When I press "Save"  
37 - Then I should see "Title can't be blank"  
38 -  
39 - @kalibro_restart  
40 - Scenario: I try to create a Mezuro project with title already in use  
41 - Given I have a Mezuro project with the following data  
42 - | name | Sample Project |  
43 - | description | Sample Description |  
44 - | community | mycommunity |  
45 - And I am on mycommunity's control panel  
46 - When I create a Mezuro project with the following data  
47 - | Title | Sample Project |  
48 - | Description | Sample Description |  
49 - Then I should see "Slug The title (article name) is already being used by another article, please use another title."  
50 -  
51 - @selenium @kalibro_restart  
52 - Scenario: I see a Mezuro project edit form  
53 - Given I have a Mezuro project with the following data  
54 - | name | Sample Project |  
55 - | description | Sample Description |  
56 - | community | mycommunity |  
57 - And I am on article "Sample Project"  
58 - When I follow "Edit"  
59 - Then I should see "Sample Project" in the "article_name"  
60 - And I should see "Sample Description" in the "article_description"  
61 - And I should see "Save" button  
62 -  
63 - @selenium @kalibro_restart  
64 - Scenario: I edit a Mezuro project with valid attributes  
65 - Given I have a Mezuro project with the following data  
66 - | name | Sample Project |  
67 - | description | Sample Description |  
68 - | community | mycommunity |  
69 - And I am on article "Sample Project"  
70 - And I follow "Edit"  
71 - When I fill the fields with the new following data  
72 - | article_name | Another Project |  
73 - | article_description | Another Description|  
74 - And I press "Save"  
75 - Then I should see "Another Project"  
76 - And I should see "Another Description"  
77 - And I should see "Add Repository"  
78 -  
79 - @selenium @kalibro_restart  
80 - Scenario: I try to edit a Mezuro project leaving empty its title  
81 - Given I have a Mezuro project with the following data  
82 - | name | Sample Project |  
83 - | description | Sample Description |  
84 - | community | mycommunity |  
85 - And I am on article "Sample Project"  
86 - And I follow "Edit"  
87 - When I erase the "article_name" field  
88 - And I press "Save"  
89 - Then I should see "Title can't be blank"  
90 -  
91 - @selenium @kalibro_restart  
92 - Scenario: I try to edit a Mezuro project with title of an existing Mezuro Project  
93 - Given I have a Mezuro project with the following data  
94 - | name | Sample Project |  
95 - | description | Sample Description |  
96 - | community | mycommunity |  
97 - And I have a Mezuro project with the following data  
98 - | name | Another Project |  
99 - | description | Another Description |  
100 - | community | mycommunity |  
101 - And I am on article "Sample Project"  
102 - And I follow "Edit"  
103 - When I fill the fields with the new following data  
104 - | article_name | Another Project |  
105 - | article_description | Another Description|  
106 - And I press "Save"  
107 - Then I should see "Slug The title (article name) is already being used by another article, please use another title."  
108 -  
109 - @selenium @kalibro_restart  
110 - Scenario: I delete a Mezuro project that belongs to me  
111 - Given I have a Mezuro project with the following data  
112 - | name | Sample Project |  
113 - | description | Sample Description |  
114 - | community | mycommunity |  
115 - And I am on article "Sample Project"  
116 - When I follow "Delete"  
117 - And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog  
118 - Then I go to /mycommunity/sample-project  
119 - And I should see "There is no such page: /mycommunity/sample-project"  
120 -  
121 - @selenium @kalibro_restart  
122 - Scenario: I cannot edit or delete a Mezuro project that doesn't belong to me  
123 - Given I have a Mezuro project with the following data  
124 - | name | Sample Project |  
125 - | description | Sample Description |  
126 - | community | mycommunity |  
127 - And the following users  
128 - | login | name |  
129 - | user | User |  
130 - And I am logged in as "user"  
131 - When I am on article "Sample Project"  
132 - Then I should not see "Delete"  
133 - And I should not see "Edit"  
134 -  
plugins/mezuro/features/reading.feature
@@ -1,243 +0,0 @@ @@ -1,243 +0,0 @@
1 -@kalibro_restart  
2 -Feature: Reading  
3 - As a Mezuro user  
4 - I want to create, edit and remove a reading  
5 -  
6 - Background:  
7 - Given the following users  
8 - | login | name |  
9 - | joaosilva | Joao Silva |  
10 - And I am logged in as "joaosilva"  
11 - And "Mezuro" plugin is enabled  
12 - And I have a Mezuro reading group with the following data  
13 - | name | Sample Reading Group |  
14 - | description | Sample Description |  
15 - | user | joaosilva |  
16 -  
17 - @selenium  
18 - Scenario: I want to see the Mezuro reading input form  
19 - Given I am on article "Sample Reading Group"  
20 - When I follow "Add Reading"  
21 - Then I should see "Sample Reading Group Reading Group" in a link  
22 - And I should see "Label"  
23 - And I should see "Grade"  
24 - And I should see "Color"  
25 - And I should see "Save" button  
26 -  
27 - @selenium  
28 - Scenario: I try to add a reading with no name  
29 - Given I am on article "Sample Reading Group"  
30 - When I follow "Add Reading"  
31 - And I fill the fields with the new following data  
32 - | reading_label | |  
33 - | reading_grade | 10.2 |  
34 - | reading_color | ABCDEF |  
35 - And I press "Save"  
36 - Then I should see "Please fill all fields marked with (*)." inside an alert  
37 -  
38 - @selenium  
39 - Scenario: I try to add a reading with no grade  
40 - Given I am on article "Sample Reading Group"  
41 - When I follow "Add Reading"  
42 - And I fill the fields with the new following data  
43 - | reading_label | Useless |  
44 - | reading_grade | |  
45 - | reading_color | f51313 |  
46 - And I press "Save"  
47 - Then I should see "Please fill all fields marked with (*)." inside an alert  
48 -  
49 - @selenium  
50 - Scenario: I try to add a reading with no color  
51 - Given I am on article "Sample Reading Group"  
52 - When I follow "Add Reading"  
53 - And I fill the fields with the new following data  
54 - | reading_label | Fantastic |  
55 - | reading_grade | 4.0 |  
56 - | reading_color | |  
57 - And I press "Save"  
58 - Then I should see "Please fill all fields marked with (*)." inside an alert  
59 -  
60 - @selenium  
61 - Scenario: I try to add a reading with an invalid color  
62 - Given I am on article "Sample Reading Group"  
63 - When I follow "Add Reading"  
64 - And I fill the fields with the new following data  
65 - | reading_label | Fantastic |  
66 - | reading_grade | 4.0 |  
67 - | reading_color | 1D10T4 |  
68 - And I press "Save"  
69 - Then I should see "This is not a valid color." inside an alert  
70 -  
71 - @selenium  
72 - Scenario: I try to add a reading with a label which already exists  
73 - Given I have a Mezuro reading with the following data  
74 - | label | Simple |  
75 - | grade | 2.0 |  
76 - | color | 34afe2 |  
77 - And I am on article "Sample Reading Group"  
78 - When I follow "Add Reading"  
79 - And I fill the fields with the new following data  
80 - | reading_label | Simple |  
81 - | reading_grade | 4.0 |  
82 - | reading_color | 1f0fa0 |  
83 - And I press "Save"  
84 - Then I should see "This label already exists! Please, choose another one." inside an alert  
85 -  
86 - @selenium  
87 - Scenario: I try to add a reading with a grade which already exists  
88 - Given I have a Mezuro reading with the following data  
89 - | label | Extraordinary |  
90 - | grade | 10.0 |  
91 - | color | b4bad0 |  
92 - And I am on article "Sample Reading Group"  
93 - When I follow "Add Reading"  
94 - And I fill the fields with the new following data  
95 - | reading_label | Super |  
96 - | reading_grade | 10.0 |  
97 - | reading_color | f0f000 |  
98 - And I press "Save"  
99 - Then I should see "This grade already exists! Please, choose another one." inside an alert  
100 -  
101 - @selenium  
102 - Scenario: I want to add a reading with valid attributes  
103 - Given I am on article "Sample Reading Group"  
104 - When I follow "Add Reading"  
105 - And I fill the fields with the new following data  
106 - | reading_label | Normal |  
107 - | reading_grade | 1.0 |  
108 - | reading_color | 19cbd1 |  
109 - And I press "Save"  
110 - Then I should see "Normal"  
111 - And I should see "1.0"  
112 - And I should see the "#19cbd1" color  
113 - And I should see "Remove"  
114 -  
115 - @selenium  
116 - Scenario: I want to see a reading edit form  
117 - Given I have a Mezuro reading with the following data  
118 - | label | Simple |  
119 - | grade | 2.0 |  
120 - | color | 34afe2 |  
121 - And I am on article "Sample Reading Group"  
122 - When I follow the edit link for "Simple" reading  
123 - Then I should see "Simple" in the "reading_label"  
124 - And I should see "2.0" in the "reading_grade"  
125 - And I should see "34afe2" in the "reading_color"  
126 - And I should see "Save" button  
127 -  
128 - @selenium  
129 - Scenario: I try to edit a reading leaving empty its title  
130 - Given I have a Mezuro reading with the following data  
131 - | label | Simple |  
132 - | grade | 2.0 |  
133 - | color | 34afe2 |  
134 - And I am on article "Sample Reading Group"  
135 - When I follow the edit link for "Simple" reading  
136 - And I erase the "reading_label" field  
137 - And I press "Save"  
138 - Then I should see "Please fill all fields marked with (*)." inside an alert  
139 -  
140 - @selenium  
141 - Scenario: I try to edit a reading leaving empty its grade  
142 - Given I have a Mezuro reading with the following data  
143 - | label | Simple |  
144 - | grade | 2.0 |  
145 - | color | 34afe2 |  
146 - And I am on article "Sample Reading Group"  
147 - When I follow the edit link for "Simple" reading  
148 - And I erase the "reading_grade" field  
149 - And I press "Save"  
150 - Then I should see "Please fill all fields marked with (*)." inside an alert  
151 -  
152 - @selenium  
153 - Scenario: I try to edit a reading leaving empty its color  
154 - Given I have a Mezuro reading with the following data  
155 - | label | Simple |  
156 - | grade | 2.0 |  
157 - | color | 34afe2 |  
158 - And I am on article "Sample Reading Group"  
159 - When I follow the edit link for "Simple" reading  
160 - And I erase the "reading_color" field  
161 - And I press "Save"  
162 - Then I should see "Please fill all fields marked with (*)." inside an alert  
163 -  
164 - @selenium  
165 - Scenario: I try to edit a reading with an invalid color  
166 - Given I have a Mezuro reading with the following data  
167 - | label | Worthless |  
168 - | grade | 1.0 |  
169 - | color | e5cad4 |  
170 - And I am on article "Sample Reading Group"  
171 - When I follow the edit link for "Worthless" reading  
172 - And I fill the fields with the new following data  
173 - | reading_label | Worthless |  
174 - | reading_grade | 1.0 |  
175 - | reading_color | bu5aoooooo |  
176 - And I press "Save"  
177 - Then I should see "This is not a valid color." inside an alert  
178 -  
179 - @selenium  
180 - Scenario: I try to edit a reading with a label which already exists  
181 - Given I have a Mezuro reading with the following data  
182 - | label | Simple |  
183 - | grade | 2.0 |  
184 - | color | 34afe2 |  
185 - And I have a Mezuro reading with the following data  
186 - | label | Complex |  
187 - | grade | 5.0 |  
188 - | color | 13deb2 |  
189 - And I am on article "Sample Reading Group"  
190 - When I follow the edit link for "Simple" reading  
191 - And I fill the fields with the new following data  
192 - | reading_label | Complex |  
193 - | reading_grade | 2.0 |  
194 - | reading_color | 34afe2 |  
195 - And I press "Save"  
196 - Then I should see "This label already exists! Please, choose another one." inside an alert  
197 -  
198 - @selenium  
199 - Scenario: I try to edit a reading with a grade which already exists  
200 - Given I have a Mezuro reading with the following data  
201 - | label | Terrible |  
202 - | grade | 0.0 |  
203 - | color | 4feda4 |  
204 - And I have a Mezuro reading with the following data  
205 - | label | Perfect |  
206 - | grade | 10.0 |  
207 - | color | de41b2 |  
208 - And I am on article "Sample Reading Group"  
209 - When I follow the edit link for "Terrible" reading  
210 - And I fill the fields with the new following data  
211 - | reading_label | Terrible |  
212 - | reading_grade | 10.0 |  
213 - | reading_color | 4feda4 |  
214 - And I press "Save"  
215 - Then I should see "This grade already exists! Please, choose another one." inside an alert  
216 -  
217 - @selenium  
218 - Scenario: I want to edit a reading with valid attributes  
219 - Given I have a Mezuro reading with the following data  
220 - | label | Awful |  
221 - | grade | 2.5 |  
222 - | color | babaca |  
223 - And I am on article "Sample Reading Group"  
224 - When I follow the edit link for "Awful" reading  
225 - And I fill the fields with the new following data  
226 - | reading_label | Awesome |  
227 - | reading_grade | 10.0 |  
228 - | reading_color | fa40fa |  
229 - And I press "Save"  
230 - Then I should see "Awesome"  
231 - And I should see "10.0"  
232 - And I should see the "#fa40fa" color  
233 -  
234 - @selenium  
235 - Scenario: I want to remove a reading  
236 - Given I have a Mezuro reading with the following data  
237 - | label | Unbelievable |  
238 - | grade | 9001.0 |  
239 - | color | f0f0ca |  
240 - And I am on article "Sample Reading Group"  
241 - When I follow the remove link for "Unbelievable" reading  
242 - Then I should not see "Unbelievable"  
243 - And I should not see "9001.0"  
plugins/mezuro/features/reading_group.feature
@@ -1,131 +0,0 @@ @@ -1,131 +0,0 @@
1 -Feature: Reading Group  
2 - As a mezuro user  
3 - I want to create, edit and remove a Mezuro reading group  
4 -  
5 - Background:  
6 - Given the following users  
7 - | login | name |  
8 - | joaosilva | Joao Silva |  
9 - Given I am logged in as "joaosilva"  
10 - And "Mezuro" plugin is enabled  
11 -  
12 - Scenario: I see Mezuro reading group's input form  
13 - Given I am on joaosilva's control panel  
14 - When I follow "Mezuro reading group"  
15 - Then I should see "Title"  
16 - And I should see "Description"  
17 -  
18 - @kalibro_restart  
19 - Scenario: I create a Mezuro reading group with valid attributes  
20 - Given I am on joaosilva's control panel  
21 - When I create a Mezuro reading group with the following data  
22 - | Title | Sample Reading Group |  
23 - | Description | Sample Description |  
24 - Then I should see "Sample Reading Group"  
25 - And I should see "Sample Description"  
26 - And I should see "Readings"  
27 - And I should see "Add Reading"  
28 -  
29 - Scenario: I try to create a Mezuro reading group without title  
30 - Given I am on joaosilva's control panel  
31 - And I follow "Mezuro reading group"  
32 - And the field "article_name" is empty  
33 - When I press "Save"  
34 - Then I should see "Title can't be blank"  
35 -  
36 - @kalibro_restart  
37 - Scenario: I try to create a Mezuro reading group with title already in use  
38 - Given I have a Mezuro reading group with the following data  
39 - | name | Sample Reading group |  
40 - | description | Sample Description |  
41 - | user | joaosilva |  
42 - And I am on joaosilva's control panel  
43 - When I create a Mezuro reading group with the following data  
44 - | Title | Sample Reading Group |  
45 - | Description | Sample Description |  
46 - Then I should see "Slug The title (article name) is already being used by another article, please use another title."  
47 -  
48 - @selenium @kalibro_restart  
49 - Scenario: I see a Mezuro reading group edit form  
50 - Given I have a Mezuro reading group with the following data  
51 - | name | Sample Reading group |  
52 - | description | Sample Description |  
53 - | user | joaosilva |  
54 - And I am on article "Sample Reading group"  
55 - When I follow "Edit"  
56 - Then I should see "Sample Reading group" in the "article_name"  
57 - And I should see "Sample Description" in the "article_description"  
58 - And I should see "Save" button  
59 -  
60 - @selenium @kalibro_restart  
61 - Scenario: I edit a Mezuro reading group with valid attributes  
62 - Given I have a Mezuro reading group with the following data  
63 - | name | Sample Reading group |  
64 - | description | Sample Description |  
65 - | user | joaosilva |  
66 - And I am on article "Sample Reading group"  
67 - And I follow "Edit"  
68 - When I fill the fields with the new following data  
69 - | article_name | Another Reading group |  
70 - | article_description | Another Description |  
71 - And I press "Save"  
72 - Then I should see "Another Reading group"  
73 - And I should see "Another Description"  
74 - And I should see "Add Reading"  
75 -  
76 - @selenium @kalibro_restart  
77 - Scenario: I try to edit a Mezuro reading group leaving empty its title  
78 - Given I have a Mezuro reading group with the following data  
79 - | name | Sample Reading group |  
80 - | description | Sample Description |  
81 - | user | joaosilva |  
82 - And I am on article "Sample Reading group"  
83 - And I follow "Edit"  
84 - When I erase the "article_name" field  
85 - And I press "Save"  
86 - Then I should see "Title can't be blank"  
87 -  
88 - @selenium @kalibro_restart  
89 - Scenario: I try to edit a Mezuro reading group with title of an existing Mezuro Reading group  
90 - Given I have a Mezuro reading group with the following data  
91 - | name | Sample Reading group |  
92 - | description | Sample Description |  
93 - | user | joaosilva |  
94 - And I have a Mezuro reading group with the following data  
95 - | name | Another Reading group |  
96 - | description | Another Description |  
97 - | user | joaosilva |  
98 - And I am on article "Sample Reading group"  
99 - And I follow "Edit"  
100 - When I fill the fields with the new following data  
101 - | article_name | Another Reading group |  
102 - | article_description | Another Description |  
103 - And I press "Save"  
104 - Then I should see "Slug The title (article name) is already being used by another article, please use another title."  
105 -  
106 - @selenium @kalibro_restart  
107 - Scenario: I delete a Mezuro reading group that belongs to me  
108 - Given I have a Mezuro reading group with the following data  
109 - | name | Sample Reading group |  
110 - | description | Sample Description |  
111 - | user | joaosilva |  
112 - And I am on article "Sample Reading group"  
113 - When I follow "Delete"  
114 - And I confirm the "Are you sure that you want to remove the item "Sample Reading group"?" dialog  
115 - Then I go to /joaosilva/sample-reading-group  
116 - And I should see "There is no such page: /joaosilva/sample-reading-group"  
117 -  
118 - @selenium @kalibro_restart  
119 - Scenario: I cannot edit or delete a Mezuro reading group that doesn't belong to me  
120 - Given I have a Mezuro reading group with the following data  
121 - | name | Sample Reading group |  
122 - | description | Sample Description |  
123 - | user | joaosilva |  
124 - And the following users  
125 - | login | name |  
126 - | adminuser | Admin |  
127 - And I am logged in as "adminuser"  
128 - When I am on article "Sample Reading group"  
129 - Then I should not see "Delete"  
130 - And I should not see "Edit"  
131 -  
plugins/mezuro/features/repository.feature
@@ -1,276 +0,0 @@ @@ -1,276 +0,0 @@
1 -@kalibro_restart  
2 -Feature: Repository  
3 - As a Mezuro user  
4 - I want to create, edit, remove and process a repository  
5 -  
6 - Background:  
7 - Given the following users  
8 - | login | name |  
9 - | joaosilva | Joao Silva |  
10 - And I am logged in as "joaosilva"  
11 - And "Mezuro" plugin is enabled  
12 - And the following community  
13 - | identifier | name |  
14 - | mycommunity | My Community |  
15 - And "Joao Silva" is admin of "My Community"  
16 - And I have a Mezuro project with the following data  
17 - | name | Sample Project |  
18 - | description | Sample Description |  
19 - | community | mycommunity |  
20 - And I have a Mezuro configuration with the following data  
21 - | name | Sample Configuration|  
22 - | description | Sample Description |  
23 - | user | joaosilva |  
24 - And I have a Mezuro reading group with the following data  
25 - | name | Sample Reading group |  
26 - | description | Sample Description |  
27 - | user | joaosilva |  
28 - And I have a Mezuro metric configuration with previous created configuration and reading group  
29 -  
30 - Scenario: I want to see the Mezuro repository input form  
31 - Given I am on article "Sample Project"  
32 - When I follow "Add Repository"  
33 - Then I should see "Name"  
34 - And I should see "Description"  
35 - And I should see "License"  
36 - And I should see "Process Period"  
37 - And I should see "Type"  
38 - And I should see "Address"  
39 - And I should see "Configuration"  
40 - And I should see "Add" button  
41 -  
42 - @selenium  
43 - Scenario: I try to add a repository with no name  
44 - Given I am on article "Sample Project"  
45 - And I follow "Add Repository"  
46 - When I fill the fields with the new following data  
47 - | repository_name | |  
48 - | repository_description | My Description |  
49 - | repository_license | ISC License (ISC) |  
50 - | repository_process_period | Not Periodically |  
51 - | repository_type | SUBVERSION |  
52 - | repository_address | https://project.svn.sourceforge.net/svnroot/project |  
53 - | repository_configuration_id | Sample Configuration |  
54 - And I press "Add"  
55 - Then I should see "Please fill all fields marked with (*)." inside an alert  
56 -  
57 - @selenium  
58 - Scenario: I try to add a repository with no address  
59 - Given I am on article "Sample Project"  
60 - And I follow "Add Repository"  
61 - When I fill the fields with the new following data  
62 - | repository_name | My Name |  
63 - | repository_description | My Description |  
64 - | repository_license | ISC License (ISC) |  
65 - | repository_process_period | Not Periodically |  
66 - | repository_type | SUBVERSION |  
67 - | repository_address | |  
68 - | repository_configuration_id | Sample Configuration |  
69 - And I press "Add"  
70 - Then I should see "Please fill all fields marked with (*)." inside an alert  
71 -  
72 - @selenium  
73 - Scenario: I try to add a repository with an invalid address  
74 - Given I am on article "Sample Project"  
75 - And I follow "Add Repository"  
76 - When I fill the fields with the new following data  
77 - | repository_name | My Name |  
78 - | repository_description | My Description |  
79 - | repository_license | ISC License (ISC) |  
80 - | repository_process_period | Not Periodically |  
81 - | repository_type | GIT |  
82 - | repository_address | https://invalid-address.any-extension |  
83 - | repository_configuration_id | Sample Configuration |  
84 - And I press "Add"  
85 - Then I should see "Address does not match type GIT chosen." inside an alert  
86 -  
87 - @selenium  
88 - Scenario: I want to add a repository with valid attributes  
89 - Given I am on article "Sample Project"  
90 - And I follow "Add Repository"  
91 - When I fill the fields with the new following data  
92 - | repository_name | My Name |  
93 - | repository_description | My Description |  
94 - | repository_license | ISC License (ISC) |  
95 - | repository_process_period | Not Periodically |  
96 - | repository_type | GIT |  
97 - | repository_address | https://github.com/user/project.git |  
98 - | repository_configuration_id | Sample Configuration |  
99 - And I press "Add"  
100 - Then I should see "My Name"  
101 - And I should see "My Description"  
102 - And I should see "ISC License (ISC)"  
103 - And I should see "Not Periodically"  
104 - And I should see "GIT"  
105 - And I should see "https://github.com/user/project.git"  
106 - And I should see "Sample Configuration"  
107 - And I should see "Status"  
108 -  
109 - @selenium  
110 - Scenario: I want to see the repository edit form  
111 - Given I have a Mezuro repository with the following data  
112 - | name | My Name |  
113 - | description | My Description |  
114 - | license | ISC License (ISC) |  
115 - | process_period | Not Periodically |  
116 - | type | GIT |  
117 - | address | https://github.com/user/project.git |  
118 - | configuration_id | Sample Configuration |  
119 - And I am on article "Sample Project"  
120 - When I follow the edit link for "My Name" repository  
121 - Then I should see "My Name" in the "repository_name"  
122 - And I should see "My Description" in the "repository_description"  
123 - And I should see "ISC License (ISC)" in the "repository_license"  
124 - And I should see "Not Periodically" in the process period select field  
125 - And I should see "GIT" in the "repository_type"  
126 - And I should see "https://github.com/user/project.git" in the "repository_address"  
127 - And I should see "Sample Configuration" in the repository configuration select field  
128 -  
129 - @selenium  
130 - Scenario: I edit a Mezuro repository with valid attributes  
131 - Given I have a Mezuro repository with the following data  
132 - | name | My Name |  
133 - | description | My Description |  
134 - | license | ISC License (ISC) |  
135 - | process_period | Not Periodically |  
136 - | type | GIT |  
137 - | address | https://github.com/user/project.git |  
138 - | configuration_id | Sample Configuration |  
139 - And I am on article "Sample Project"  
140 - When I follow the edit link for "My Name" repository  
141 - And I fill the fields with the new following data  
142 - | repository_name | Another Name |  
143 - | repository_description | Another Description |  
144 - | repository_license | Apple Public Source License (APSL-2.0) |  
145 - | repository_process_period | Weekly |  
146 - | repository_type | SUBVERSION |  
147 - | repository_address | https://project.svn.sourceforge.net/svnroot/project |  
148 - | repository_configuration_id | Sample Configuration |  
149 - And I press "Add"  
150 - Then I should see "Another Name"  
151 - And I should see "Another Description"  
152 - And I should see "Apple Public Source License (APSL-2.0)"  
153 - And I should see "Weekly"  
154 - And I should see "SUBVERSION"  
155 - And I should see "https://project.svn.sourceforge.net/svnroot/project"  
156 - And I should see "Sample Configuration"  
157 -  
158 - @selenium  
159 - Scenario: I try to edit a Mezuro repository leaving empty its title  
160 - Given I have a Mezuro repository with the following data  
161 - | name | My Name |  
162 - | description | My Description |  
163 - | license | ISC License (ISC) |  
164 - | process_period | Not Periodically |  
165 - | type | GIT |  
166 - | address | https://github.com/user/project.git |  
167 - | configuration_id | Sample Configuration |  
168 - And I am on article "Sample Project"  
169 - And I follow the edit link for "My Name" repository  
170 - When I erase the "repository_name" field  
171 - And I press "Add"  
172 - Then I should see "Please fill all fields marked with (*)." inside an alert  
173 -  
174 - @selenium  
175 - Scenario: I try to edit a Mezuro repository leaving empty its address  
176 - Given I have a Mezuro repository with the following data  
177 - | name | My Name |  
178 - | description | My Description |  
179 - | license | ISC License (ISC) |  
180 - | process_period | Not Periodically |  
181 - | type | GIT |  
182 - | address | https://github.com/user/project.git |  
183 - | configuration_id | Sample Configuration |  
184 - And I am on article "Sample Project"  
185 - And I follow the edit link for "My Name" repository  
186 - When I erase the "repository_address" field  
187 - And I press "Add"  
188 - Then I should see "Please fill all fields marked with (*)." inside an alert  
189 -  
190 - @selenium  
191 - Scenario: I try to edit a Mezuro repository with an invalid address  
192 - Given I have a Mezuro repository with the following data  
193 - | name | My Name |  
194 - | description | My Description |  
195 - | license | ISC License (ISC) |  
196 - | process_period | Not Periodically |  
197 - | type | GIT |  
198 - | address | https://github.com/user/project.git |  
199 - | configuration_id | Sample Configuration |  
200 - And I am on article "Sample Project"  
201 - When I follow the edit link for "My Name" repository  
202 - And I fill the fields with the new following data  
203 - | repository_name | Another Name |  
204 - | repository_description | Another Description |  
205 - | repository_license | Apple Public Source License (APSL-2.0) |  
206 - | repository_process_period | Weekly |  
207 - | repository_type | SUBVERSION |  
208 - | repository_address | https://invalid-address.any-extension |  
209 - | repository_configuration_id | Sample Configuration |  
210 - And I press "Add"  
211 - Then I should see "Address does not match type SUBVERSION chosen." inside an alert  
212 -  
213 - @selenium  
214 - Scenario: I try to edit a repository with an existing repository name  
215 - Given I have a Mezuro repository with the following data  
216 - | name | My Name |  
217 - | description | My Description |  
218 - | license | ISC License (ISC) |  
219 - | process_period | Not Periodically |  
220 - | type | GIT |  
221 - | address | https://github.com/user/project.git |  
222 - | configuration_id | Sample Configuration |  
223 - And I have a Mezuro repository with the following data  
224 - | name | Another Name |  
225 - | description | Another Description |  
226 - | license | Apple Public Source License (APSL-2.0) |  
227 - | process_period | Weekly |  
228 - | type | SUBVERSION |  
229 - | address | https://project.svn.sourceforge.net/svnroot/project |  
230 - | configuration_id | Sample Configuration |  
231 - And I am on article "Sample Project"  
232 - When I follow the edit link for "My Name" repository  
233 - And I fill the fields with the new following data  
234 - | repository_name | Another Name |  
235 - | repository_description | Another Description |  
236 - | repository_license | Apple Public Source License (APSL-2.0) |  
237 - | repository_process_period | Weekly |  
238 - | repository_type | SUBVERSION |  
239 - | repository_address | https://project.svn.sourceforge.net/svnroot/project |  
240 - | repository_configuration_id | Sample Configuration |  
241 - And I press "Add"  
242 - #Then I should see "Slug The title (article name) is already being used by another article, please use another title."  
243 - #FIXME fix this validation  
244 -  
245 - @selenium  
246 - Scenario: I delete a Mezuro repository of mine  
247 - Given I have a Mezuro repository with the following data  
248 - | name | My Name |  
249 - | description | My Description |  
250 - | license | ISC License (ISC) |  
251 - | process_period | Not Periodically |  
252 - | type | GIT |  
253 - | address | https://github.com/user/project.git |  
254 - | configuration_id | Sample Configuration |  
255 - And I am on article "Sample Project"  
256 - When I follow the remove link for "My Name" repository  
257 - Then I should not see "My Name"  
258 -  
259 - @selenium  
260 - Scenario: I try to edit or delete a Mezuro repository which doesn't belong to me  
261 - Given I have a Mezuro repository with the following data  
262 - | name | My Name |  
263 - | description | My Description |  
264 - | license | ISC License (ISC) |  
265 - | process_period | Not Periodically |  
266 - | type | GIT |  
267 - | address | https://github.com/user/project.git |  
268 - | configuration_id | Sample Configuration |  
269 - And the following users  
270 - | login | name |  
271 - | zacarias | Zacarias |  
272 - And I am logged in as "zacarias"  
273 - When I am on article "Sample Project"  
274 - Then I should not see the edit link for "My Name" repository  
275 - And I should not see the remove link for "My Name" repository  
276 -  
plugins/mezuro/features/step_definitions/mezuro_steps.rb
@@ -1,164 +0,0 @@ @@ -1,164 +0,0 @@
1 -When /^I create a Mezuro (project|reading group) with the following data$/ do |type, fields|  
2 - click_link ("Mezuro " + type)  
3 -  
4 - fields.rows_hash.each do |name, value|  
5 - When %{I fill in "#{name}" with "#{value}"}  
6 - end  
7 -  
8 - click_button "Save"  
9 - Article.find_by_name(fields.rows_hash[:Title])  
10 -end  
11 -  
12 -When /^I create a Mezuro configuration with the following data$/ do |fields|  
13 - click_link ("Mezuro configuration")  
14 -  
15 - fields.rows_hash.each do |name, value|  
16 - if name != "Clone"  
17 - When %{I fill in "#{name}" with "#{value}"}  
18 - end  
19 - end  
20 -  
21 - click_button "Save"  
22 - Article.find_by_name(fields.rows_hash[:Title])  
23 -end  
24 -  
25 -Then /^I directly delete content with name "([^\"]*)" for testing purposes$/ do |content_name|  
26 - Article.find_by_name(content_name).destroy  
27 -end  
28 -  
29 -Then /^I should be at the url "([^\"]*)"$/ do |url|  
30 - if response.class.to_s == 'Webrat::SeleniumResponse'  
31 - URI.parse(response.selenium.get_location).path.should == url  
32 - else  
33 - URI.parse(current_url).path.should == url  
34 - end  
35 -end  
36 -  
37 -Then /^the field "([^"]*)" is empty$/ do |field_name|  
38 - find_field(field_name).value.should be_nil  
39 -end  
40 -  
41 -Then /^I should see "([^\"]*)" inside an alert$/ do |message|  
42 - alert = page.driver.browser.switch_to.alert  
43 - assert_equal message, alert.text  
44 - alert.accept  
45 -end  
46 -  
47 -Then /^I should see "([^"]*)" in the "([^"]*)"$/ do |content, labeltext|  
48 - find_field(labeltext).value.should == content  
49 -end  
50 -  
51 -Then /^I should see "([^"]*)" button$/ do |button_name|  
52 - find_button(button_name).should_not be_nil  
53 -end  
54 -  
55 -Then /^I should see "([^"]*)" in a link$/ do |link_name|  
56 - find_link(link_name).should_not be_nil  
57 -end  
58 -  
59 -Then /^I should see "([^"]*)" in the process period select field$/ do |content|  
60 - selected = MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options.select { |option| option.first == content }.first  
61 - assert_equal selected.last, find_field("repository_process_period").value.to_i  
62 -end  
63 -  
64 -Then /^I should see "([^"]*)" in the repository configuration select field$/ do |content|  
65 - selected = Kalibro::Configuration.all.select { |option| option.name == content }.first  
66 - assert_equal selected.id, find_field("repository_configuration_id").value.to_i  
67 -end  
68 -  
69 -Then /^I should not see "([^"]*)" button$/ do |button_name|  
70 - find_button(button_name).should be_nil  
71 -end  
72 -  
73 -When /^I have a Mezuro (project|reading group|configuration) with the following data$/ do |type, fields|  
74 - item = {}  
75 - fields.rows_hash.each do |name, value|  
76 - if(name=="user" or name=="community")  
77 - item.merge!(:profile=>Profile[value])  
78 - else  
79 - item.merge!(name => value)  
80 - end  
81 - end  
82 - if (type == "project")  
83 - result = MezuroPlugin::ProjectContent.new(item)  
84 - elsif (type == "reading group")  
85 - result = MezuroPlugin::ReadingGroupContent.new(item)  
86 - elsif (type == "configuration")  
87 - result = MezuroPlugin::ConfigurationContent.new(item)  
88 - end  
89 -  
90 - result.save!  
91 -end  
92 -  
93 -When /^I have a Mezuro (reading|repository) with the following data$/ do |type, fields|  
94 - item = {}  
95 - fields.rows_hash.each do |name, value|  
96 - if(name=="user" or name=="community")  
97 - item.merge!(:profile=>Profile[value])  
98 - else  
99 - item.merge!(name => value)  
100 - end  
101 - end  
102 - if (type == "repository")  
103 - item["configuration_id"] = Kalibro::Configuration.all.select {|configuration| configuration.name == item["configuration_id"] }.first.id  
104 - item.merge!(:project_id => Kalibro::Project.all.last.id)  
105 - Kalibro::Repository.create(item)  
106 - elsif (type == "reading")  
107 - item.merge!(:group_id => Kalibro::ReadingGroup.all.last.id)  
108 - Kalibro::Reading.create(item)  
109 - end  
110 -end  
111 -  
112 -When /^I erase the "([^"]*)" field$/ do |field_name|  
113 - find_field(field_name).set ""  
114 -end  
115 -  
116 -When /^I fill the fields with the new following data$/ do |fields|  
117 - fields.rows_hash.each do |key, value|  
118 - name = key.to_s  
119 - element = find_field(name)  
120 - if (element.tag_name.to_s == "select")  
121 - select(value, :from => name)  
122 - else  
123 - element.set value  
124 - end  
125 - end  
126 -end  
127 -  
128 -When /^I have a Mezuro metric configuration with previous created configuration and reading group$/ do  
129 - Kalibro::MetricConfiguration.create({  
130 - :code => 'amloc1',  
131 - :metric => {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']},  
132 - :base_tool_name => "Analizo",  
133 - :weight => "1.0",  
134 - :aggregation_form => 'AVERAGE',  
135 - :reading_group_id => Kalibro::ReadingGroup.all.last.id,  
136 - :configuration_id => Kalibro::Configuration.all.last.id  
137 - })  
138 -end  
139 -  
140 -When /^I follow the (edit|remove) link for "([^"]*)" (repository|reading)$/ do |action, name, type|  
141 - if (type == "repository")  
142 - project_id = Kalibro::Project.all.last.id  
143 - repositories = Kalibro::Repository.repositories_of project_id  
144 - id = repositories.select {|option| option.name == name}.first.id  
145 - elsif (type == "reading")  
146 - reading_group_id = Kalibro::ReadingGroup.all.last.id  
147 - readings = Kalibro::Reading.readings_of reading_group_id  
148 - id = readings.select {|option| option.label == name}.first.id  
149 - if (action == "edit")  
150 - action = name  
151 - end  
152 - end  
153 -  
154 - elements = all('a', :text => action.capitalize)  
155 - link = type + "_id"  
156 - action_link = elements.select {|element| (/#{link}=#{id}/ =~ element[:href]) }.first  
157 - action_link.click  
158 -end  
159 -  
160 -Then /^I should see the "([^"]*)" color$/ do |color_name|  
161 - elements = all('td', :text => "")  
162 - found = elements.select { |element| color_name == element[:bgcolor]}.first  
163 - assert_not_nil found  
164 -end  
plugins/mezuro/features/support/hooks.rb
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -Before do  
2 - if !$dunit  
3 - command = "#{RAILS_ROOT}/plugins/mezuro/script/tests/prepare_kalibro_query_file.sh"  
4 - system command  
5 - $dunit = true  
6 - end  
7 -end  
8 -  
9 -After ('@kalibro_restart') do  
10 - command = "#{RAILS_ROOT}/plugins/mezuro/script/tests/delete_all_kalibro_entries.sh"  
11 - system command  
12 -end  
plugins/mezuro/install.rb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -raise "Not ready yet"  
plugins/mezuro/lib/kalibro/base_tool.rb
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -class Kalibro::BaseTool < Kalibro::Model  
2 -  
3 - attr_accessor :name, :description, :collector_class_name, :supported_metric  
4 -  
5 - def self.find_by_name(base_tool_name)  
6 - new request(:get_base_tool, {:base_tool_name => base_tool_name})[:base_tool]  
7 - end  
8 -  
9 - def self.all  
10 - basetools = all_names  
11 - basetools.map{ |name| find_by_name(name) }  
12 - end  
13 -  
14 - def self.all_names  
15 - request(:all_base_tool_names)[:base_tool_name].to_a  
16 - end  
17 -  
18 - def supported_metric=(value)  
19 - @supported_metric = Kalibro::Metric.to_objects_array value  
20 - end  
21 -  
22 - def supported_metrics  
23 - @supported_metric  
24 - end  
25 -  
26 - def supported_metrics=(supported_metrics)  
27 - @supported_metric = supported_metrics  
28 - end  
29 -  
30 - def metric(name)  
31 - supported_metrics.find {|metric| metric.name == name}  
32 - end  
33 -  
34 -end  
plugins/mezuro/lib/kalibro/configuration.rb
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -class Kalibro::Configuration < Kalibro::Model  
2 -  
3 - attr_accessor :id, :name, :description  
4 -  
5 - def id=(value)  
6 - @id = value.to_i  
7 - end  
8 -  
9 - def self.all  
10 - response = request(:all_configurations)[:configuration]  
11 - response = [] if response.nil?  
12 - response = [response] if response.is_a?(Hash)  
13 - response.map {|configuration| new configuration}  
14 - end  
15 -  
16 -end  
plugins/mezuro/lib/kalibro/date_metric_result.rb
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -class Kalibro::DateMetricResult < Kalibro::Model  
2 -  
3 - attr_accessor :date, :metric_result  
4 -  
5 - def date=(value)  
6 - @date = value.is_a?(String) ? DateTime.parse(value) : value  
7 - end  
8 -  
9 - def metric_result=(value)  
10 - @metric_result = Kalibro::MetricResult.to_object value  
11 - end  
12 -  
13 - def result  
14 - @metric_result.value  
15 - end  
16 -end  
plugins/mezuro/lib/kalibro/date_module_result.rb
@@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
1 -class Kalibro::DateModuleResult < Kalibro::Model  
2 -  
3 - attr_accessor :date, :module_result  
4 -  
5 - def date=(value)  
6 - @date = value.is_a?(String) ? DateTime.parse(value) : value  
7 - end  
8 -  
9 - def module_result=(value)  
10 - @module_result = Kalibro::ModuleResult.to_object value  
11 - end  
12 -  
13 - def result  
14 - @module_result.grade  
15 - end  
16 -  
17 -end  
plugins/mezuro/lib/kalibro/errors/record_not_found.rb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -class Kalibro::Errors::RecordNotFound < Kalibro::Errors::Standard  
2 -end  
3 \ No newline at end of file 0 \ No newline at end of file
plugins/mezuro/lib/kalibro/errors/standard.rb
@@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
1 -#Inspired on:  
2 -#https://github.com/rails/rails/blob/master/activerecord/lib/active_record/errors.rb  
3 -class Kalibro::Errors::Standard < StandardError  
4 -end  
5 \ No newline at end of file 0 \ No newline at end of file
plugins/mezuro/lib/kalibro/metric.rb
@@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
1 -class Kalibro::Metric < Kalibro::Model  
2 -  
3 - attr_accessor :name, :compound, :scope, :description, :script, :language  
4 -  
5 - def languages  
6 - @language  
7 - end  
8 -  
9 - def languages=(languages)  
10 - @language = languages  
11 - end  
12 -  
13 - def language=(value)  
14 - @language = Kalibro::Model.to_objects_array value  
15 - end  
16 -  
17 -end  
plugins/mezuro/lib/kalibro/metric_configuration.rb
@@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
1 -class Kalibro::MetricConfiguration < Kalibro::Model  
2 -  
3 - attr_accessor :id, :code, :metric, :base_tool_name, :weight, :aggregation_form, :reading_group_id, :configuration_id  
4 -  
5 - def id=(value)  
6 - @id = value.to_i  
7 - end  
8 -  
9 - def reading_group_id=(value)  
10 - @reading_group_id = value.to_i  
11 - end  
12 -  
13 - def metric=(value)  
14 - @metric = Kalibro::Metric.to_object(value)  
15 - end  
16 -  
17 - def weight=(value)  
18 - @weight = value.to_f  
19 - end  
20 -  
21 - def update_attributes(attributes={})  
22 - attributes.each { |field, value| send("#{field}=", value) if self.class.is_valid?(field) }  
23 - save  
24 - end  
25 -  
26 - def to_hash  
27 - super :except => [:configuration_id]  
28 - end  
29 -  
30 - def self.metric_configurations_of(configuration_id)  
31 - response = request(:metric_configurations_of, {:configuration_id => configuration_id})[:metric_configuration]  
32 - response = [] if response.nil?  
33 - response = [response] if response.is_a?(Hash)  
34 - response.map { |metric_configuration| new metric_configuration }  
35 - end  
36 -  
37 - private  
38 -  
39 - def save_params  
40 - {:metric_configuration => self.to_hash, :configuration_id => self.configuration_id}  
41 - end  
42 -  
43 -end  
plugins/mezuro/lib/kalibro/metric_configuration_snapshot.rb
@@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
1 -class Kalibro::MetricConfigurationSnapshot < Kalibro::Model  
2 -  
3 - attr_accessor :code, :weight, :aggregation_form, :metric, :base_tool_name, :range  
4 -  
5 - def weight=(value)  
6 - @weight = value.to_f  
7 - end  
8 -  
9 - def metric=(value)  
10 - if value.kind_of?(Hash)  
11 - @metric = Kalibro::Metric.to_object(value)  
12 - else  
13 - @metric = value  
14 - end  
15 - end  
16 -  
17 - def range=(value)  
18 - value.to_a  
19 - @range = []  
20 -  
21 - value.each do |range_snapshot|  
22 - @range << Kalibro::RangeSnapshot.to_object(range_snapshot)  
23 - end  
24 -  
25 - end  
26 -  
27 - def range_snapshot  
28 - range  
29 - end  
30 -  
31 - def to_hash  
32 - hash = super  
33 - hash[:attributes!][:range] = {'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
34 - 'xsi:type' => 'kalibro:rangeSnapshotXml' }  
35 - hash  
36 - end  
37 -  
38 -end  
plugins/mezuro/lib/kalibro/metric_result.rb
@@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
1 -class Kalibro::MetricResult < Kalibro::Model  
2 -  
3 - attr_accessor :id, :configuration, :value, :error  
4 -  
5 - def initialize(attributes={})  
6 - value = attributes[:value]  
7 - @value = (value == "NaN") ? attributes[:aggregated_value].to_f : value.to_f  
8 - attributes.each do |field, value|  
9 - if field!= :value and field!= :aggregated_value and self.class.is_valid?(field)  
10 - send("#{field}=", value)  
11 - end  
12 - end  
13 - @errors = []  
14 - end  
15 -  
16 - def id=(value)  
17 - @id = value.to_i  
18 - end  
19 -  
20 - def configuration=(value)  
21 - @configuration = Kalibro::MetricConfigurationSnapshot.to_object value  
22 - end  
23 -  
24 - def metric_configuration_snapshot  
25 - configuration  
26 - end  
27 -  
28 - def error=(value)  
29 - @error = Kalibro::Throwable.to_object value  
30 - end  
31 -  
32 - def descendant_results  
33 - self.class.request(:descendant_results_of, {:metric_result_id => self.id})[:descendant_result].to_a  
34 - end  
35 -  
36 - def self.metric_results_of(module_result_id)  
37 - response = request(:metric_results_of, {:module_result_id => module_result_id})[:metric_result]  
38 - response = [] if response.nil?  
39 - response = [response] if response.is_a?(Hash)  
40 - response.map {|metric_result| new metric_result}  
41 - end  
42 -  
43 - def self.history_of(metric_name, module_result_id)  
44 - response = self.request(:history_of_metric, {:metric_name => metric_name, :module_result_id => module_result_id})[:date_metric_result]  
45 - response = [] if response.nil?  
46 - response = [response] if response.is_a?(Hash)  
47 - response.map {|date_metric_result| Kalibro::DateMetricResult.new date_metric_result}  
48 - end  
49 -  
50 -end  
plugins/mezuro/lib/kalibro/model.rb
@@ -1,164 +0,0 @@ @@ -1,164 +0,0 @@
1 -class Kalibro::Model  
2 -  
3 - attr_accessor :errors  
4 -  
5 - def initialize(attributes={})  
6 - attributes.each { |field, value| send("#{field}=", value) if self.class.is_valid?(field) }  
7 - @errors = []  
8 - end  
9 -  
10 -  
11 - def to_hash(options={})  
12 - hash = Hash.new  
13 - excepts = options[:except].nil? ? [] : options[:except]  
14 - excepts << :errors  
15 - fields.each do |field|  
16 - if(!excepts.include?(field))  
17 - field_value = send(field)  
18 - if !field_value.nil?  
19 - hash[field] = convert_to_hash(field_value)  
20 - if field_value.is_a?(Kalibro::Model)  
21 - hash = {:attributes! => {}}.merge(hash)  
22 - hash[:attributes!][field.to_sym] = {  
23 - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
24 - 'xsi:type' => 'kalibro:' + xml_instance_class_name(field_value) }  
25 - end  
26 - end  
27 - end  
28 - end  
29 - hash  
30 - end  
31 -  
32 - def self.request(action, request_body = nil)  
33 - response = client(endpoint).request(:kalibro, action) { soap.body = request_body }  
34 - response.to_hash["#{action}_response".to_sym] # response is a Savon::SOAP::Response, and to_hash is a Savon::SOAP::Response method  
35 - end  
36 -  
37 - def self.to_objects_array value  
38 - array = value.kind_of?(Array) ? value : [value]  
39 - array.each.collect { |element| to_object(element) }  
40 - end  
41 -  
42 - def self.to_object value  
43 - value.kind_of?(Hash) ? new(value) : value  
44 - end  
45 -  
46 - def self.create(attributes={})  
47 - new_model = new attributes  
48 - new_model.save  
49 - new_model  
50 - end  
51 -  
52 - def self.find(id)  
53 - if(exists?(id))  
54 - new request(find_action, id_params(id))["#{class_name.underscore}".to_sym]  
55 - else  
56 - raise Kalibro::Errors::RecordNotFound  
57 - end  
58 - end  
59 -  
60 - def save  
61 - begin  
62 - self.id = self.class.request(save_action, save_params)["#{instance_class_name.underscore}_id".to_sym]  
63 - true  
64 - rescue Exception => exception  
65 - add_error exception  
66 - false  
67 - end  
68 - end  
69 -  
70 - def destroy  
71 - begin  
72 - self.class.request(destroy_action, destroy_params)  
73 - rescue Exception => exception  
74 - add_error exception  
75 - end  
76 - end  
77 -  
78 - def self.exists?(id)  
79 - request(exists_action, id_params(id))[:exists]  
80 - end  
81 -  
82 - protected  
83 -  
84 - def fields  
85 - instance_variable_names.each.collect { |variable| variable.to_s.sub(/@/, '').to_sym }  
86 - end  
87 -  
88 - def convert_to_hash(value)  
89 - return value if value.nil?  
90 - return value.collect { |element| convert_to_hash(element) } if value.is_a?(Array)  
91 - return value.to_hash if value.is_a?(Kalibro::Model)  
92 - return self.class.date_with_milliseconds(value) if value.is_a?(DateTime)  
93 - return 'INF' if value.is_a?(Float) and value.infinite? == 1  
94 - return '-INF' if value.is_a?(Float) and value.infinite? == -1  
95 - value.to_s  
96 - end  
97 -  
98 - def xml_instance_class_name(object)  
99 - xml_name = object.class.name  
100 - xml_name["Kalibro::"] = ""  
101 - xml_name[0..0] = xml_name[0..0].downcase  
102 - xml_name + "Xml"  
103 - end  
104 -  
105 - def self.client(endpoint)  
106 - service_address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yml")  
107 - Savon::Client.new("#{service_address}#{endpoint}Endpoint/?wsdl")  
108 - end  
109 -  
110 - def self.is_valid?(field)  
111 - field.to_s[0] != '@' and field != :attributes! and (field.to_s =~ /xsi/).nil?  
112 - end  
113 -  
114 - def self.date_with_milliseconds(date)  
115 - milliseconds = "." + (date.sec_fraction * 60 * 60 * 24 * 1000).to_s  
116 - date.to_s[0..18] + milliseconds + date.to_s[19..-1]  
117 - end  
118 -  
119 - def instance_class_name  
120 - self.class.name.gsub(/Kalibro::/,"")  
121 - end  
122 -  
123 - def self.endpoint  
124 - class_name  
125 - end  
126 -  
127 - def save_action  
128 - "save_#{instance_class_name.underscore}".to_sym  
129 - end  
130 -  
131 - def save_params  
132 - {instance_class_name.underscore.to_sym => self.to_hash}  
133 - end  
134 -  
135 - def destroy_action  
136 - "delete_#{instance_class_name.underscore}".to_sym  
137 - end  
138 -  
139 - def destroy_params  
140 - {"#{instance_class_name.underscore}_id".to_sym => self.id}  
141 - end  
142 -  
143 - def self.class_name  
144 - self.name.gsub(/Kalibro::/,"")  
145 - end  
146 -  
147 - def self.exists_action  
148 - "#{class_name.underscore}_exists".to_sym  
149 - end  
150 -  
151 - def self.id_params(id)  
152 - {"#{class_name.underscore}_id".to_sym => id}  
153 - end  
154 -  
155 - def self.find_action  
156 - "get_#{class_name.underscore}".to_sym  
157 - end  
158 -  
159 - def add_error(exception)  
160 - @errors << exception  
161 - end  
162 -  
163 -end  
164 -  
plugins/mezuro/lib/kalibro/module.rb
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -class Kalibro::Module < Kalibro::Model  
2 -  
3 - attr_accessor :name, :granularity  
4 -  
5 -end  
plugins/mezuro/lib/kalibro/module_result.rb
@@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
1 -class Kalibro::ModuleResult < Kalibro::Model  
2 -  
3 - attr_accessor :id, :module, :grade, :parent_id, :height  
4 -  
5 - def self.find(id)  
6 - new request(:get_module_result, { :module_result_id => id })[:module_result]  
7 - end  
8 -  
9 - def children  
10 - response = self.class.request(:children_of, {:module_result_id => id})[:module_result]  
11 - response = [] if response.nil?  
12 - response = [response] if response.is_a?(Hash)  
13 - response.map {|module_result| Kalibro::ModuleResult.new module_result}  
14 - end  
15 -  
16 - def parents  
17 - if parent_id.nil?  
18 - []  
19 - else  
20 - parent = self.class.find(parent_id)  
21 - parent.parents << parent  
22 - end  
23 - end  
24 -  
25 - def id=(value)  
26 - @id = value.to_i  
27 - end  
28 -  
29 - def module=(value)  
30 - @module = Kalibro::Module.to_object value  
31 - end  
32 -  
33 - def grade=(value)  
34 - @grade = value.to_f  
35 - end  
36 -  
37 - def parent_id=(value)  
38 - @parent_id = value.to_i  
39 - end  
40 -  
41 - def self.history_of(module_result_id)  
42 - response = self.request(:history_of_module, {:module_result_id => module_result_id})[:date_module_result]  
43 - response = [] if response.nil?  
44 - response = [response] if response.is_a?(Hash)  
45 - response.map {|date_module_result| Kalibro::DateModuleResult.new date_module_result}  
46 - end  
47 -  
48 -end  
plugins/mezuro/lib/kalibro/process_time.rb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -class Kalibro::ProcessTime < Kalibro::Model  
2 -  
3 - attr_accessor :state, :time  
4 -  
5 - def time=(time)  
6 - @time = time.to_i  
7 - end  
8 -  
9 -end  
plugins/mezuro/lib/kalibro/processing.rb
@@ -1,94 +0,0 @@ @@ -1,94 +0,0 @@
1 -class Kalibro::Processing < Kalibro::Model  
2 -  
3 - attr_accessor :id, :date, :state, :error, :process_time, :results_root_id  
4 -  
5 - def self.processing_of(repository_id)  
6 - if has_ready_processing(repository_id)  
7 - last_ready_processing_of(repository_id)  
8 - else #always exists a processing, we send a requisition to kalibro to process repository  
9 - last_processing_of(repository_id)  
10 - end  
11 - end  
12 -  
13 - def self.processing_with_date_of(repository_id, date)  
14 - date = date.is_a?(String) ? DateTime.parse(date) : date  
15 - if has_processing_after(repository_id, date)  
16 - first_processing_after(repository_id, date)  
17 - elsif has_processing_before(repository_id, date)  
18 - last_processing_before(repository_id, date)  
19 - else  
20 - last_processing_of(repository_id)  
21 - end  
22 - end  
23 -  
24 - def id=(value)  
25 - @id = value.to_i  
26 - end  
27 -  
28 - def date=(value)  
29 - @date = value.is_a?(String) ? DateTime.parse(value) : value  
30 - end  
31 -  
32 - def process_times=(value)  
33 - process_time=value  
34 - end  
35 -  
36 - def process_time=(value)  
37 - @process_time = Kalibro::ProcessTime.to_objects_array value  
38 - end  
39 -  
40 - def process_times  
41 - process_time  
42 - end  
43 -  
44 - def error=(value)  
45 - @error = Kalibro::Throwable.to_object value  
46 - end  
47 -  
48 - def results_root_id=(value)  
49 - @results_root_id = value.to_i  
50 - end  
51 -  
52 - private  
53 -  
54 - def self.has_processing(repository_id)  
55 - request(:has_processing, {:repository_id => repository_id})[:exists]  
56 - end  
57 -  
58 - def self.has_ready_processing(repository_id)  
59 - request(:has_ready_processing, {:repository_id => repository_id})[:exists]  
60 - end  
61 -  
62 - def self.has_processing_after(repository_id, date)  
63 - request(:has_processing_after, {:repository_id => repository_id, :date => date})[:exists]  
64 - end  
65 -  
66 - def self.has_processing_before(repository_id, date)  
67 - request(:has_processing_before, {:repository_id => repository_id, :date => date})[:exists]  
68 - end  
69 -  
70 - def self.last_processing_state_of(repository_id)  
71 - request(:last_processing_state, {:repository_id => repository_id})[:process_state]  
72 - end  
73 -  
74 - def self.last_ready_processing_of(repository_id)  
75 - new request(:last_ready_processing, {:repository_id => repository_id})[:processing]  
76 - end  
77 -  
78 - def self.first_processing_of(repository_id)  
79 - new request(:first_processing, {:repository_id => repository_id})[:processing]  
80 - end  
81 -  
82 - def self.last_processing_of(repository_id)  
83 - new request(:last_processing, {:repository_id => repository_id})[:processing]  
84 - end  
85 -  
86 - def self.first_processing_after(repository_id, date)  
87 - new request(:first_processing_after, {:repository_id => repository_id, :date => date})[:processing]  
88 - end  
89 -  
90 - def self.last_processing_before(repository_id, date)  
91 - new request(:last_processing_before, {:repository_id => repository_id, :date => date})[:processing]  
92 - end  
93 -  
94 -end  
plugins/mezuro/lib/kalibro/project.rb
@@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
1 -class Kalibro::Project < Kalibro::Model  
2 -  
3 - attr_accessor :id, :name, :description  
4 -  
5 - def id=(value)  
6 - @id = value.to_i  
7 - end  
8 -  
9 - def self.all  
10 - response = request(:all_projects)[:project]  
11 - response = [] if response.nil?  
12 - response = [response] if response.is_a?(Hash)  
13 - response.map {|project| new project}  
14 - end  
15 -end  
plugins/mezuro/lib/kalibro/range.rb
@@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
1 -class Kalibro::Range < Kalibro::Model  
2 -  
3 - attr_accessor :id, :beginning, :end, :reading_id, :comments  
4 -  
5 - def id=(value)  
6 - @id = value.to_i  
7 - end  
8 -  
9 - def beginning=(value)  
10 - @beginning = value.to_f  
11 - @beginning = -1.0/0.0 if value == "-INF"  
12 - end  
13 -  
14 - def beginning  
15 - if !@beginning.nil?  
16 - case @beginning.to_s  
17 - when "-Infinity": "-INF"  
18 - else @beginning  
19 - end  
20 - end  
21 - end  
22 -  
23 - def end=(value)  
24 - @end = value.to_f  
25 - @end = 1.0/0.0 if value =~ /INF/  
26 - end  
27 -  
28 - def end  
29 - if !@end.nil?  
30 - case @end.to_s  
31 - when "Infinity": "INF"  
32 - else @end  
33 - end  
34 - end  
35 - end  
36 -  
37 - def reading_id=(value)  
38 - @reading_id = value.to_i  
39 - end  
40 -  
41 - def label  
42 - reading.label  
43 - end  
44 -  
45 - def grade  
46 - reading.grade  
47 - end  
48 -  
49 - def color  
50 - reading.color  
51 - end  
52 -  
53 - def self.ranges_of( metric_configuration_id )  
54 - response = request(:ranges_of, {:metric_configuration_id => metric_configuration_id} )[:range]  
55 - response = [] if response.nil?  
56 - response = [response] if response.is_a?(Hash)  
57 - response.map { |range| new range }  
58 - end  
59 -  
60 - def save( metric_configuration_id )  
61 - begin  
62 - self.id = self.class.request(:save_range, {:range => self.to_hash, :metric_configuration_id => metric_configuration_id})[:range_id]  
63 - true  
64 - rescue Exception => exception  
65 - add_error exception  
66 - false  
67 - end  
68 - end  
69 -  
70 - private  
71 -  
72 - def reading  
73 - @reading ||= Kalibro::Reading.find(reading_id)  
74 - @reading  
75 - end  
76 -  
77 -end  
78 -  
plugins/mezuro/lib/kalibro/range_snapshot.rb
@@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
1 -class Kalibro::RangeSnapshot < Kalibro::Model  
2 -  
3 - attr_accessor :beginning, :end, :label, :grade, :color, :comments  
4 -  
5 - def beginning=(value)  
6 - @beginning = ((value == "-INF") ? -1.0/0 : value.to_f)  
7 - end  
8 -  
9 - def end=(value)  
10 - @end = ((value == "INF") ? 1.0/0 : value.to_f)  
11 - end  
12 -  
13 - def grade=(value)  
14 - @grade = value.to_f  
15 - end  
16 -  
17 -end  
plugins/mezuro/lib/kalibro/reading.rb
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -class Kalibro::Reading < Kalibro::Model  
2 -  
3 - attr_accessor :id, :label, :grade, :color, :group_id  
4 -  
5 - def self.find(id)  
6 - new request(:get_reading, {:reading_id => id})[:reading]  
7 - end  
8 -  
9 - def self.readings_of( group_id )  
10 - response = request(:readings_of, {:group_id => group_id})[:reading]  
11 - response = [] if response.nil?  
12 - response = [response] if response.is_a?(Hash)  
13 - response.map { |reading| new reading }  
14 - end  
15 -  
16 - def self.reading_of( range_id )  
17 - new request(:reading_of, {:range_id => range_id} )[:reading]  
18 - end  
19 -  
20 - def id=(value)  
21 - @id = value.to_i  
22 - end  
23 -  
24 - def grade=(value)  
25 - @grade = value.to_f  
26 - end  
27 -  
28 - private  
29 -  
30 - def save_params  
31 - {:reading => self.to_hash, :group_id => group_id}  
32 - end  
33 -  
34 -end  
plugins/mezuro/lib/kalibro/reading_group.rb
@@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
1 -class Kalibro::ReadingGroup < Kalibro::Model  
2 -  
3 - attr_accessor :id, :name, :description  
4 -  
5 - def id=(value)  
6 - @id = value.to_i  
7 - end  
8 -  
9 - def self.all  
10 - response = request(:all_reading_groups)[:reading_group]  
11 - response = [] if response.nil?  
12 - response = [response] if response.is_a?(Hash)  
13 - response.map { |reading_group| new reading_group }  
14 - end  
15 -  
16 - def self.reading_group_of( metric_configuration_id )  
17 - new request(:reading_group_of, {:metric_configuration_id => metric_configuration_id} )[:reading_group]  
18 - end  
19 -  
20 - private  
21 -  
22 - def self.id_params(id)  
23 - {:group_id => id}  
24 - end  
25 -  
26 - def destroy_params  
27 - {:group_id => self.id}  
28 - end  
29 -  
30 -end  
plugins/mezuro/lib/kalibro/repository.rb
@@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
1 -class Kalibro::Repository < Kalibro::Model  
2 -  
3 - attr_accessor :id, :name, :description, :license, :process_period, :type, :address, :configuration_id, :project_id  
4 -  
5 - def self.repository_types  
6 - request(:supported_repository_types)[:supported_type].to_a  
7 - end  
8 -  
9 - def self.repositories_of(project_id)  
10 - response = request(:repositories_of, {:project_id => project_id})[:repository]  
11 - response = [] if response.nil?  
12 - response = [response] if response.is_a?(Hash)  
13 - response.map {|repository| new repository}  
14 - end  
15 -  
16 - def id=(value)  
17 - @id = value.to_i  
18 - end  
19 -  
20 - def process_period=(value)  
21 - @process_period = value.to_i  
22 - end  
23 -  
24 - def configuration_id=(value)  
25 - @configuration_id = value.to_i  
26 - end  
27 -  
28 - def process  
29 - self.class.request(:process_repository, {:repository_id => self.id})  
30 - end  
31 -  
32 - def cancel_processing_of_repository  
33 - self.class.request(:cancel_processing_of_repository, {:repository_id => self.id})  
34 - end  
35 -  
36 - private  
37 -  
38 - def save_params  
39 - {:repository => self.to_hash, :project_id => project_id}  
40 - end  
41 -  
42 -end  
plugins/mezuro/lib/kalibro/stack_trace_element.rb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -class Kalibro::StackTraceElement < Kalibro::Model  
2 -  
3 - attr_accessor :declaring_class, :method_name, :file_name, :line_number  
4 -  
5 - def line_number=(value)  
6 - @line_number = value.to_i  
7 - end  
8 -  
9 -end  
plugins/mezuro/lib/kalibro/throwable.rb
@@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
1 -class Kalibro::Throwable < Kalibro::Model  
2 -  
3 - attr_accessor :target_string, :message, :cause, :stack_trace_element  
4 -  
5 - def stack_trace_element=(value)  
6 - @stack_trace_element = Kalibro::StackTraceElement.to_objects_array value  
7 - end  
8 -  
9 - def stack_trace  
10 - @stack_trace_element  
11 - end  
12 -  
13 - def stack_trace=(stack_trace)  
14 - @stack_trace_element = stack_trace  
15 - end  
16 -  
17 - def cause=(cause_value)  
18 - @cause = Kalibro::Throwable.to_object cause_value  
19 - end  
20 -  
21 -end  
plugins/mezuro/lib/mezuro_plugin.rb
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -require 'yaml'  
2 -  
3 -Savon.configure do |config|  
4 - config.log = HTTPI.log = (RAILS_ENV == 'development')  
5 -end  
6 -  
7 -class MezuroPlugin < Noosfero::Plugin  
8 -  
9 - def self.plugin_name  
10 - "Mezuro"  
11 - end  
12 -  
13 - def self.plugin_description  
14 - _("A metric analizer plugin.")  
15 - end  
16 -  
17 - def content_types  
18 - if context.profile.is_a?(Community)  
19 - MezuroPlugin::ProjectContent  
20 - else  
21 - [MezuroPlugin::ConfigurationContent,  
22 - MezuroPlugin::ReadingGroupContent]  
23 - end  
24 - end  
25 -  
26 - def control_panel_buttons  
27 - if context.profile.is_a?(Community)  
28 - {:title => _('Mezuro project'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ProjectContent'}, :icon => 'mezuro' }  
29 - else  
30 - [{:title => _('Mezuro configuration'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ConfigurationContent'}, :icon => 'mezuro' },  
31 - {:title => _('Mezuro reading group'), :url => {:controller => 'cms', :action => 'new', :profile => context.profile.identifier, :type => 'MezuroPlugin::ReadingGroupContent'}, :icon => 'mezuro' }]  
32 - end  
33 - end  
34 -  
35 - def stylesheet?  
36 - true  
37 - end  
38 -  
39 -end  
plugins/mezuro/lib/mezuro_plugin/configuration_content.rb
@@ -1,138 +0,0 @@ @@ -1,138 +0,0 @@
1 -class MezuroPlugin::ConfigurationContent < Article  
2 - validate_on_create :validate_configuration_name  
3 -  
4 - settings_items :configuration_id  
5 -  
6 - before_save :send_configuration_to_service  
7 - after_destroy :remove_configuration_from_service  
8 -  
9 - def self.short_description  
10 - 'Mezuro configuration'  
11 - end  
12 -  
13 - def self.description  
14 - 'Set of metric configurations to interpret a Kalibro project'  
15 - end  
16 -  
17 - include ActionView::Helpers::TagHelper  
18 - def to_html(options = {})  
19 - lambda do  
20 - render :file => 'content_viewer/show_configuration.rhtml'  
21 - end  
22 - end  
23 -  
24 - def kalibro_configuration #Can't be just "configuration", method name exists somewhere in noosfero  
25 - begin  
26 - @configuration ||= Kalibro::Configuration.find(self.configuration_id)  
27 - rescue Exception => exception  
28 - errors.add_to_base(exception.message)  
29 - @configuration = nil  
30 - end  
31 - @configuration  
32 - end  
33 -  
34 - def configuration_names_and_ids  
35 - begin  
36 - all_configurations = Kalibro::Configuration.all  
37 - all_names_and_ids = all_configurations.map { |configuration| [configuration.name, configuration.id] }  
38 - [["None", -1]] + (all_names_and_ids.sort { |x,y| x.first.downcase <=> y.first.downcase })  
39 - rescue Exception => exception  
40 - errors.add_to_base(exception.message)  
41 - [["None", -1]]  
42 - end  
43 -  
44 - end  
45 -  
46 - def description=(value)  
47 - @description=value  
48 - end  
49 -  
50 - def description  
51 - begin  
52 - @description ||= kalibro_configuration.description  
53 - rescue  
54 - @description = ""  
55 - end  
56 - @description  
57 - end  
58 -  
59 - def configuration_to_clone_id  
60 - begin  
61 - @configuration_to_clone_id  
62 - rescue Exception => exception  
63 - nil  
64 - end  
65 - end  
66 -  
67 - def configuration_to_clone_id=(value)  
68 - @configuration_to_clone_id = (value == -1) ? nil : value  
69 - end  
70 -  
71 - def metric_configurations  
72 - begin  
73 - @metric_configurations ||= Kalibro::MetricConfiguration.metric_configurations_of(configuration_id)  
74 - rescue Exception => error  
75 - errors.add_to_base(error.message)  
76 - @metric_configurations = []  
77 - end  
78 - @metric_configurations  
79 - end  
80 -  
81 - def metric_configurations=(value)  
82 - @metric_configurations = value.kind_of?(Array) ? value : [value]  
83 - @metric_configurations = @metric_configurations.map { |element| to_metric_configuration(element) }  
84 - end  
85 -  
86 - private  
87 -  
88 - def self.to_metric_configuration value  
89 - value.kind_of?(Hash) ? Kalibro::MetricConfiguration.new(value) : value  
90 - end  
91 -  
92 - def validate_configuration_name  
93 - existing = configuration_names_and_ids.map { |a| a.first.downcase}  
94 -  
95 - if existing.include?(name.downcase)  
96 - errors.add_to_base("Configuration name already exists in Kalibro")  
97 - end  
98 - end  
99 -  
100 - def remove_configuration_from_service  
101 - kalibro_configuration.destroy unless kalibro_configuration.nil?  
102 - end  
103 -  
104 - def send_configuration_to_service  
105 - attributes = {:id => configuration_id, :name => name, :description => description}  
106 - created_configuration = Kalibro::Configuration.create attributes  
107 - self.configuration_id = created_configuration.id  
108 - clone_configuration if cloning_configuration?  
109 - end  
110 -  
111 - def cloning_configuration?  
112 - !configuration_to_clone_id.nil?  
113 - end  
114 -  
115 - def clone_configuration  
116 - metric_configurations_to_clone ||= Kalibro::MetricConfiguration.metric_configurations_of(configuration_to_clone_id)  
117 - clone_metric_configurations metric_configurations_to_clone  
118 - end  
119 -  
120 - def clone_metric_configurations metric_configurations_to_clone  
121 - metric_configurations_to_clone.each do |metric_configuration|  
122 - clonned_metric_configuration_id = metric_configuration.id  
123 - metric_configuration.id = nil  
124 - metric_configuration.configuration_id = self.configuration_id  
125 - metric_configuration.save  
126 - clone_ranges clonned_metric_configuration_id, metric_configuration.id  
127 - end  
128 - end  
129 -  
130 - def clone_ranges clonned_metric_configuration_id, new_metric_configuration_id  
131 - Kalibro::Range.ranges_of(clonned_metric_configuration_id).each do |range|  
132 - range.id = nil  
133 - range.save new_metric_configuration_id  
134 - end  
135 - end  
136 -  
137 -end  
138 -  
plugins/mezuro/lib/mezuro_plugin/helpers/content_viewer_helper.rb
@@ -1,80 +0,0 @@ @@ -1,80 +0,0 @@
1 -class MezuroPlugin::Helpers::ContentViewerHelper  
2 -  
3 - MAX_NUMBER_OF_LABELS = 5  
4 -  
5 - def self.format_grade(grade)  
6 - sprintf("%.2f", grade.to_f)  
7 - end  
8 -  
9 - def self.periodicity_options  
10 - [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]]  
11 - end  
12 -  
13 - def self.periodicity_option(periodicity)  
14 - periodicity_options.select {|x| x.last == periodicity}.first.first  
15 - end  
16 -  
17 - def self.license_options  
18 - options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yml")  
19 - options = options.split("; ")  
20 - options  
21 - end  
22 -  
23 - def self.generate_chart(score_history)  
24 - values = []  
25 - labels = []  
26 - score_history.each do |score_data|  
27 - values << score_data.result  
28 - labels << score_data.date  
29 - end  
30 - labels = discretize_array labels  
31 - Gchart.line(  
32 - :title_color => 'FF0000',  
33 - :size => '600x180',  
34 - :bg => {:color => 'efefef', :type => 'stripes'},  
35 - :line_colors => 'c4a000',  
36 - :data => values,  
37 - :labels => labels,  
38 - :axis_with_labels => ['y','x'],  
39 - :max_value => values.max,  
40 - :min_value => values.min  
41 - )  
42 - end  
43 -  
44 - def self.format_name(metric_configuration_snapshot)  
45 - metric_configuration_snapshot.metric.name.delete("() ")  
46 - end  
47 -  
48 - def self.format_time(miliseconds)  
49 - seconds = miliseconds/1000  
50 - MezuroPluginModuleResultController.helpers.distance_of_time_in_words(0, seconds, include_seconds = true)  
51 - end  
52 -  
53 - def self.aggregation_options  
54 - [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],  
55 - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]]  
56 - end  
57 -  
58 - def self.scope_options  
59 - [["Software", "SOFTWARE"], ["Package", "PACKAGE"], ["Class", "CLASS"], ["Method", "METHOD"]]  
60 - end  
61 -  
62 - private  
63 -  
64 - def self.discretize_array(array)  
65 - if array.size > MAX_NUMBER_OF_LABELS  
66 - range_array.map { |i| discrete_element(array, i)}  
67 - else  
68 - array  
69 - end  
70 - end  
71 -  
72 - def self.range_array  
73 - (0..(MAX_NUMBER_OF_LABELS - 1)).to_a  
74 - end  
75 -  
76 - def self.discrete_element(array, i)  
77 - array[(i*(array.size - 1))/(MAX_NUMBER_OF_LABELS - 1)]  
78 - end  
79 -  
80 -end  
plugins/mezuro/lib/mezuro_plugin/helpers/module_result_helper.rb
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -class MezuroPlugin::Helpers::ModuleResultHelper  
2 -  
3 - def self.module_name name  
4 - name.is_a?(Array) ? name.last : name  
5 - end  
6 -  
7 -end  
plugins/mezuro/lib/mezuro_plugin/project_content.rb
@@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
1 -class MezuroPlugin::ProjectContent < Article  
2 - include ActionView::Helpers::TagHelper  
3 -  
4 - settings_items :project_id  
5 -  
6 - before_save :send_project_to_service  
7 - after_destroy :destroy_project_from_service  
8 -  
9 - def self.short_description  
10 - 'Mezuro project'  
11 - end  
12 -  
13 - def self.description  
14 - 'Software project tracked by Kalibro'  
15 - end  
16 -  
17 - def to_html(options = {})  
18 - lambda do  
19 - render :file => 'content_viewer/show_project.rhtml'  
20 - end  
21 - end  
22 -  
23 - def project  
24 - begin  
25 - @project ||= Kalibro::Project.find(project_id)  
26 - rescue Exception => error  
27 - errors.add_to_base(error.message)  
28 - end  
29 - @project  
30 - end  
31 -  
32 - def repositories  
33 - begin  
34 - @repositories ||= Kalibro::Repository.repositories_of(project_id)  
35 - rescue Exception => error  
36 - errors.add_to_base(error.message)  
37 - @repositories = []  
38 - end  
39 - @repositories  
40 - end  
41 -  
42 - def description=(value)  
43 - @description=value  
44 - end  
45 -  
46 - def description  
47 - begin  
48 - @description ||= project.description  
49 - rescue  
50 - @description = ""  
51 - end  
52 - @description  
53 - end  
54 -  
55 - def repositories=(value)  
56 - @repositories = value.kind_of?(Array) ? value : [value]  
57 - @repositories = @repositories.map { |element| to_repository(element) }  
58 - end  
59 -  
60 - private  
61 -  
62 - def self.to_repository value  
63 - value.kind_of?(Hash) ? Kalibro::Repository.new(value) : value  
64 - end  
65 -  
66 - def validate_repository_address  
67 - repositories.each do |repository|  
68 - if (!repository.nil?)  
69 - address = repository.address  
70 - if(address.nil? || address == "")  
71 - errors.add_to_base("Repository Address is mandatory")  
72 - end  
73 - else  
74 - errors.add_to_base("Repository is mandatory")  
75 - end  
76 - end  
77 - end  
78 -  
79 - def send_project_to_service  
80 - created_project = create_kalibro_project  
81 - self.project_id = created_project.id  
82 - end  
83 -  
84 - def create_kalibro_project  
85 - Kalibro::Project.create(  
86 - :name => name,  
87 - :description => description,  
88 - :id => self.project_id  
89 - )  
90 - end  
91 -  
92 - def destroy_project_from_service  
93 - project.destroy unless project.nil?  
94 - end  
95 -  
96 -end  
plugins/mezuro/lib/mezuro_plugin/reading_group_content.rb
@@ -1,83 +0,0 @@ @@ -1,83 +0,0 @@
1 -class MezuroPlugin::ReadingGroupContent < Article  
2 - include ActionView::Helpers::TagHelper  
3 -  
4 - settings_items :reading_group_id  
5 -  
6 - before_save :send_reading_group_to_service  
7 - after_destroy :destroy_reading_group_from_service  
8 -  
9 - def self.short_description  
10 - 'Mezuro reading group'  
11 - end  
12 -  
13 - def self.description  
14 - 'Set of thresholds to interpret metric results'  
15 - end  
16 -  
17 - def to_html(options = {})  
18 - lambda do  
19 - render :file => 'content_viewer/show_reading_group.rhtml'  
20 - end  
21 - end  
22 -  
23 - def reading_group  
24 - begin  
25 - @reading_group ||= Kalibro::ReadingGroup.find(reading_group_id)  
26 - rescue Exception => error  
27 - errors.add_to_base(error.message)  
28 - end  
29 - @reading_group  
30 - end  
31 -  
32 - def readings  
33 - begin  
34 - @readings ||= Kalibro::Reading.readings_of(reading_group_id)  
35 - rescue Exception => error  
36 - errors.add_to_base(error.message)  
37 - @readings = []  
38 - end  
39 - @readings  
40 - end  
41 -  
42 - def description=(value)  
43 - @description=value  
44 - end  
45 -  
46 - def description  
47 - begin  
48 - @description ||= reading_group.description  
49 - rescue  
50 - @description = ""  
51 - end  
52 - @description  
53 - end  
54 -  
55 - def readings=(value)  
56 - @readings = value.kind_of?(Array) ? value : [value]  
57 - @readings = @readings.map { |element| to_reading(element) }  
58 - end  
59 -  
60 - private  
61 -  
62 - def self.to_reading value  
63 - value.kind_of?(Hash) ? Kalibro::Reading.new(value) : value  
64 - end  
65 -  
66 - def send_reading_group_to_service  
67 - created_reading_group = create_kalibro_reading_group  
68 - self.reading_group_id = created_reading_group.id  
69 - end  
70 -  
71 - def create_kalibro_reading_group  
72 - Kalibro::ReadingGroup.create(  
73 - :name => name,  
74 - :description => description,  
75 - :id => self.reading_group_id  
76 - )  
77 - end  
78 -  
79 - def destroy_reading_group_from_service  
80 - reading_group.destroy unless reading_group.nil?  
81 - end  
82 -  
83 -end  
plugins/mezuro/licenses.yml.example
@@ -1,69 +0,0 @@ @@ -1,69 +0,0 @@
1 -Academic Free License 3.0 (AFL-3.0);  
2 -Affero GNU Public License (AGPL-3.0);  
3 -Adaptive Public License (APL-1.0);  
4 -Apache License 2.0 (Apache-2.0);  
5 -Apple Public Source License (APSL-2.0);  
6 -Artistic license 2.0 (Artistic-2.0);  
7 -Attribution Assurance Licenses (AAL);  
8 -BSD 3-Clause "New" or "Revised" License (BSD-3-Clause);  
9 -BSD 2-Clause "Simplified" or "FreeBSD" License (BSD-2-Clause);  
10 -Boost Software License (BSL-1.0);  
11 -Computer Associates Trusted Open Source License 1.1 (CATOSL-1.1);  
12 -Common Development and Distribution License 1.0 (CDDL-1.0);  
13 -Common Public Attribution License 1.0 (CPAL-1.0);  
14 -CUA Office Public License Version 1.0 (CUA-OPL-1.0);  
15 -EU DataGrid Software License (EUDatagrid);  
16 -Eclipse Public License 1.0 (EPL-1.0);  
17 -Educational Community License, Version 2.0 (ECL-2.0);  
18 -Eiffel Forum License V2.0 (EFL-2.0);  
19 -Entessa Public License (Entessa);  
20 -European Union Public License, Version 1.1 (EUPL-1.1);  
21 -Fair License (FAIR);  
22 -Frameworx License (Frameworx-1.0);  
23 -GNU Affero General Public License v3 (AGPL-3.0);  
24 -GNU General Public License version 2.0 (GPL-2.0);  
25 -GNU General Public License version 3.0 (GPL-3.0);  
26 -GNU Library or "Lesser" General Public License version 2.1 (LGPL-2.1);  
27 -GNU Library or "Lesser" General Public License version 3.0 (LGPL-3.0);  
28 -Historical Permission Notice and Disclaimer (HPND);  
29 -IBM Public License 1.0 (IPL-1.0);  
30 -IPA Font License (IPA);  
31 -ISC License (ISC);  
32 -LaTeX Project Public License 1.3c (LPPL-1.3c);  
33 -Lucent Public License Version 1.02 (LPL-1.02);  
34 -MirOS Licence (MirOS);  
35 -Microsoft Public License (Ms-PL);  
36 -Microsoft Reciprocal License (Ms-RL);  
37 -MIT license (MIT);  
38 -Motosoto License (Motosoto);  
39 -Mozilla Public License 2.0 (MPL-2.0);  
40 -Multics License (Multics);  
41 -NASA Open Source Agreement 1.3 (NASA 1.3);  
42 -NTP License (NTP);  
43 -Naumen Public License (Naumen);  
44 -Nethack General Public License (NGPL);  
45 -Nokia Open Source License (Nokia);  
46 -Non-Profit Open Software License 3.0 (NPOSL-3.0);  
47 -OCLC Research Public License 2.0 (OCLC-2.0);  
48 -Open Font License 1.1 (OFL 1.1);  
49 -Open Group Test Suite License (OGTSL);  
50 -Open Software License 3.0 (OSL-3.0);  
51 -PHP License 3.0 (PHP-3.0);  
52 -The PostgreSQL License (PostgreSQL);  
53 -Python License (Python-2.0);  
54 -CNRI Python license (CNRI-Python);  
55 -Q Public License (QPL-1.0);  
56 -RealNetworks Public Source License V1.0 (RPSL-1.0);  
57 -Reciprocal Public License 1.5 (RPL-1.5);  
58 -Ricoh Source Code Public License (RSCPL);  
59 -Simple Public License 2.0 (SimPL-2.0);  
60 -Sleepycat License (Sleepycat);  
61 -Sun Public License 1.0 (SPL-1.0);  
62 -Sybase Open Watcom Public License 1.0 (Watcom-1.0);  
63 -University of Illinois/NCSA Open Source License (NCSA);  
64 -Vovida Software License v. 1.0 (VSL-1.0);  
65 -W3C License (W3C);  
66 -wxWindows Library License (WXwindows);  
67 -X.Net License (Xnet);  
68 -Zope Public License 2.0 (ZPL-2.0);  
69 -zlib/libpng license (Zlib)  
plugins/mezuro/public/colorPicker.css
@@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
1 -div.colorPicker-picker {  
2 - height: 16px;  
3 - width: 16px;  
4 - padding: 0 !important;  
5 - border: 1px solid #ccc;  
6 - background: url(arrow.gif) no-repeat top right;  
7 - cursor: pointer;  
8 - line-height: 16px;  
9 -}  
10 -  
11 -div.colorPicker-palette {  
12 - width: 110px;  
13 - position: absolute;  
14 - border: 1px solid #598FEF;  
15 - background-color: #EFEFEF;  
16 - padding: 2px;  
17 - z-index: 9999;  
18 -}  
19 - div.colorPicker_hexWrap {width: 100%; float:left }  
20 - div.colorPicker_hexWrap label {font-size: 95%; color: #2F2F2F; margin: 5px 2px; width: 25%}  
21 - div.colorPicker_hexWrap input {margin: 5px 2px; padding: 0; font-size: 95%; border: 1px solid #000; width: 65%; }  
22 -  
23 -div.colorPicker-swatch {  
24 - height: 12px;  
25 - width: 12px;  
26 - border: 1px solid #000;  
27 - margin: 2px;  
28 - float: left;  
29 - cursor: pointer;  
30 - line-height: 12px;  
31 -}  
plugins/mezuro/public/icons/mezuro.png

3.82 KB

plugins/mezuro/public/images/file.png

534 Bytes

plugins/mezuro/public/images/folder.png

3.31 KB

plugins/mezuro/public/images/minus.png

215 Bytes

plugins/mezuro/public/images/plus.png

400 Bytes

plugins/mezuro/public/javascripts/processing.js
@@ -1,133 +0,0 @@ @@ -1,133 +0,0 @@
1 -var processingTree = false;  
2 -var metricName;  
3 -jQuery(function (){  
4 - jQuery('.source-tree-link').live("click", reloadModule);  
5 - jQuery('[show-metric-history]').live("click", display_metric_history);  
6 - jQuery('[show-grade-history]').live("click", display_grade_history);  
7 - jQuery('#project_date_submit').live("click", reloadProcessingWithDate);  
8 - showLoadingProcess(true);  
9 - showProcessing();  
10 -});  
11 -  
12 -function showProcessing() {  
13 - repository_id = processingData('repository-id');  
14 - callAction('processing', 'state', {repository_id: repository_id}, showProcessingFor);  
15 -}  
16 -  
17 -function display_metric_history() {  
18 - var module_result_id = jQuery(this).attr('data-module-id');  
19 - var formatted_name = jQuery(this).attr('show-metric-history');  
20 - var metric_name = jQuery(this).attr('data-metric-name');  
21 - toggle_mezuro("." + formatted_name);  
22 - metricName = formatted_name;  
23 - callAction('module_result', 'metric_result_history', {metric_name: metric_name, module_result_id: module_result_id}, show_metrics);  
24 - return false;  
25 -}  
26 -  
27 -function display_grade_history() {  
28 - var module_result_id = jQuery(this).attr('data-module-id');  
29 - toggle_mezuro("#historical-grade");  
30 - callAction('module_result', 'module_result_history', {module_result_id: module_result_id}, show_grades);  
31 - return false;  
32 -}  
33 -  
34 -function show_metrics(content) {  
35 - jQuery('#historical-' + metricName).html(content);  
36 -}  
37 -  
38 -function show_grades(content) {  
39 - jQuery('#historical-grade').html(content);  
40 -}  
41 -  
42 -function toggle_mezuro(element){  
43 - jQuery(element).toggle();  
44 - return false;  
45 -}  
46 -  
47 -function reloadModule(){  
48 - var module_result_id = jQuery(this).attr('data-module-id');  
49 - showLoadingProcess(false);  
50 - processingTree = true;  
51 - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult);  
52 - return false;  
53 -}  
54 -  
55 -function reloadProcessingWithDate(date){  
56 - reloadProcessing(date + "T00:00:00+00:00");  
57 - return false;  
58 -}  
59 -  
60 -function reloadProcessing(date){  
61 - repository_id = processingData('repository-id');  
62 - showLoadingProcess(true);  
63 -  
64 - callAction('processing', 'processing', {date: date, repository_id: repository_id}, function(content){  
65 - showReadyProcessing(content);  
66 - var module_result_id = jQuery("#module_result_root_id").attr('module_result_root_id');  
67 - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult);  
68 - }  
69 - );  
70 -}  
71 -  
72 -function showProcessingFor(state){  
73 - repository_id = processingData('repository-id');  
74 - if (state == 'ERROR') {  
75 - jQuery('#processing-state').html('<div style="color:Red">ERROR</div>');  
76 - callAction('processing', 'processing', {repository_id: repository_id}, showReadyProcessing);  
77 - showModuleResult('');  
78 - }  
79 - else if (state == 'READY') {  
80 - jQuery('#msg-time').html('');  
81 - jQuery('#processing-state').html('<div style="color:Green">READY</div>');  
82 - callAction('processing', 'processing', {repository_id: repository_id}, function(content){  
83 - showReadyProcessing(content);  
84 - var module_result_id = jQuery("#module_result_root_id").attr('module_result_root_id');  
85 - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult);  
86 - }  
87 - );  
88 - }  
89 - else if (state.endsWith("ING")) {  
90 - jQuery('#processing-state').html('<div style="color:DarkGoldenRod">'+ state +'</div>');  
91 - jQuery('#msg-time').html("The project analysis may take long. <br/> You'll receive an e-mail when it's ready!");  
92 - showProcessingAfter(20);  
93 - }  
94 -}  
95 -  
96 -function showProcessingAfter(seconds){  
97 - if (seconds > 0){  
98 - setTimeout(function() { showProcessingAfter(seconds - 10);}, 10000);  
99 - } else {  
100 - showProcessing();  
101 - }  
102 -}  
103 -  
104 -function showReadyProcessing(content) {  
105 - jQuery('#processing').html(content);  
106 -}  
107 -  
108 -function showModuleResult(content){  
109 - jQuery('#module-result').html(content);  
110 -}  
111 -  
112 -function callAction(controller, action, params, callback){  
113 - var profile = processingData('profile');  
114 - var content = processingData('content');  
115 - var endpoint = '/profile/' + profile + '/plugin/mezuro/' + controller + '/' + action + '/' + content;  
116 - jQuery.get(endpoint, params, callback);  
117 -}  
118 -  
119 -function processingData(data){  
120 - return jQuery('#processing').attr('data-' + data);  
121 -}  
122 -  
123 -function showLoadingProcess(firstLoad){  
124 - if(firstLoad)  
125 - showReadyProcessing("<img src='/images/loading-small.gif'/>");  
126 - showModuleResult("<img src='/images/loading-small.gif'/>");  
127 -}  
128 -  
129 -function sourceNodeToggle(id){  
130 - var suffixes = ['_hidden', '_plus', '_minus'];  
131 - for (var i in suffixes)  
132 - jQuery('#' + id + suffixes[i]).toggle();  
133 -}  
plugins/mezuro/public/javascripts/validations.js
@@ -1,181 +0,0 @@ @@ -1,181 +0,0 @@
1 -jQuery(function (){  
2 - jQuery('#range_submit').live("click", validate_new_range_configuration);  
3 - jQuery('#metric_configuration_submit').live("click", validate_metric_configuration);  
4 - jQuery('#repository_submit').live("click", validate_new_repository);  
5 - jQuery('#reading_submit').live("click", validate_new_reading);  
6 -});  
7 -  
8 -function validate_code(code){  
9 - return true;  
10 -}  
11 -  
12 -function allRequiredFieldsAreFilled() {  
13 - var name = jQuery('#repository_name').val();  
14 - var address = jQuery('#repository_address').val();  
15 -  
16 - if (is_null(name) || is_null(address)) {  
17 - alert("Please fill all fields marked with (*).");  
18 - return false;  
19 - }  
20 - return true;  
21 -}  
22 -  
23 -function validate_new_reading() {  
24 - var name = jQuery('#reading_label').val();  
25 - var grade = jQuery('#reading_grade').val();  
26 - var color = jQuery('#reading_color').val();  
27 -  
28 - if (is_null(name) || is_null(grade) || is_null(color)){  
29 - alert("Please fill all fields marked with (*).");  
30 - return false;  
31 - }  
32 -  
33 - var parser = jQuery('#labels_and_grades').attr('data-parser');  
34 - var labels_and_grades = jQuery('#labels_and_grades').attr('data-list').split(parser);  
35 - for (var id = 0; id < labels_and_grades.length; id = id + 2) {  
36 - if (labels_and_grades[id] == name) {  
37 - alert("This label already exists! Please, choose another one.");  
38 - return false;  
39 - }  
40 -  
41 - if (labels_and_grades[id+1] == grade || labels_and_grades[id+1] == grade + ".0") {  
42 - alert("This grade already exists! Please, choose another one.");  
43 - return false;  
44 - }  
45 - }  
46 -  
47 - if (!color.match(/^[a-fA-F0-9]{6}$/)) {  
48 - alert("This is not a valid color.");  
49 - return false;  
50 - }  
51 - return true;  
52 -}  
53 -  
54 -function validate_new_repository() {  
55 - if (allRequiredFieldsAreFilled()) {  
56 - return addressAndTypeMatch();  
57 - }  
58 - return false;  
59 -}  
60 -  
61 -function addressAndTypeMatch() {  
62 - var type = jQuery('#repository_type').val();  
63 - var address = jQuery('#repository_address').val();  
64 -  
65 - switch (type) {  
66 - case "BAZAAR": return matchBazaar(address);  
67 - case "CVS": return matchCVS(address);  
68 - case "GIT": return matchGIT(address);  
69 - case "MERCURIAL": return matchMercurial(address);  
70 - case "REMOTE_TARBALL": return matchRemoteTarball(address);  
71 - case "REMOTE_ZIP": return matchRemoteZIP(address);  
72 - case "SUBVERSION": return matchSubversion(address);  
73 - }  
74 -}  
75 -  
76 -function matchBazaar(address) {  
77 - if (address.match(/bzr/)) {  
78 - return true;  
79 - }  
80 - alert("Address does not match type BAZAAR chosen.");  
81 - return false;  
82 -}  
83 -  
84 -function matchCVS(address) {  
85 - if (address.match(/cvs/)) {  
86 - return true;  
87 - }  
88 - alert("Address does not match type CVS chosen.");  
89 - return false;  
90 -}  
91 -  
92 -function matchGIT(address) {  
93 - if (address.match(/^(http(s)?:\/\/git(hub)?\.|git:\/\/git(hub\.com|orious\.org)\/|git@git(hub\.com|orious\.org):).+.git$/)) {  
94 - return true;  
95 - }  
96 - alert("Address does not match type GIT chosen.");  
97 - return false;  
98 -}  
99 -  
100 -function matchMercurial(address) {  
101 - if (address.match(/^(http(s)?|ssh):\/\/.*hg/)) {  
102 - return true;  
103 - }  
104 - alert("Address does not match type MERCURIAL chosen.");  
105 - return false;  
106 -}  
107 -  
108 -function matchRemoteTarball(address) {  
109 - if (address.match(/\.tar(\..+)*$/)) {  
110 - return true;  
111 - }  
112 - alert("Address does not match type REMOTE_TARBALL chosen.");  
113 - return false;  
114 -}  
115 -  
116 -function matchRemoteZIP(address) {  
117 - if (address.match(/\.zip$/)) {  
118 - return true;  
119 - }  
120 - alert("Address does not match type REMOTE_ZIP chosen.");  
121 - return false;  
122 -}  
123 -  
124 -function matchSubversion(address) {  
125 - if (address.match(/^http(s)?:\/\/.+\/svn.+$/)) {  
126 - return true;  
127 - }  
128 - alert("Address does not match type SUBVERSION chosen.");  
129 - return false;  
130 -}  
131 -  
132 -function validate_metric_configuration() {  
133 - var code = jQuery('#metric_configuration_code').val();  
134 - if (is_null(code)) {  
135 - alert("Code must be filled out");  
136 - return false;  
137 - }  
138 - return true;  
139 -}  
140 -  
141 -function is_null(value) {  
142 - if (value == "" || value == null) {  
143 - return true;  
144 - }  
145 - return false;  
146 -}  
147 -  
148 -function IsNotNumeric(value) {  
149 - if (value.match(/[0-9]*\.?[0-9]+/)) {  
150 - return false;  
151 - }  
152 - return true;  
153 -}  
154 -  
155 -function IsNotInfinite(value) {  
156 - if (value.match(/INF/)) {  
157 - return false;  
158 - }  
159 - return true;  
160 -}  
161 -  
162 -function validate_new_range_configuration(event) {  
163 - var beginning = jQuery("#range_beginning").val();  
164 - var end = jQuery("#range_end").val();  
165 -  
166 - if (is_null(beginning) || is_null(end)) {  
167 - alert("Please fill all fields marked with (*).");  
168 - return false;  
169 - }  
170 - if ( (IsNotNumeric(beginning) && IsNotInfinite(beginning)) || (IsNotNumeric(end) && IsNotInfinite(end))) {  
171 - alert("Beginning, End and Grade must be numeric values.");  
172 - return false;  
173 - }  
174 - if (parseInt(beginning) > parseInt(end)) {  
175 - if (IsNotInfinite(beginning) && IsNotInfinite(end)) {  
176 - alert("End must be greater than Beginning.");  
177 - return false;  
178 - }  
179 - }  
180 - return true;  
181 -}  
plugins/mezuro/public/style.css
@@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
1 -@import url('colorPicker.css');  
2 -  
3 -.link {  
4 - cursor: pointer;  
5 -}  
6 -  
7 -.source-tree{  
8 - background: #e7e7e7;  
9 - border: groove 1px #666;  
10 -}  
11 -  
12 -.icon {  
13 - width: 20px;  
14 -}  
15 -  
16 -.source-tree-text{  
17 - font-family: Arial, Impact;  
18 - font-size: 12px;  
19 - border-left: solid 1px #666;  
20 -}  
21 -  
22 -a:link,active,visited .ancestor{  
23 - font-family: Arial, Impact;  
24 - color: #5E5400;  
25 -}  
26 -  
27 -.path{  
28 - font-family: Arial, Impact;  
29 - font-size: 14px;  
30 - font-style: underline;  
31 - display: inline;  
32 -}  
33 -  
34 -.controller-profile_editor a.control-panel-mezuro,  
35 - .controller-profile_editor .msie6 a.control-panel-mezuro {  
36 - background-image: url(/plugins/mezuro/icons/mezuro.png)  
37 -}  
plugins/mezuro/script/install/install-rvm.sh
@@ -1,118 +0,0 @@ @@ -1,118 +0,0 @@
1 -#!/bin/bash --login  
2 -  
3 -#Ubuntu Package Dependencies  
4 -sudo apt-get update  
5 -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  
6 -  
7 -#RVM Installation for Ubuntu 12.10  
8 -curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --version 1.19.0  
9 -  
10 -# Load RVM into a shell session *as a function*  
11 -if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then  
12 - # First try to load from a user install  
13 - source "$HOME/.rvm/scripts/rvm"  
14 -elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then  
15 - # Then try to load from a root install  
16 - source "/usr/local/rvm/scripts/rvm"  
17 -else  
18 - printf "ERROR: An RVM installation was not found.\n"  
19 -fi  
20 -rvm reload  
21 -  
22 -#Complements the RVM installation  
23 -rvm requirements run  
24 -#rvm pkg install zlib --verify-downloads 1  
25 -  
26 -#Ruby installation and setup  
27 -CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rvm install 1.8.7-p302  
28 -rvm use ruby-1.8.7-p302@global  
29 -gem install rubygems-update -v 1.3.7  
30 -update_rubygems  
31 -gem install rake -v 0.8.7  
32 -yes | gem uninstall rake -v 10.0.4  
33 -rvm gemset create mezuro  
34 -rvm use ruby-1.8.7-p302@mezuro  
35 -  
36 -#Gems installation  
37 -#The order really matters here, so if you see an output like "2 gems instaled" something should be wrong  
38 -gem install --no-ri --no-rdoc rack -v 1.0.1  
39 -gem install --no-ri --no-rdoc rack-test -v 0.6.2  
40 -gem install --no-ri --no-rdoc httpi -v 1.0  
41 -gem install --no-ri --no-rdoc nokogiri -v 1.5.5  
42 -gem install --no-ri --no-rdoc wasabi -v 2.0.0  
43 -gem install --no-ri --no-rdoc json -v 1.7.5  
44 -gem install --no-ri --no-rdoc gherkin -v 2.5.4  
45 -gem install --no-ri --no-rdoc multi_json -v 1.3.7  
46 -gem install --no-ri --no-rdoc rubyzip -v 0.9.9  
47 -gem install --no-ri --no-rdoc ffi -v 1.2.0  
48 -gem install --no-ri --no-rdoc childprocess -v 0.3.6  
49 -gem install --no-ri --no-rdoc websocket -v 1.0.4  
50 -gem install --no-ri --no-rdoc libwebsocket -v 0.1.6.1  
51 -gem install --no-ri --no-rdoc selenium-webdriver -v 2.30.0  
52 -gem install --no-ri --no-rdoc activesupport -v 2.3.5  
53 -gem install --no-ri --no-rdoc actionpack -v 2.3.5  
54 -gem install --no-ri --no-rdoc actionmailer -v 2.3.5  
55 -gem install --no-ri --no-rdoc activerecord -v 2.3.5  
56 -gem install --no-ri --no-rdoc activeresource -v 2.3.5  
57 -gem install --no-ri --no-rdoc addressable -v 2.2.2  
58 -gem install --no-ri --no-rdoc builder -v 3.1.4  
59 -gem install --no-ri --no-rdoc gyoku -v 0.4.6  
60 -gem install --no-ri --no-rdoc akami -v 1.2.0  
61 -gem install --no-ri --no-rdoc xpath -v 0.1.4  
62 -gem install --no-ri --no-rdoc mime-types -v 1.19  
63 -gem install --no-ri --no-rdoc capybara -v 1.1.1  
64 -gem install --no-ri --no-rdoc term-ansicolor -v 1.0.7  
65 -gem install --no-ri --no-rdoc diff-lcs -v 1.1.3  
66 -gem install --no-ri --no-rdoc cucumber -v 1.1.0  
67 -gem install --no-ri --no-rdoc cucumber-rails -v 0.3.2  
68 -gem install --no-ri --no-rdoc culerity -v 0.2.15  
69 -gem install --no-ri --no-rdoc database_cleaner -v 0.9.1  
70 -gem install --no-ri --no-rdoc exception_notification -v 1.0.20090728  
71 -gem install --no-ri --no-rdoc googlecharts -v 1.6.8  
72 -gem install --no-ri --no-rdoc hpricot -v 0.8.2  
73 -gem install --no-ri --no-rdoc httpi -v 0.9.7  
74 -gem install --no-ri --no-rdoc i18n -v 0.4.1  
75 -gem install --no-ri --no-rdoc metaclass -v 0.0.1  
76 -gem install --no-ri --no-rdoc mocha -v 0.9.8  
77 -gem install --no-ri --no-rdoc nori -v 1.1.3  
78 -gem install --no-ri --no-rdoc ntlm-http -v 0.1.1  
79 -gem install --no-ri --no-rdoc polyglot -v 0.3.3  
80 -gem install --no-ri --no-rdoc rails -v 2.3.5  
81 -gem install --no-ri --no-rdoc rcov -v 0.9.7.1  
82 -gem install --no-ri --no-rdoc RedCloth -v 4.2.2  
83 -gem install --no-ri --no-rdoc rspec -v 1.2.9  
84 -gem install --no-ri --no-rdoc rspec-rails -v 1.2.9  
85 -gem install --no-ri --no-rdoc savon -v 0.9.7  
86 -gem install --no-ri --no-rdoc Selenium -v 1.1.14  
87 -gem install --no-ri --no-rdoc selenium-client -v 1.2.18  
88 -gem install --no-ri --no-rdoc sqlite3 -v 1.3.6  
89 -gem install --no-ri --no-rdoc system_timer -v 1.2.4  
90 -gem install --no-ri --no-rdoc tango -v 0.1.15  
91 -gem install --no-ri --no-rdoc tidy -v 1.1.2  
92 -gem install --no-ri --no-rdoc treetop -v 1.4.10  
93 -gem install --no-ri --no-rdoc webrat -v 0.5.1  
94 -gem install --no-ri --no-rdoc will_paginate -v 2.3.12  
95 -gem install --no-ri --no-rdoc gettext -v 1.8.0  
96 -  
97 -#Mezuro installation  
98 -git clone git@gitorious.org:+mezuro/noosfero/mezuro.git  
99 -cd mezuro  
100 -git checkout mezuro-dev  
101 -rvm use ruby-1.8.7-p302@mezuro  
102 -cp config/database.yml.sqlite3 config/database.yml  
103 -cp plugins/mezuro/service.yml.example plugins/mezuro/service.yml  
104 -cp plugins/mezuro/licenses.yml.example plugins/mezuro/licenses.yml  
105 -mkdir tmp  
106 -rake db:schema:load  
107 -rake db:migrate  
108 -rake makemo  
109 -./script/sample-data  
110 -./script/noosfero-plugins enable mezuro  
111 -cd public/designs/themes  
112 -rm -f default  
113 -git clone https://git.gitorious.org/mezuro/mezuro-theme.git  
114 -ln -s mezuro-theme/ default  
115 -cd ../../../  
116 -  
117 -#Prepare Mezuro for running functional and unit tests  
118 -rake db:test:prepare  
plugins/mezuro/script/tests/delete_all_kalibro_entries.sh
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -source plugins/mezuro/script/tests/kalibro_scripts.conf  
4 -  
5 -sudo su postgres -c "export PGPASSWORD=$PASSWORD && psql -q -d $DATABASE -f $QUERYFILE"  
plugins/mezuro/script/tests/kalibro_scripts.conf
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -# Definition of constants used in kalibro scripts.  
2 -  
3 -PSQLFILE=/tmp/PostgreSQL.sql  
4 -DATABASE="kalibro_test"  
5 -PASSWORD="kalibro"  
6 -QUERYFILE=/tmp/query  
7 \ No newline at end of file 0 \ No newline at end of file
plugins/mezuro/script/tests/prepare_kalibro_query_file.sh
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -source plugins/mezuro/script/tests/kalibro_scripts.conf  
4 -if ! [ -f $PSQLFILE ]  
5 - then wget http://gitorious.org/kalibro/kalibro/blobs/raw/master/KalibroCore/src/META-INF/PostgreSQL.sql -O $PSQLFILE  
6 -fi  
7 -  
8 -DROPLIMIT="END OF DROP TABLES"  
9 -RANGE=$(grep -n "$DROPLIMIT" $PSQLFILE | cut -d":" -f1)  
10 -START=1  
11 -END=$(($RANGE - 1))  
12 -CUT=$START,$END\!d  
13 -REPLACE="s/DROP TABLE IF EXISTS sequences,/TRUNCATE/"  
14 -  
15 -if [ -f $QUERYFILE ]  
16 - then sudo rm $QUERYFILE  
17 -fi  
18 -  
19 -sed -e "$CUT" -e "$REPLACE" $PSQLFILE > $QUERYFILE  
20 -sudo chown postgres.postgres $QUERYFILE  
21 \ No newline at end of file 0 \ No newline at end of file
plugins/mezuro/script/tests/run_acceptance_tests.sh
@@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -TEST_FILE=$1  
4 -PROFILE=$2  
5 -  
6 -if [ -z "$PROFILE" ]; then  
7 - PROFILE='default'  
8 -fi  
9 -  
10 -# where are your .kalibro dir?  
11 -KALIBRO_HOME='/usr/share/tomcat6/.kalibro'  
12 -  
13 -# create a kalibro test dir  
14 -echo "--> Creating tests directory"  
15 -sudo mkdir $KALIBRO_HOME/tests  
16 -echo "--> Copying test settings"  
17 -sudo cp $KALIBRO_HOME/kalibro_test.settings $KALIBRO_HOME/tests/kalibro.settings  
18 -echo "--> Changing owner of tests directory to tomcat6"  
19 -sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests  
20 -  
21 -# you must restart tomcat6  
22 -#if you are using a tomcat installed from apt-get, for example:  
23 -sudo service tomcat6 restart  
24 -  
25 -#if you are using a tomcat installed a specific dir, for exemple:  
26 -#~/tomcat6/bin/shoutdown.sh  
27 -#~/tomcat6/bin/startup.sh  
28 -  
29 -# run test  
30 -cucumber $TEST_FILE -p $PROFILE  
31 -  
32 -#back to normal mode  
33 -echo "--> Removing tests directory"  
34 -sudo rm -rf $KALIBRO_HOME/tests  
35 -  
36 -# you must restart tomcat6 again  
37 -sudo service tomcat6 restart  
38 -  
39 -#or some thing like that...  
40 -#~/tomcat6/bin/shoutdown.sh  
41 -#~/tomcat6/bin/startup.sh  
42 -  
plugins/mezuro/service.yml.example
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -http://localhost:8080/KalibroService/  
plugins/mezuro/test/features/echo_port_test.rb
@@ -1,90 +0,0 @@ @@ -1,90 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures"  
4 -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures"  
5 -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures"  
6 -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures"  
7 -  
8 -class EchoPortTest < ActiveSupport::TestCase  
9 -  
10 - def setup  
11 - @port = Kalibro::Client::Port.new('Echo')  
12 - address = YAML.load_file("#{Rails.root}/plugins/mezuro/service.yaml")  
13 - address['KalibroService'] = 'KalibroFake'  
14 - @port.service_address=(address);  
15 - end  
16 -  
17 - should 'echo base tool' do  
18 - test BaseToolFixtures.analizo, 'BaseTool' do |base_tool|  
19 - base_tool.name = "echo " + base_tool.name  
20 - end  
21 - end  
22 -  
23 - should 'echo configuration' do  
24 - test ConfigurationFixtures.kalibro_configuration, 'Configuration' do |configuration|  
25 - configuration.name = "echo " + configuration.name  
26 - end  
27 - end  
28 -  
29 - should 'echo metric configuration' do  
30 - test_metric_configuration(MetricConfigurationFixtures.amloc_configuration)  
31 - test_metric_configuration(MetricConfigurationFixtures.sc_configuration)  
32 - end  
33 -  
34 - should 'echo module result' do  
35 - test ModuleResultFixtures.create, 'ModuleResult' do |module_result|  
36 - module_result.module.name = "echo." + module_result.module.name  
37 - end  
38 - end  
39 -  
40 - should 'echo project' do  
41 - test(ProjectFixtures.qt_calculator, 'Project') do |project|  
42 - project.name = "echo " + project.name  
43 - end  
44 - end  
45 -  
46 - should 'echo project result' do  
47 - test(ProjectResultFixtures.qt_calculator, 'ProjectResult') do |project_result|  
48 - project_result.project.name = "echo " + project_result.project.name  
49 - end  
50 - end  
51 -  
52 - should 'echo raw project' do  
53 - project = ProjectFixtures.qt_calculator  
54 - echoed = @port.request(:echo_raw_project, {:project => project.to_hash})[:project]  
55 - project.name = "echo " + project.name  
56 - project.state = nil  
57 - project.error = nil  
58 - assert_equal project, Kalibro::Entities::Project.from_hash(echoed)  
59 - end  
60 -  
61 - should 'work with enums' do  
62 - test_granularity("METHOD", "CLASS")  
63 - test_granularity("CLASS", "PACKAGE")  
64 - test_granularity("PACKAGE", "PACKAGE")  
65 - test_granularity("APPLICATION", "APPLICATION")  
66 - end  
67 -  
68 - private  
69 -  
70 - def test_metric_configuration(fixture)  
71 - test fixture, 'MetricConfiguration' do |metric_configuration|  
72 - metric_configuration.code = "echo_" + metric_configuration.code  
73 - end  
74 - end  
75 -  
76 - def test(fixture, entity_name)  
77 - entity_symbol = entity_name.underscore.to_sym  
78 - request_body = {entity_symbol => fixture.to_hash}  
79 - echoed = @port.request("echo_#{entity_symbol}".to_sym, request_body)[entity_symbol]  
80 - yield fixture  
81 - entity_class = "Kalibro::Entities::#{entity_name}".constantize  
82 - assert_equal fixture, entity_class.from_hash(echoed)  
83 - end  
84 -  
85 - def test_granularity(granularity, parent)  
86 - body = {:granularity => granularity}  
87 - assert_equal parent, @port.request(:infer_parent_granularity, body)[:parent_granularity]  
88 - end  
89 -  
90 -end  
plugins/mezuro/test/fixtures/base_tool_fixtures.rb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -require File.dirname(__FILE__) + '/metric_fixtures'  
2 -  
3 -class BaseToolFixtures  
4 -  
5 - def self.base_tool  
6 - Kalibro::BaseTool.new base_tool_hash  
7 - end  
8 -  
9 - def self.base_tool_hash  
10 - {  
11 - :name => 'Analizo',  
12 - :supported_metric => [  
13 - MetricFixtures.total_cof_hash,  
14 - MetricFixtures.amloc_hash],  
15 - :collector_class_name => "org.analizo.AnalizoMetricCollector"  
16 - }  
17 - end  
18 -  
19 -end  
plugins/mezuro/test/fixtures/configuration_content_fixtures.rb
@@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
1 -class ConfigurationContentFixtures  
2 -  
3 - def self.configuration_content  
4 - MezuroPlugin::ConfigurationContent.new configuration_content_hash  
5 - end  
6 -  
7 - def self.created_configuration_content  
8 - MezuroPlugin::ConfigurationContent.new( {  
9 - :name => 'Sample Configuration',  
10 - :description => 'Kalibro configuration for Java projects.',  
11 - :configuration_id => nil  
12 - } )  
13 - end  
14 -  
15 - def self.configuration_content_hash  
16 - {  
17 - :name => 'Sample Configuration',  
18 - :description => 'Kalibro configuration for Java projects.',  
19 - :configuration_id => "42"  
20 - }  
21 - end  
22 -  
23 -end  
plugins/mezuro/test/fixtures/configuration_fixtures.rb
@@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
1 -require File.dirname(__FILE__) + '/metric_configuration_fixtures'  
2 -  
3 -class ConfigurationFixtures  
4 -  
5 - def self.configuration  
6 - Kalibro::Configuration.new configuration_hash  
7 - end  
8 -  
9 - def self.created_configuration  
10 - Kalibro::Configuration.new({  
11 - :name => 'Created Sample Configuration',  
12 - :description => 'Kalibro configuration for Java projects.'  
13 - })  
14 - end  
15 -  
16 - def self.configuration_hash  
17 - {  
18 - :id => "42",  
19 - :name => 'Sample Configuration',  
20 - :description => 'Kalibro configuration for Java projects.'  
21 - }  
22 - end  
23 -  
24 - def self.all  
25 - [configuration]  
26 - end  
27 -  
28 -end  
plugins/mezuro/test/fixtures/date_metric_result_fixtures.rb
@@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
1 -require File.dirname(__FILE__) + '/metric_result_fixtures'  
2 -  
3 -class DateMetricResultFixtures  
4 -  
5 - def self.date_metric_result  
6 - Kalibro::DateMetricResult.new date_metric_result_hash  
7 - end  
8 -  
9 - def self.date_metric_result_hash  
10 - {  
11 - :date => '2011-10-20T18:26:43.151+00:00',  
12 - :metric_result => MetricResultFixtures.native_metric_result_hash,  
13 - :attributes! =>  
14 - {  
15 - :metric_result =>  
16 - {  
17 - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",  
18 - "xsi:type"=>"kalibro:metricResultXml"  
19 - }  
20 - }  
21 - }  
22 - end  
23 -  
24 - def self.score_history  
25 - result = []  
26 - result << date_metric_result  
27 - newer_date_metric_result = date_metric_result  
28 - newer_date_metric_result.date = '2011-10-25T18:26:43.151+00:00'  
29 - newer_date_metric_result.metric_result.value = 5.0  
30 - result << newer_date_metric_result  
31 - end  
32 -  
33 -end  
plugins/mezuro/test/fixtures/date_module_result_fixtures.rb
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -require File.dirname(__FILE__) + '/module_result_fixtures'  
2 -  
3 -class DateModuleResultFixtures  
4 -  
5 - def self.date_module_result  
6 - Kalibro::DateModuleResult.new date_module_result_hash  
7 - end  
8 -  
9 - def self.date_module_result_hash  
10 - {  
11 - :date => '2011-10-20T18:26:43.151+00:00',  
12 - :module_result => ModuleResultFixtures.module_result_hash,  
13 - :attributes! =>  
14 - {  
15 - :module_result =>  
16 - {  
17 - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",  
18 - "xsi:type"=>"kalibro:moduleResultXml"  
19 - }  
20 - }  
21 - }  
22 - end  
23 -  
24 -end  
plugins/mezuro/test/fixtures/metric_configuration_fixtures.rb
@@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
1 -require File.dirname(__FILE__) + '/metric_fixtures'  
2 -  
3 -class MetricConfigurationFixtures  
4 -  
5 - def self.amloc_metric_configuration  
6 - amloc = Kalibro::MetricConfiguration.new amloc_metric_configuration_hash  
7 - amloc.configuration_id = "13"  
8 - amloc  
9 - end  
10 -  
11 - def self.sc_metric_configuration  
12 - sc = Kalibro::MetricConfiguration.new sc_metric_configuration_hash  
13 - sc.configuration_id = "13"  
14 - sc  
15 - end  
16 -  
17 - def self.created_metric_configuration  
18 - Kalibro::MetricConfiguration.new({  
19 - :code => 'amloc',  
20 - :metric => MetricFixtures.amloc_hash,  
21 - :base_tool_name => "Analizo",  
22 - :weight => "1.0",  
23 - :aggregation_form => 'AVERAGE',  
24 - :reading_group_id => "31",  
25 - :configuration_id => "13"  
26 - })  
27 - end  
28 -  
29 - def self.amloc_metric_configuration_hash  
30 - {  
31 - :id => "42",  
32 - :code => 'amloc',  
33 - :metric => MetricFixtures.amloc_hash,  
34 - :base_tool_name => "Analizo",  
35 - :weight => "1.0",  
36 - :aggregation_form => 'AVERAGE',  
37 - :reading_group_id => "31",  
38 - :attributes! => {:metric => {  
39 - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
40 - 'xsi:type' => 'kalibro:metricXml' }}  
41 - }  
42 - end  
43 -  
44 - def self.sc_metric_configuration_hash  
45 - {  
46 - :id => "42",  
47 - :code => 'sc',  
48 - :metric => MetricFixtures.compound_metric_hash,  
49 - :weight => "1.0",  
50 - :aggregation_form => 'AVERAGE',  
51 - :reading_group_id => "31",  
52 - :attributes! => {:metric => {  
53 - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
54 - 'xsi:type' => 'kalibro:metricXml' }}  
55 - }  
56 - end  
57 -  
58 -end  
plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures.rb
@@ -1,62 +0,0 @@ @@ -1,62 +0,0 @@
1 -require File.dirname(__FILE__) + '/metric_fixtures'  
2 -require File.dirname(__FILE__) + '/range_snapshot_fixtures'  
3 -  
4 -class MetricConfigurationSnapshotFixtures  
5 -  
6 - def self.metric_configuration_snapshot  
7 - Kalibro::MetricConfigurationSnapshot.new metric_configuration_snapshot_hash  
8 - end  
9 -  
10 - def self.metric_configuration_snapshot_hash  
11 - {  
12 - :code => "code",  
13 - :weight => "1.0",  
14 - :aggregation_form => 'AVERAGE',  
15 - :metric => MetricFixtures.amloc_hash,  
16 - :base_tool_name => "Analizo",  
17 - :range => [RangeSnapshotFixtures.range_snapshot_hash],  
18 - :attributes! => {  
19 - :metric => {  
20 - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
21 - 'xsi:type' => 'kalibro:metricXml' },  
22 - :range => {  
23 - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
24 - 'xsi:type' => 'kalibro:rangeSnapshotXml' }  
25 - }  
26 - }  
27 - end  
28 -  
29 - def self.metric_configuration_snapshot_with_2_elements  
30 - Kalibro::MetricConfigurationSnapshot.new metric_configuration_snapshot_hash_with_2_elements  
31 - end  
32 -  
33 - def self.metric_configuration_snapshot_hash_with_2_elements  
34 - hash = self.metric_configuration_snapshot_hash  
35 - hash[:range] << RangeSnapshotFixtures.range_snapshot_hash  
36 - hash  
37 - end  
38 -  
39 - def self.compound_metric_configuration_snapshot  
40 - Kalibro::MetricConfigurationSnapshot.new compound_metric_configuration_snapshot_hash  
41 - end  
42 -  
43 - def self.compound_metric_configuration_snapshot_hash  
44 - {  
45 - :code => "code",  
46 - :weight => "1.0",  
47 - :aggregation_form => 'AVERAGE',  
48 - :metric => MetricFixtures.compound_metric,  
49 - :base_tool_name => "Analizo",  
50 - :range => [RangeSnapshotFixtures.range_snapshot_hash],  
51 - :attributes! => {  
52 - :metric => {  
53 - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
54 - 'xsi:type' => 'kalibro:metricXml' },  
55 - :range => {  
56 - 'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',  
57 - 'xsi:type' => 'kalibro:rangeSnapshotXml' }  
58 - }  
59 - }  
60 - end  
61 -  
62 -end  
plugins/mezuro/test/fixtures/metric_fixtures.rb
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -class MetricFixtures  
2 -  
3 - def self.compound_metric  
4 - Kalibro::Metric.new compound_metric_hash  
5 - end  
6 -  
7 - def self.compound_metric_hash  
8 - {:name => 'Structural Complexity', :compound => "true", :scope => 'CLASS', :script => 'return 42;', :description => 'Calculate the Structural Complexity of the Code'}  
9 - end  
10 -  
11 - def self.total_cof  
12 - Kalibro::Metric.new total_cof_hash  
13 - end  
14 -  
15 - def self.total_cof_hash  
16 - {:name => 'Total Coupling Factor', :compound => "false", :scope => 'SOFTWARE', :language => ['JAVA']}  
17 - end  
18 -  
19 - def self.amloc  
20 - Kalibro::Metric.new amloc_hash  
21 - end  
22 -  
23 - def self.amloc_hash  
24 - {:name => 'Average Method LOC', :compound => "false", :scope => 'CLASS', :language => ['JAVA']}  
25 - end  
26 -  
27 -end  
plugins/mezuro/test/fixtures/metric_result_fixtures.rb
@@ -1,54 +0,0 @@ @@ -1,54 +0,0 @@
1 -require File.dirname(__FILE__) + '/metric_configuration_snapshot_fixtures'  
2 -require File.dirname(__FILE__) + '/throwable_fixtures'  
3 -  
4 -class MetricResultFixtures  
5 -  
6 - def self.native_metric_result  
7 - Kalibro::MetricResult.new native_metric_result_hash  
8 - end  
9 -  
10 - def self.compound_metric_result  
11 - Kalibro::MetricResult.new compound_metric_result_hash  
12 - end  
13 -  
14 - def self.metric_result_with_error_hash  
15 - {  
16 - :id => "41",  
17 - :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash,  
18 - :error => ThrowableFixtures.throwable_hash  
19 - }  
20 - end  
21 -  
22 - def self.native_metric_result_hash  
23 - {  
24 - :id => "42",  
25 - :configuration => MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash,  
26 - :value => "0.0",  
27 - :attributes! =>  
28 - {  
29 - :configuration =>  
30 - {  
31 - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",  
32 - "xsi:type"=>"kalibro:metricConfigurationSnapshotXml"  
33 - }  
34 - }  
35 - }  
36 - end  
37 -  
38 - def self.compound_metric_result_hash  
39 - {  
40 - :id => "43",  
41 - :configuration => MetricConfigurationSnapshotFixtures.compound_metric_configuration_snapshot_hash,  
42 - :value => "1.0",  
43 - :attributes! =>  
44 - {  
45 - :configuration =>  
46 - {  
47 - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",  
48 - "xsi:type"=>"kalibro:metricConfigurationSnapshotXml"  
49 - }  
50 - }  
51 - }  
52 - end  
53 -  
54 -end  
plugins/mezuro/test/fixtures/module_fixtures.rb
@@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
1 -class ModuleFixtures  
2 -  
3 - def self.module  
4 - Kalibro::Module.new module_hash  
5 - end  
6 -  
7 - def self.module_hash  
8 - {  
9 - :name => 'Qt-Calculator',  
10 - :granularity => 'APPLICATION'  
11 - }  
12 - end  
13 -  
14 -end  
plugins/mezuro/test/fixtures/module_result_fixtures.rb
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -require File.dirname(__FILE__) + '/module_fixtures'  
2 -  
3 -class ModuleResultFixtures  
4 -  
5 - def self.module_result  
6 - Kalibro::ModuleResult.new module_result_hash  
7 - end  
8 -  
9 - def self.module_result_hash  
10 - {  
11 - :id => "42",  
12 - :module => ModuleFixtures.module_hash,  
13 - :grade => "10.0",  
14 - :parent_id => "31",  
15 - :attributes! =>  
16 - {  
17 - :module =>  
18 - {  
19 - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",  
20 - "xsi:type"=>"kalibro:moduleXml"  
21 - }  
22 - }  
23 - }  
24 - end  
25 -  
26 - def self.parent_module_result_hash  
27 - {  
28 - :id => "31",  
29 - :module => {  
30 - :name => 'Qt-Calculator Parent',  
31 - :granularity => 'APPLICATION'  
32 - },  
33 - :grade => "10.0",  
34 - :attributes! =>  
35 - {  
36 - :module =>  
37 - {  
38 - "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",  
39 - "xsi:type"=>"kalibro:moduleXml"  
40 - }  
41 - }  
42 - }  
43 - end  
44 -end  
plugins/mezuro/test/fixtures/process_time_fixtures.rb
@@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
1 -class ProcessTimeFixtures  
2 -  
3 - def self.process_time  
4 - Kalibro::ProcessTime.new process_time_hash  
5 - end  
6 -  
7 - def self.process_time_hash  
8 - {:state => "Ready", :time => "1"}  
9 - end  
10 -  
11 -end  
plugins/mezuro/test/fixtures/processing_fixtures.rb
@@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
1 -require File.dirname(__FILE__) + '/process_time_fixtures'  
2 -require File.dirname(__FILE__) + '/throwable_fixtures'  
3 -  
4 -class ProcessingFixtures  
5 -  
6 - def self.processing  
7 - Kalibro::Processing.new processing_hash  
8 - end  
9 -  
10 - def self.processing_hash  
11 - {  
12 - :id => "31",  
13 - :date => '2011-10-20T18:26:43.151+00:00',  
14 - :state => 'READY',  
15 - :process_time => [ProcessTimeFixtures.process_time_hash],  
16 - :results_root_id => "13"  
17 - }  
18 - end  
19 -  
20 - def self.processing_with_error_hash  
21 - {  
22 - :id => "31",  
23 - :date => '2011-10-20T18:26:43.151+00:00',  
24 - :state => 'ERROR',  
25 - :process_time => [ProcessTimeFixtures.process_time_hash],  
26 - :error => ThrowableFixtures.throwable_hash  
27 - }  
28 - end  
29 -  
30 -end  
plugins/mezuro/test/fixtures/project_content_fixtures.rb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -class ProjectContentFixtures  
2 -  
3 - def self.project_content  
4 - content = MezuroPlugin::ProjectContent.new  
5 - content.project_id = 42  
6 - content  
7 - end  
8 -  
9 -end  
plugins/mezuro/test/fixtures/project_fixtures.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require File.dirname(__FILE__) + '/repository_fixtures'  
2 -  
3 -class ProjectFixtures  
4 -  
5 - def self.project  
6 - Kalibro::Project.new project_hash  
7 - end  
8 -  
9 - def self.created_project  
10 - Kalibro::Project.new :name => 'Qt-Calculator', :description => 'Calculator for Qt'  
11 - end  
12 -  
13 - def self.project_hash  
14 - {  
15 - :id => "42",  
16 - :name => 'Qt-Calculator',  
17 - :description => 'Calculator for Qt'  
18 - }  
19 - end  
20 -end  
plugins/mezuro/test/fixtures/range_fixtures.rb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -class RangeFixtures  
2 -  
3 - def self.range  
4 - Kalibro::Range.new range_hash  
5 - end  
6 -  
7 - def self.created_range  
8 - Kalibro::Range.new created_range_hash  
9 - end  
10 -  
11 - def self.created_range_hash  
12 - {:beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1"}  
13 - end  
14 -  
15 - def self.range_hash  
16 - {:id => "1", :beginning => "19.5", :end => "INF", :reading_id => "1", :comments => "Test range 1"}  
17 - end  
18 -  
19 -end  
plugins/mezuro/test/fixtures/range_snapshot_fixtures.rb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -class RangeSnapshotFixtures  
2 -  
3 - def self.range_snapshot  
4 - Kalibro::RangeSnapshot.new range_snapshot_hash  
5 - end  
6 -  
7 - def self.range_snapshot_with_infinite_range  
8 - Kalibro::RangeSnapshot.new range_snapshot_with_infinite_range_hash  
9 - end  
10 -  
11 - def self.range_snapshot_hash  
12 - { :beginning => "1.1", :end => "5.1", :label => "snapshot", :grade => "10.1", :color => "FF2284", :comments => "comment" }  
13 - end  
14 -  
15 - def self.range_snapshot_with_infinite_range_hash  
16 - { :beginning => "-INF", :end => "INF", :label => "snapshot", :grade => "10.1", :color => "FF2284", :comments => "comment" }  
17 - end  
18 -  
19 -end  
plugins/mezuro/test/fixtures/reading_fixtures.rb
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -class ReadingFixtures  
2 -  
3 - def self.reading  
4 - Kalibro::Reading.new reading_hash  
5 - end  
6 -  
7 - def self.created_reading # A created object has no id before being sent to kalibro  
8 - Kalibro::Reading.new :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC", :group_id => "31"  
9 - end  
10 -  
11 - def self.reading_hash  
12 - {:id => "42", :label => "Reading Test Label", :grade => "10.5", :color => "AABBCC", :group_id => "31"}  
13 - end  
14 -  
15 -end  
16 -  
plugins/mezuro/test/fixtures/reading_group_content_fixtures.rb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -class ReadingGroupContentFixtures  
2 -  
3 - def self.reading_group_content  
4 - content = MezuroPlugin::ReadingGroupContent.new  
5 - content.reading_group_id = 42  
6 - content  
7 - end  
8 -  
9 -end  
plugins/mezuro/test/fixtures/reading_group_fixtures.rb
@@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
1 -class ReadingGroupFixtures  
2 -  
3 - def self.reading_group  
4 - Kalibro::ReadingGroup.new reading_group_hash  
5 - end  
6 -  
7 - def self.created_reading_group # A created object has no id before being sent to kalibro  
8 - Kalibro::ReadingGroup.new :name => "Reading Group Test", :description => "Reading group in the fixtures"  
9 - end  
10 -  
11 - def self.reading_group_hash  
12 - {:id => "42", :name => "Reading Group Test", :description => "Reading group in the fixtures"}  
13 - end  
14 -  
15 -end  
plugins/mezuro/test/fixtures/repository_fixtures.rb
@@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
1 -class RepositoryFixtures  
2 -  
3 - def self.repository  
4 - Kalibro::Repository.new repository_hash  
5 - end  
6 -  
7 - def self.created_repository  
8 - Kalibro::Repository.new({  
9 - :name => "test created repository",  
10 - :description => "test description",  
11 - :license => "GPL",  
12 - :process_period => "1",  
13 - :type => 'SUBVERSION',  
14 - :address => 'https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator',  
15 - :configuration_id => "31",  
16 - :project_id => "32"  
17 - })  
18 - end  
19 -  
20 - def self.repository_hash  
21 - {: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"}  
22 - end  
23 -  
24 - def self.types  
25 - ["SUBVERSION", "GIT"]  
26 - end  
27 -  
28 -end  
plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -class StackTraceElementFixtures  
2 -  
3 - def self.stack_trace_element  
4 - Kalibro::StackTraceElement.new stack_trace_element_hash  
5 - end  
6 -  
7 - def self.stack_trace_element_hash  
8 - {  
9 - :declaring_class => 'my.declaring.Class',  
10 - :method_name => 'my method name',  
11 - :file_name => 'MyFile.java',  
12 - :line_number => '42'  
13 - }  
14 - end  
15 -  
16 -end  
plugins/mezuro/test/fixtures/throwable_fixtures.rb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -require File.dirname(__FILE__) + '/stack_trace_element_fixtures'  
2 -  
3 -class ThrowableFixtures  
4 -  
5 - def self.throwable  
6 - Kalibro::Throwable.new throwable_hash  
7 - end  
8 -  
9 - def self.throwable_hash  
10 - {  
11 - :target_string => 'Target String',  
12 - :message => 'Throwable message from ThrowableTest',  
13 - :stack_trace_element => [  
14 - StackTraceElementFixtures.stack_trace_element_hash, StackTraceElementFixtures.stack_trace_element_hash  
15 - ]  
16 - }  
17 - end  
18 -  
19 -end  
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
@@ -1,228 +0,0 @@ @@ -1,228 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures"  
4 -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures"  
5 -require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures"  
6 -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures"  
7 -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures"  
8 -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures"  
9 -  
10 -class MezuroPluginMyprofileControllerTest < ActionController::TestCase  
11 -  
12 - def setup  
13 - @controller = MezuroPluginMyprofileController.new  
14 - @request = ActionController::TestRequest.new  
15 - @response = ActionController::TestResponse.new  
16 - @profile = fast_create(Community)  
17 -  
18 - @base_tool = BaseToolFixtures.base_tool  
19 - @base_tool_hash = BaseToolFixtures.base_tool_hash  
20 - @metric = NativeMetricFixtures.amloc  
21 - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration  
22 - @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash  
23 - @compound_metric_configuration = MetricConfigurationFixtures.sc_metric_configuration  
24 - @compound_metric_configuration_hash = MetricConfigurationFixtures.sc_metric_configuration_hash  
25 - @configuration = ConfigurationFixtures.configuration  
26 - @configuration_hash = ConfigurationFixtures.configuration_hash  
27 -  
28 - Kalibro::Configuration.expects(:all_names).returns([])  
29 - @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name)  
30 - @content.expects(:send_kalibro_configuration_to_service).returns(nil)  
31 - @content.stubs(:solr_save)  
32 - @content.save  
33 -  
34 - @native_hash = @metric_configuration.to_hash.merge({:configuration_name => @metric_configuration.configuration_name})  
35 - @native_hash.delete :attributes!  
36 - @compound_hash = @compound_metric_configuration.to_hash.merge({:configuration_name => @compound_metric_configuration.configuration_name})  
37 - @compound_hash.delete :attributes!  
38 -  
39 - @range = RangeFixtures.range_excellent  
40 - @range_hash = RangeFixtures.range_excellent_hash  
41 - end  
42 -  
43 - should 'test choose base tool' do  
44 - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool_names).returns({:base_tool_name => @base_tool.name})  
45 - get :choose_base_tool, :profile => @profile.identifier, :id => @content.id  
46 - assert_equal [@base_tool.name], assigns(:base_tools)  
47 - assert_equal @content, assigns(:configuration_content)  
48 - assert_response 200  
49 - end  
50 -  
51 - should 'test choose metric' do  
52 - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash})  
53 - get :choose_metric, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name  
54 - assert_equal @content, assigns(:configuration_content)  
55 - assert_equal @base_tool.name, assigns(:base_tool)  
56 - assert_equal @base_tool.supported_metric[0].name, assigns(:supported_metrics)[0].name  
57 - assert_response 200  
58 - end  
59 -  
60 - should 'test new metric configuration' do  
61 - Kalibro::BaseTool.expects(:request).with("BaseTool", :get_base_tool, {:base_tool_name => @base_tool.name}).returns({:base_tool => @base_tool_hash})  
62 - get :new_metric_configuration, :profile => @profile.identifier, :id => @content.id, :base_tool => @base_tool.name, :metric_name => @metric.name  
63 - assert_equal @content, assigns(:configuration_content)  
64 - assert_equal @metric.name, assigns(:metric).name  
65 - assert_response 200  
66 - end  
67 -  
68 -  
69 - should 'test new compound metric configuration' do  
70 - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash})  
71 - get :new_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id  
72 - assert_equal @content, assigns(:configuration_content)  
73 - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code  
74 - assert_response 200  
75 - end  
76 -  
77 - should 'test edit metric configuration' do  
78 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
79 - :configuration_name => @content.name,  
80 - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash})  
81 - get :edit_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name  
82 - assert_equal @content, assigns(:configuration_content)  
83 - assert_equal @metric_configuration.code, assigns(:metric_configuration).code  
84 - assert_equal @metric_configuration.metric.name, assigns(:metric).name  
85 - assert_response 200  
86 - end  
87 -  
88 - should 'test edit compound metric configuration' do  
89 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
90 - :configuration_name => @content.name,  
91 - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash})  
92 - Kalibro::Configuration.expects(:request).with("Configuration", :get_configuration, {:configuration_name => @content.name}).returns({:configuration => @configuration_hash})  
93 - get :edit_compound_metric_configuration,  
94 - :profile => @profile.identifier,  
95 - :id => @content.id,  
96 - :metric_name => @compound_metric_configuration.metric.name  
97 - assert_equal @content, assigns(:configuration_content)  
98 - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code  
99 - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name  
100 - assert_equal @configuration.metric_configuration[0].code, assigns(:metric_configurations)[0].code  
101 - assert_response 200  
102 - end  
103 -  
104 - should 'test create native metric configuration' do  
105 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, {  
106 - :metric_configuration => @metric_configuration.to_hash,  
107 - :configuration_name => @metric_configuration.configuration_name})  
108 - get :create_metric_configuration,  
109 - :profile => @profile.identifier,  
110 - :id => @content.id,  
111 - :metric_configuration => @native_hash  
112 - assert_response 302  
113 - end  
114 -  
115 - should 'test compound metric creation' do  
116 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, {  
117 - :metric_configuration => @compound_metric_configuration.to_hash,  
118 - :configuration_name => @compound_metric_configuration.configuration_name})  
119 - get :create_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id,  
120 - :metric_configuration => @compound_hash  
121 - assert_response 302  
122 - end  
123 -  
124 - should 'test update native metric configuration' do  
125 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
126 - :configuration_name => @content.name,  
127 - :metric_name => @metric_configuration.metric.name}).returns({:metric_configuration => @metric_configuration_hash})  
128 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, {  
129 - :metric_configuration => @metric_configuration.to_hash,  
130 - :configuration_name => @metric_configuration.configuration_name})  
131 - get :update_metric_configuration, :profile => @profile.identifier, :id => @content.id,  
132 - :metric_configuration => @native_hash  
133 - assert_equal @content, assigns(:configuration_content)  
134 - assert_response 302  
135 - end  
136 -  
137 - should 'test update compound metric configuration' do  
138 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
139 - :configuration_name => @content.name,  
140 - :metric_name => @compound_metric_configuration.metric.name}).returns({:metric_configuration => @compound_metric_configuration_hash})  
141 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, {  
142 - :metric_configuration => @compound_metric_configuration.to_hash,  
143 - :configuration_name => @compound_metric_configuration.configuration_name})  
144 - get :update_compound_metric_configuration, :profile => @profile.identifier, :id => @content.id,  
145 - :metric_configuration => @compound_hash  
146 - assert_equal @content, assigns(:configuration_content)  
147 - assert_response 302  
148 - end  
149 -  
150 - should 'test remove metric configuration' do  
151 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
152 - :configuration_name => @content.name,  
153 - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash})  
154 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :remove_metric_configuration, {  
155 - :metric_name => @metric.name,  
156 - :configuration_name => @metric_configuration.configuration_name})  
157 - get :remove_metric_configuration, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name  
158 - assert_response 302  
159 - end  
160 -  
161 - should 'test new range' do  
162 - get :new_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name  
163 - assert_equal @content, assigns(:configuration_content)  
164 - assert_equal @metric.name, assigns(:metric_name)  
165 - assert_response 200  
166 - end  
167 -  
168 - should 'test edit range' do  
169 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
170 - :configuration_name => @content.name,  
171 - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash})  
172 - get :edit_range, :profile => @profile.identifier, :id => @content.id, :metric_name => @metric.name, :beginning_id => @range.beginning  
173 - assert_equal @content, assigns(:configuration_content)  
174 - assert_equal @metric.name, assigns(:metric_name)  
175 - assert_equal @range.beginning, assigns(:beginning_id)  
176 - assert_equal @range.end, assigns(:range).end  
177 - assert_response 200  
178 - end  
179 -  
180 - should 'test create instance range' do  
181 - metric_configuration = @metric_configuration  
182 - metric_configuration.add_range(@range)  
183 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
184 - :configuration_name => @content.name,  
185 - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash})  
186 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, {  
187 - :metric_configuration => metric_configuration.to_hash,  
188 - :configuration_name => metric_configuration.configuration_name})  
189 - get :create_range, :profile => @profile.identifier, :range => @range_hash, :id => @content.id, :metric_name => @metric.name  
190 - assert_equal @content, assigns(:configuration_content)  
191 - assert_equal @range.end, assigns(:range).end  
192 - assert_response 200  
193 - end  
194 -  
195 - should 'test update range' do  
196 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
197 - :configuration_name => @content.name,  
198 - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash})  
199 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, {  
200 - :metric_configuration => @metric_configuration.to_hash,  
201 - :configuration_name => @metric_configuration.configuration_name})  
202 - get :update_range,  
203 - :profile => @profile.identifier,  
204 - :range => @range_hash,  
205 - :id => @content.id,  
206 - :metric_name => @metric.name,  
207 - :beginning_id => @range.beginning  
208 - assert_response 200  
209 - end  
210 -  
211 - should 'test remove range' do  
212 - metric_configuration = @metric_configuration  
213 - metric_configuration.ranges.delete_if { |range| range.beginning == @range.beginning.to_f }  
214 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :get_metric_configuration, {  
215 - :configuration_name => @content.name,  
216 - :metric_name => @metric.name}).returns({:metric_configuration => @metric_configuration_hash})  
217 - Kalibro::MetricConfiguration.expects(:request).with("MetricConfiguration", :save_metric_configuration, {  
218 - :metric_configuration => metric_configuration.to_hash,  
219 - :configuration_name => metric_configuration.configuration_name})  
220 - get :remove_range,  
221 - :profile => @profile.identifier,  
222 - :id => @content.id,  
223 - :metric_name => @metric.name,  
224 - :beginning_id => @range.beginning  
225 - assert_response 302  
226 - end  
227 -  
228 -end  
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
@@ -1,141 +0,0 @@ @@ -1,141 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures"  
4 -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures"  
5 -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures"  
6 -require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures"  
7 -  
8 -class MezuroPluginProfileControllerTest < ActionController::TestCase  
9 -  
10 - def setup  
11 - @controller = MezuroPluginProfileController.new  
12 - @request = ActionController::TestRequest.new  
13 - @response = ActionController::TestResponse.new  
14 - @profile = fast_create(Community)  
15 -  
16 - @project_result = ProjectResultFixtures.project_result  
17 - @module_result = ModuleResultFixtures.module_result  
18 - @repository_url = RepositoryFixtures.repository.address  
19 - @project = @project_result.project  
20 - @date = "2012-04-13T20:39:41+04:00"  
21 -  
22 - Kalibro::Project.expects(:all_names).returns([])  
23 - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @project.name, :repository_url => @repository_url)  
24 - @content.expects(:send_project_to_service).returns(nil)  
25 - @content.save  
26 - end  
27 -  
28 - should 'test project state without kalibro_error' do  
29 - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash})  
30 - get :project_state, :profile => @profile.identifier, :id => @content.id  
31 - assert_response 200  
32 - assert_equal @content, assigns(:content)  
33 - end  
34 -  
35 - should 'test project state with kalibro_error' do  
36 - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})})  
37 - get :project_state, :profile => @profile.identifier, :id => @content.id  
38 - assert_response 200  
39 - assert_equal "ERROR", @response.body  
40 - assert_equal @content, assigns(:content)  
41 - end  
42 -  
43 - should 'test project error' do  
44 - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash.merge({:error => ErrorFixtures.error_hash})})  
45 - get :project_error, :profile => @profile.identifier, :id => @content.id  
46 - assert_response 200  
47 - assert_select('h3', 'ERROR')  
48 - assert_equal @content, assigns(:content)  
49 - assert_equal @project.name, assigns(:project).name  
50 - end  
51 -  
52 - should 'test project result without date' do  
53 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash})  
54 - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => nil  
55 - assert_equal @content, assigns(:content)  
56 - assert_equal @project_result.project.name, assigns(:project_result).project.name  
57 - assert_response 200  
58 - assert_select('h4', 'Last Result')  
59 - end  
60 -  
61 - should 'test project results from a specific date' do  
62 - request_body = {:project_name => @project.name, :date => @date}  
63 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true})  
64 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash})  
65 - get :project_result, :profile => @profile.identifier, :id => @content.id, :date => @date  
66 - assert_equal @content, assigns(:content)  
67 - assert_equal @project_result.project.name, assigns(:project_result).project.name  
68 - assert_response 200  
69 - assert_select('h4', 'Last Result')  
70 - end  
71 -  
72 -  
73 - should 'get module result without date' do  
74 - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date)  
75 - Kalibro::ProjectResult.expects(:request).  
76 - with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).  
77 - returns({:project_result => @project_result.to_hash})  
78 - Kalibro::ModuleResult.expects(:request).  
79 - with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}).  
80 - returns({:module_result => @module_result.to_hash})  
81 - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil  
82 - assert_equal @content, assigns(:content)  
83 - assert_equal @module_result.grade, assigns(:module_result).grade  
84 - assert_response 200  
85 - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)')  
86 - end  
87 -  
88 - should 'get module result with a specific date' do  
89 - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date)  
90 - request_body = {:project_name => @project.name, :date => @project_result.date}  
91 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true})  
92 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash})  
93 - 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})  
94 - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date  
95 - assert_equal @content, assigns(:content)  
96 - assert_equal @module_result.grade, assigns(:module_result).grade  
97 - assert_response 200  
98 - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)')  
99 - end  
100 -  
101 - should 'test project tree without date' do  
102 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash})  
103 - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash})  
104 - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil  
105 - assert_equal @content, assigns(:content)  
106 - assert_equal @project.name, assigns(:project_name)  
107 - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name  
108 - assert_response 200  
109 - assert_select('h2', /Qt-Calculator/)  
110 - end  
111 -  
112 - should 'test project tree with a specific date' do  
113 - request_body = {:project_name => @project.name, :date => @project_result.date}  
114 - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash})  
115 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true})  
116 - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash})  
117 - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date  
118 - assert_equal @content, assigns(:content)  
119 - assert_equal @project.name, assigns(:project_name)  
120 - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name  
121 - assert_response 200  
122 - end  
123 -  
124 - should 'test module metrics history' do  
125 - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result})  
126 - get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name,  
127 - :metric_name => @module_result.metric_result.first.metric.name.delete("() ")  
128 - assert_equal @content, assigns(:content)  
129 - assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history)  
130 - assert_response 200  
131 - end  
132 -  
133 - should 'test grade history' do  
134 - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result})  
135 - get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name  
136 - assert_equal @content, assigns(:content)  
137 - assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history)  
138 - assert_response 200  
139 - end  
140 -  
141 -end  
plugins/mezuro/test/functional/myprofile/mezuro_plugin_metric_configuration_controller_test.rb
@@ -1,123 +0,0 @@ @@ -1,123 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures"  
4 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures"  
5 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures"  
6 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures"  
7 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures"  
8 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures"  
9 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures"  
10 -  
11 -class MezuroPluginMetricConfigurationControllerTest < ActionController::TestCase  
12 -  
13 - def setup  
14 - @controller = MezuroPluginMetricConfigurationController.new  
15 - @request = ActionController::TestRequest.new  
16 - @response = ActionController::TestResponse.new  
17 - @profile = fast_create(Profile)  
18 -  
19 - @configuration = ConfigurationFixtures.configuration  
20 - @created_configuration = ConfigurationFixtures.created_configuration  
21 - @configuration_hash = ConfigurationFixtures.configuration_hash  
22 -  
23 - @configuration_content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name, :configuration_id => 42)  
24 - @configuration_content.expects(:send_configuration_to_service).returns(nil)  
25 - @configuration_content.expects(:validate_configuration_name).returns(true)  
26 - @configuration_content.save  
27 -  
28 - @base_tool = BaseToolFixtures.base_tool  
29 - @base_tool_hash = BaseToolFixtures.base_tool_hash  
30 -  
31 - @metric = MetricFixtures.amloc  
32 -  
33 - @reading_group = ReadingGroupFixtures.reading_group  
34 - @range = RangeFixtures.range  
35 - @reading = ReadingFixtures.reading  
36 -  
37 - @native_metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration  
38 - @native_metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash  
39 - @created_metric_configuration = MetricConfigurationFixtures.created_metric_configuration  
40 - @compound_metric_configuration = MetricConfigurationFixtures.sc_metric_configuration  
41 - @compound_metric_configuration_hash = MetricConfigurationFixtures.sc_metric_configuration_hash  
42 - end  
43 -  
44 - should 'choose metric' do  
45 - Kalibro::BaseTool.expects(:all).returns([@base_tool])  
46 - get :choose_metric, :profile => @profile.identifier, :id => @configuration_content.id  
47 - assert_equal @configuration_content, assigns(:configuration_content)  
48 - assert_equal [@base_tool], assigns(:base_tools)  
49 - assert_response :success  
50 - end  
51 -  
52 - should 'initialize native' do  
53 - Kalibro::BaseTool.expects(:find_by_name).with(@base_tool.name).returns(@base_tool)  
54 - Kalibro::ReadingGroup.expects(:all).returns([@reading_group])  
55 - get :new_native, :profile => @profile.identifier, :id => @configuration_content.id, :base_tool_name => @base_tool.name, :metric_name => @metric.name  
56 - assert_equal @configuration_content, assigns(:configuration_content)  
57 - assert_equal @metric.name, assigns(:metric).name  
58 - assert_equal @base_tool.name, assigns(:metric_configuration).base_tool_name  
59 - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids)  
60 - assert_response :success  
61 - end  
62 -  
63 - should 'edit native' do  
64 - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@native_metric_configuration])  
65 - Kalibro::ReadingGroup.expects(:all).returns([@reading_group])  
66 - Kalibro::Range.expects(:ranges_of).with(@native_metric_configuration.id).returns([@range])  
67 - Kalibro::Reading.expects(:find).with(@range.reading_id).returns(@reading)  
68 - get :edit_native, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @native_metric_configuration.id  
69 - assert_equal @configuration_content, assigns(:configuration_content)  
70 - assert_equal @native_metric_configuration.code, assigns(:metric_configuration).code  
71 - assert_equal @native_metric_configuration.metric.name, assigns(:metric).name  
72 - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids)  
73 - assert_equal [@range], assigns(:ranges)  
74 - assert_response :success  
75 - end  
76 -  
77 - should 'initialize compound' do  
78 - Kalibro::ReadingGroup.expects(:all).returns([@reading_group])  
79 - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration_content.configuration_id).returns([@compound_metric_configuration])  
80 - get :new_compound, :profile => @profile.identifier, :id => @configuration_content.id  
81 - assert_equal @configuration_content, assigns(:configuration_content)  
82 - assert_equal @compound_metric_configuration.code, assigns(:metric_configurations).first.code  
83 - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids)  
84 - assert_response :success  
85 - end  
86 -  
87 - should 'edit compound' do  
88 - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@compound_metric_configuration])  
89 - Kalibro::ReadingGroup.expects(:all).returns([@reading_group])  
90 - Kalibro::Range.expects(:ranges_of).with(@compound_metric_configuration.id).returns([@range])  
91 - Kalibro::Reading.expects(:find).with(@range.reading_id).returns(@reading)  
92 - get :edit_compound, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @compound_metric_configuration.id  
93 - assert_equal @configuration_content, assigns(:configuration_content)  
94 - assert_equal @compound_metric_configuration.code, assigns(:metric_configuration).code  
95 - assert_equal @compound_metric_configuration.metric.name, assigns(:metric).name  
96 - assert_equal [@compound_metric_configuration], assigns(:metric_configurations)  
97 - assert_equal [[@reading_group.name,@reading_group.id]], assigns(:reading_group_names_and_ids)  
98 - assert_equal [@range], assigns(:ranges)  
99 - assert_response :success  
100 - end  
101 -  
102 - should 'create' do  
103 - Kalibro::MetricConfiguration.expects(:create).returns(@compound_metric_configuration) #FIXME need .with(some_hash), should it mock the request?.  
104 - get :create, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration => @compound_metric_configuration_hash  
105 - assert_response :redirect  
106 - end  
107 -  
108 - should 'update' do  
109 - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration_content.configuration_id).returns([@native_metric_configuration])  
110 - @native_metric_configuration.expects(:update_attributes).returns(true) #FIXME need .with(some_hash), should it mock the request?.  
111 - get :update, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration => @native_metric_configuration_hash  
112 - assert_equal @configuration_content, assigns(:configuration_content)  
113 - assert_response :redirect  
114 - end  
115 -  
116 - should 'remove' do  
117 - Kalibro::MetricConfiguration.expects(:new).with({:id => @native_metric_configuration.id}).returns(@native_metric_configuration)  
118 - @native_metric_configuration.expects(:destroy).returns()  
119 - get :remove, :profile => @profile.identifier, :id => @configuration_content.id, :metric_configuration_id => @native_metric_configuration.id  
120 - assert_response :redirect  
121 - end  
122 -  
123 -end  
plugins/mezuro/test/functional/myprofile/mezuro_plugin_range_controller_test.rb
@@ -1,83 +0,0 @@ @@ -1,83 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures"  
4 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures"  
5 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures"  
6 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_fixtures"  
7 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures"  
8 -  
9 -class MezuroPluginRangeControllerTest < ActionController::TestCase  
10 -  
11 - def setup  
12 - @controller = MezuroPluginRangeController.new  
13 - @request = ActionController::TestRequest.new  
14 - @response = ActionController::TestResponse.new  
15 - @profile = fast_create(Profile)  
16 -  
17 - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration  
18 - @metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash  
19 - @configuration = ConfigurationFixtures.configuration  
20 -  
21 - @content = MezuroPlugin::ConfigurationContent.new(:profile => @profile, :name => @configuration.name, :configuration_id => 42)  
22 - @content.expects(:send_configuration_to_service).returns(nil)  
23 - @content.expects(:validate_configuration_name).returns(true)  
24 - @content.save  
25 -  
26 - @created_range = RangeFixtures.created_range  
27 - @range = RangeFixtures.range  
28 - @created_range_hash = RangeFixtures.created_range_hash  
29 - @range_hash = RangeFixtures.range_hash  
30 -  
31 - @reading = ReadingFixtures.reading  
32 - end  
33 -  
34 - should 'set correct attributes to create a new range' do  
35 - Kalibro::Reading.expects(:readings_of).with(@metric_configuration.reading_group_id).returns([@reading])  
36 - 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  
37 - assert_equal @content.id, assigns(:content_id)  
38 - assert_equal @metric_configuration.id, assigns(:metric_configuration_id)  
39 - assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids)  
40 - assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id)  
41 - assert_equal @metric_configuration.metric.compound, assigns(:compound)  
42 - assert_response :success  
43 - end  
44 -  
45 - should 'set correct attributes to edit a range' do  
46 - Kalibro::Reading.expects(:readings_of).with(@metric_configuration.reading_group_id).returns([@reading])  
47 - Kalibro::Range.expects(:ranges_of).with(@metric_configuration.id).returns([@range])  
48 - 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  
49 - assert_equal @content.id, assigns(:content_id)  
50 - assert_equal @metric_configuration.id, assigns(:metric_configuration_id)  
51 - assert_equal [[@reading.label,@reading.id]], assigns(:reading_labels_and_ids)  
52 - assert_equal @range, assigns(:range)  
53 - assert_response :success  
54 - end  
55 -  
56 - should 'test create instance range' do  
57 - Kalibro::Range.expects(:request).with(:save_range, {  
58 - :metric_configuration_id => @metric_configuration.id,  
59 - :range => @created_range.to_hash}).returns(:range_id => @range.id)  
60 - Kalibro::Reading.expects(:find).with(@created_range.reading_id).returns(@reading)  
61 - 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  
62 - assert_equal @range.id, assigns(:range).id  
63 - assert_equal @metric_configuration.reading_group_id, assigns(:reading_group_id)  
64 - assert_equal @metric_configuration.metric.compound, assigns(:compound)  
65 - assert_response :success  
66 - end  
67 -  
68 - should 'test update range' do  
69 - Kalibro::Range.expects(:request).with(:save_range, {  
70 - :metric_configuration_id => @metric_configuration.id,  
71 - :range => @range.to_hash}).returns(:range_id => @range.id)  
72 - get :update, :profile => @profile.identifier, :range => @range_hash, :metric_configuration_id => @metric_configuration.id  
73 - assert_equal @range.id, assigns(:range).id  
74 - assert_response :success  
75 - end  
76 -  
77 - should 'test remove range in native metric configuration' do  
78 - Kalibro::Range.expects(:new).with({:id => @range.id}).returns(@range)  
79 - @range.expects(:destroy).with().returns()  
80 - get :remove, :profile => @profile.identifier, :id => @content.id, :metric_configuration_id => @metric_configuration.id, :range_id => @range.id, :compound => false  
81 - assert_response :redirect  
82 - end  
83 -end  
plugins/mezuro/test/functional/myprofile/mezuro_plugin_reading_controller_test.rb
@@ -1,83 +0,0 @@ @@ -1,83 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures"  
4 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_content_fixtures"  
5 -  
6 -class MezuroPluginReadingControllerTest < ActionController::TestCase  
7 -  
8 - def setup  
9 - @controller = MezuroPluginReadingController.new  
10 - @request = ActionController::TestRequest.new  
11 - @response = ActionController::TestResponse.new  
12 - @profile = fast_create(Profile)  
13 -  
14 - @reading = ReadingFixtures.reading  
15 - @created_reading = ReadingFixtures.created_reading  
16 - @reading_hash = ReadingFixtures.hash  
17 - @content = MezuroPlugin::ReadingGroupContent.new(:profile => @profile, :name => name)  
18 - @content.expects(:send_reading_group_to_service).returns(nil)  
19 - @content.save  
20 - end  
21 -  
22 - should 'set variables to create a new reading' do  
23 - parser = "|*|"  
24 - Kalibro::Reading.expects(:readings_of).with(@content.reading_group_id).returns([@reading])  
25 - get :new, :profile => @profile.identifier, :id => @content.id  
26 - assert_equal parser, assigns(:parser)  
27 - assert_equal ["#{@reading.label}#{parser}#{@reading.grade}#{parser}"], assigns(:labels_and_grades)  
28 - assert_equal @content.id, assigns(:reading_group_content).id  
29 - assert_response :success  
30 - end  
31 -  
32 - should 'create a reading' do  
33 - Kalibro::Reading.expects(:new).with(@reading_hash.to_s).returns(@created_reading)  
34 - @created_reading.expects(:save).with(@content.reading_group_id).returns(true)  
35 - get :save, :profile => @profile.identifier, :id => @content.id, :reading => @reading_hash  
36 - assert @created_reading.errors.empty?  
37 - assert_response :redirect  
38 - end  
39 -  
40 - should 'put an Exception in reading when an error occurs in create action' do  
41 - @created_reading.errors = [Exception.new]  
42 - Kalibro::Reading.expects(:new).with(@reading_hash.to_s).returns(@created_reading)  
43 - @created_reading.expects(:save).with(@content.reading_group_id).returns(false)  
44 - get :save, :profile => @profile.identifier, :id => @content.id, :reading => @reading_hash  
45 - assert !@created_reading.errors.empty?  
46 - assert_response :redirect  
47 - end  
48 -  
49 - should 'set variables to edit a reading' do  
50 - parser = "|*|"  
51 - another_reading = ReadingFixtures.reading  
52 - another_reading.id = 10  
53 - Kalibro::Reading.expects(:readings_of).with(@content.reading_group_id).returns([@reading, another_reading])  
54 - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading)  
55 - get :edit, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id  
56 - assert_equal @content.id, assigns(:reading_group_content).id  
57 - assert_equal @reading, assigns(:reading)  
58 - assert_equal parser, assigns(:parser)  
59 - assert_equal ["#{another_reading.label}#{parser}#{another_reading.grade}#{parser}"], assigns(:labels_and_grades)  
60 - assert_response :success  
61 - end  
62 -  
63 - should 'destroy a reading' do  
64 - @reading.expects(:destroy)  
65 - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading)  
66 -  
67 - get :destroy, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id  
68 -  
69 - assert @reading.errors.empty?  
70 - assert_response :redirect  
71 - end  
72 -  
73 - should 'put an Exception in reading when an error occurs in destroy action' do  
74 - @reading.errors = [Exception.new]  
75 - @reading.expects(:destroy)  
76 - Kalibro::Reading.expects(:find).with(@reading.id.to_s).returns(@reading)  
77 -  
78 - get :destroy, :profile => @profile.identifier, :id => @content.id, :reading_id => @reading.id  
79 -  
80 - assert !@reading.errors.empty?  
81 - assert_response :redirect  
82 - end  
83 -end  
plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
@@ -1,58 +0,0 @@ @@ -1,58 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures"  
4 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_result_fixtures"  
5 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_metric_result_fixtures"  
6 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_module_result_fixtures"  
7 -  
8 -class MezuroPluginModuleResultControllerTest < ActionController::TestCase  
9 -  
10 - def setup  
11 - @controller = MezuroPluginModuleResultController.new  
12 - @request = ActionController::TestRequest.new  
13 - @response = ActionController::TestResponse.new  
14 - @profile = fast_create(Community)  
15 -  
16 - @module_result_hash = ModuleResultFixtures.module_result_hash  
17 - @metric_result_hash = MetricResultFixtures.native_metric_result_hash  
18 - @date_metric_result_hash = DateMetricResultFixtures.date_metric_result_hash  
19 - @date_module_result_hash = DateModuleResultFixtures.date_module_result_hash  
20 - end  
21 -  
22 - should 'find module result on kalibro' do  
23 - parent_module_result = ModuleResultFixtures.parent_module_result_hash  
24 - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:id].to_i }).  
25 - returns({:module_result => @module_result_hash})  
26 - Kalibro::MetricResult.expects(:request).with(:metric_results_of, { :module_result_id => @module_result_hash[:id].to_i }).  
27 - returns({:metric_result => @metric_result_hash})  
28 - Kalibro::ModuleResult.expects(:request).with(:get_module_result, { :module_result_id => @module_result_hash[:parent_id].to_i }).  
29 - returns({:module_result => parent_module_result})  
30 - Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result_hash[:id].to_i}).  
31 - returns({:module_result => nil})  
32 - get :module_result, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id]  
33 - assert_equal @module_result_hash[:grade].to_f, assigns(:module_result).grade  
34 - assert_equal @metric_result_hash[:value].to_f, assigns(:metric_results).first.value  
35 - assert_response :success  
36 - #TODO assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)')  
37 - end  
38 -  
39 - should 'get metric result history' do  
40 - metric_name = @metric_result_hash[:configuration][:metric][:name]  
41 - Kalibro::MetricResult.expects(:request).with(:history_of_metric, { :metric_name => metric_name, :module_result_id => @module_result_hash[:id].to_i }).  
42 - returns({:date_metric_result => @date_metric_result_hash})  
43 - get :metric_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id], :metric_name => metric_name  
44 - assert_equal DateTime.parse(@date_metric_result_hash[:date]), assigns(:history).first.date  
45 - assert_response :success  
46 - #TODO assert_select  
47 - end  
48 -  
49 - should 'get module result history' do  
50 - Kalibro::ModuleResult.expects(:request).with(:history_of_module, { :module_result_id => @module_result_hash[:id].to_i }).  
51 - returns({:date_module_result => @date_module_result_hash})  
52 - get :module_result_history, :profile => @profile.identifier, :module_result_id => @module_result_hash[:id]  
53 - assert_equal DateTime.parse(@date_module_result_hash[:date]), assigns(:history).first.date  
54 - assert_response :success  
55 - #TODO assert_select  
56 - end  
57 -  
58 -end  
plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb
@@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures"  
4 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures"  
5 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures"  
6 -  
7 -  
8 -class MezuroPluginProcessingControllerTest < ActionController::TestCase  
9 - def setup  
10 - @controller = MezuroPluginProcessingController.new  
11 - @request = ActionController::TestRequest.new  
12 - @response = ActionController::TestResponse.new  
13 - @profile = fast_create(Community)  
14 -  
15 - @repository_id = RepositoryFixtures.repository.id  
16 - @processing = ProcessingFixtures.processing  
17 - @processing_hash = ProcessingFixtures.processing_hash  
18 - @processing_with_error_hash = ProcessingFixtures.processing_with_error_hash  
19 - end  
20 -  
21 - should 'render last processing state' do  
22 - Kalibro::Processing.expects(:processing_of).with(@repository_id).returns(@processing)  
23 - get :state, :profile => @profile.identifier, :repository_id => @repository_id  
24 - assert_response :success  
25 - assert_equal @processing.state, @response.body  
26 - end  
27 -  
28 - should 'render a processing state in a specific date' do  
29 - Kalibro::Processing.expects(:processing_with_date_of).with(@repository_id, @processing.date).returns(@processing)  
30 - get :state, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date  
31 - assert_response :success  
32 - assert_equal @processing.state, @response.body  
33 - end  
34 -  
35 - should 'render processing with error' do  
36 - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => false})  
37 - Kalibro::Processing.expects(:request).with(:last_processing, :repository_id => @repository_id).returns({:processing => @processing_with_error_hash})  
38 - get :processing, :profile => @profile.identifier, :repository_id => @repository_id  
39 - assert_response :success  
40 - assert_equal @processing_with_error_hash[:state], assigns(:processing).state  
41 - #TODO How to assert from view? assert_select('h3', 'ERROR')  
42 - end  
43 -  
44 - should 'test project result without date' do  
45 - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => true})  
46 - Kalibro::Processing.expects(:request).with(:last_ready_processing, {:repository_id => @repository_id}).returns({:processing => @processing_hash})  
47 - get :processing, :profile => @profile.identifier, :repository_id => @repository_id  
48 - assert_response :success  
49 - assert_select('h4', 'Last Result')  
50 - end  
51 -  
52 - should 'test project results from a specific date' do  
53 - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => @repository_id, :date => @processing.date}).returns({:exists => true})  
54 - Kalibro::Processing.expects(:request).with(:first_processing_after, :repository_id => @repository_id, :date => @processing.date).returns({:processing => @processing_hash})  
55 - get :processing, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date  
56 - assert_response :success  
57 - assert_select('h4', 'Last Result')  
58 - end  
59 -  
60 -end  
plugins/mezuro/test/functional/profile/mezuro_plugin_repository_controller_test.rb
@@ -1,103 +0,0 @@ @@ -1,103 +0,0 @@
1 -require 'test_helper'  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures"  
4 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures"  
5 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures"  
6 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_content_fixtures"  
7 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures"  
8 -  
9 -class MezuroPluginRepositoryControllerTest < ActionController::TestCase  
10 -  
11 - def setup  
12 - @controller = MezuroPluginRepositoryController.new  
13 - @request = ActionController::TestRequest.new  
14 - @response = ActionController::TestResponse.new  
15 - @profile = fast_create(Community)  
16 -  
17 - @configuration = ConfigurationFixtures.configuration  
18 - @repository_types = RepositoryFixtures.types  
19 - @all_configurations = ConfigurationFixtures.all  
20 - @repository = RepositoryFixtures.repository  
21 - @repository_hash = RepositoryFixtures.hash  
22 - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => name)  
23 - @content.expects(:send_project_to_service).returns(nil)  
24 - @content.save  
25 - end  
26 -  
27 - should 'set variables to create a new repository' do  
28 - Kalibro::Repository.expects(:repository_types).returns(@repository_types)  
29 - Kalibro::Configuration.expects(:all).returns(@all_configurations)  
30 -  
31 - get :new, :profile => @profile.identifier, :id => @content.id  
32 -  
33 - assert_equal @content.id, assigns(:project_content).id  
34 - assert_equal @repository_types, assigns(:repository_types)  
35 - assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first  
36 - assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last  
37 - assert_response :success  
38 - end  
39 -  
40 - should 'save a repository' do  
41 - Kalibro::Repository.expects(:new).returns(@repository)  
42 - @repository.expects(:save).with(@content.project_id).returns(true)  
43 - @repository.expects(:process)  
44 - get :save, :profile => @profile.identifier, :id => @content.id, :repository => @repository_hash  
45 - assert @repository.errors.empty?  
46 - assert_response :redirect  
47 - end  
48 -  
49 - should 'not save a repository' do  
50 - @repository.errors = [Exception.new]  
51 - Kalibro::Repository.expects(:new).returns(@repository)  
52 - @repository.expects(:save).with(@content.project_id).returns(false)  
53 - get :save, :profile => @profile.identifier, :id => @content.id, :repository => @repository_hash  
54 - assert !@repository.errors.empty?  
55 - assert_response :redirect  
56 - end  
57 -  
58 - should 'set variables to edit a repository' do  
59 - Kalibro::Repository.expects(:repository_types).returns(@repository_types)  
60 - Kalibro::Configuration.expects(:all).returns(@all_configurations)  
61 - Kalibro::Repository.expects(:repositories_of).with(@content.project_id).returns([@repository])  
62 -  
63 - get :edit, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id  
64 -  
65 - assert_equal @content.id, assigns(:project_content).id  
66 - assert_equal @repository_types, assigns(:repository_types)  
67 - assert_equal @all_configurations.first.name, assigns(:configuration_select).first.first  
68 - assert_equal @all_configurations.first.id, assigns(:configuration_select).first.last  
69 - assert_equal @repository, assigns(:repository)  
70 - assert_response :success  
71 - end  
72 -  
73 - should 'set variables to show a repository' do  
74 - Kalibro::Repository.expects(:repositories_of).with(@content.project_id).returns([@repository])  
75 - Kalibro::Configuration.expects(:find).with(@repository.configuration_id).returns(@configuration)  
76 -  
77 - get :show, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id  
78 -  
79 - assert_equal @content.id, assigns(:project_content).id  
80 - assert_equal @repository, assigns(:repository)  
81 - assert_equal @configuration.name, assigns(:configuration_name)  
82 - assert_response :success  
83 - end  
84 -  
85 - should 'destroy a repository' do  
86 - Kalibro::Repository.expects(:new).with(:id => @repository.id.to_s).returns(@repository)  
87 - @repository.expects(:destroy)  
88 - get :destroy, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id  
89 -  
90 - assert @repository.errors.empty?  
91 - assert_response :redirect  
92 - end  
93 -  
94 - should 'not destroy a repository' do  
95 - @repository.errors = [Exception.new]  
96 - Kalibro::Repository.expects(:new).with(:id => @repository.id.to_s).returns(@repository)  
97 - @repository.expects(:destroy)  
98 - get :destroy, :profile => @profile.identifier, :id => @content.id, :repository_id => @repository.id  
99 -  
100 - #TODO verify if it is redirected to the right page  
101 - assert_response :redirect  
102 - end  
103 -end  
plugins/mezuro/test/unit/kalibro/base_tool_test.rb
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -require "test_helper"  
2 -require "#{Rails.root}/plugins/mezuro/test/fixtures/base_tool_fixtures"  
3 -  
4 -class BaseToolTest < ActiveSupport::TestCase  
5 -  
6 - def setup  
7 - @hash = BaseToolFixtures.base_tool_hash  
8 - @base_tool = BaseToolFixtures.base_tool  
9 - end  
10 -  
11 - should 'create base tool from hash' do  
12 - assert_equal @hash[:name], Kalibro::BaseTool.new(@hash).name  
13 - end  
14 -  
15 - should 'get base tool names' do  
16 - names = ['Analizo', 'Checkstyle']  
17 - Kalibro::BaseTool.expects(:request).with(:all_base_tool_names).returns({:base_tool_name => names})  
18 - assert_equal names, Kalibro::BaseTool.all_names  
19 - end  
20 -  
21 - should 'get base tool by name' do  
22 - request_body = {:base_tool_name => @base_tool.name}  
23 - Kalibro::BaseTool.expects(:request).with(:get_base_tool, request_body).returns({:base_tool => @hash})  
24 - assert_equal @base_tool.name, Kalibro::BaseTool.find_by_name(@base_tool.name).name  
25 - end  
26 -  
27 -end  
plugins/mezuro/test/unit/kalibro/compound_metric_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_fixtures"  
4 -  
5 -class CompoundMetricTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = CompoundMetricFixtures.compound_metric_hash  
9 - @metric = CompoundMetricFixtures.compound_metric  
10 - end  
11 -  
12 - should 'create compound metric from hash' do  
13 - assert_equal @hash[:script], Kalibro::CompoundMetric.new(@hash).script  
14 - end  
15 -  
16 - should 'convert compound metric to hash' do  
17 - assert_equal @hash, @metric.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/compound_metric_with_error_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/compound_metric_with_error_fixtures"  
4 -  
5 -class CompoundMetricWithErrorTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = CompoundMetricWithErrorFixtures.compound_metric_with_error_hash  
9 - @compound_metric_with_error = CompoundMetricWithErrorFixtures.compound_metric_with_error  
10 - end  
11 -  
12 - should 'create error from hash' do  
13 - assert_equal @hash[:error][:message], Kalibro::CompoundMetricWithError.new(@hash).error.message  
14 - end  
15 -  
16 - should 'convert error to hash' do  
17 - assert_equal @hash, @compound_metric_with_error.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/configuration_test.rb
@@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures"  
4 -  
5 -class ConfigurationTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ConfigurationFixtures.configuration_hash  
9 - @configuration = ConfigurationFixtures.configuration  
10 - @created_configuration = ConfigurationFixtures.created_configuration  
11 - end  
12 -  
13 - should 'initialize configuration' do  
14 - assert_equal @hash[:name], Kalibro::Configuration.new(@hash).name  
15 - end  
16 -  
17 - should 'convert configuration to hash' do  
18 - assert_equal @hash, @configuration.to_hash  
19 - end  
20 -  
21 - should 'answer if configuration exists in kalibro' do  
22 - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => true})  
23 - assert Kalibro::Configuration.exists?(@configuration.id)  
24 - end  
25 -  
26 - should 'find a configuration' do  
27 - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => true})  
28 - Kalibro::Configuration.expects(:request).with(:get_configuration, {:configuration_id => @configuration.id}).returns(:configuration => @hash)  
29 - assert_equal @hash[:name], Kalibro::Configuration.find(@configuration.id).name  
30 - end  
31 -  
32 - should 'return exception when configuration doesnt exist' do  
33 - Kalibro::Configuration.expects(:request).with(:configuration_exists, {:configuration_id => @configuration.id}).returns({:exists => false})  
34 - assert_raise(Kalibro::Errors::RecordNotFound){Kalibro::Configuration.find(@configuration.id)}  
35 - end  
36 -  
37 - should 'get all configurations' do  
38 - Kalibro::Configuration.expects(:request).with(:all_configurations).returns({:configuration => [@hash]})  
39 - assert_equal @hash[:name], Kalibro::Configuration.all.first.name  
40 - end  
41 -  
42 - should 'return true when configuration is saved successfully' do  
43 - id_from_kalibro = 1  
44 - Kalibro::Configuration.expects(:request).with(:save_configuration, {:configuration => @created_configuration.to_hash}).returns(:configuration_id => id_from_kalibro)  
45 - assert @created_configuration.save  
46 - assert_equal id_from_kalibro, @created_configuration.id  
47 - end  
48 -  
49 - should 'return false when configuration is not saved successfully' do  
50 - Kalibro::Configuration.expects(:request).with(:save_configuration, {:configuration => @created_configuration.to_hash}).raises(Exception.new)  
51 - assert !(@created_configuration.save)  
52 - assert_nil @created_configuration.id  
53 - end  
54 -  
55 - should 'remove existent configuration from service' do  
56 - Kalibro::Configuration.expects(:request).with(:delete_configuration, {:configuration_id => @configuration.id})  
57 - @configuration.destroy  
58 - end  
59 -  
60 -end  
plugins/mezuro/test/unit/kalibro/date_metric_result_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_metric_result_fixtures"  
4 -  
5 -class DateMetricResultTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = DateMetricResultFixtures.date_metric_result_hash  
9 - @date_metric_result = DateMetricResultFixtures.date_metric_result  
10 - end  
11 -  
12 - should 'create date_metric_result from hash' do  
13 - assert_equal @hash[:metric_result][:id].to_i, Kalibro::DateMetricResult.new(@hash).metric_result.id  
14 - end  
15 -  
16 - should 'convert date_metric_result to hash' do  
17 - assert_equal @hash, @date_metric_result.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/date_module_result_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/date_module_result_fixtures"  
4 -  
5 -class DateModuleResultTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = DateModuleResultFixtures.date_module_result_hash  
9 - @date_module_result = DateModuleResultFixtures.date_module_result  
10 - end  
11 -  
12 - should 'create date_module_result from hash' do  
13 - assert_equal @hash[:module_result][:id].to_i, Kalibro::DateModuleResult.new(@hash).module_result.id  
14 - end  
15 -  
16 - should 'convert date_module_result to hash' do  
17 - assert_equal @hash, @date_module_result.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/error_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/error_fixtures"  
4 -  
5 -class ErrorTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ErrorFixtures.error_hash  
9 - @error = ErrorFixtures.error  
10 - end  
11 -  
12 - should 'create error from hash' do  
13 - assert_equal @hash[:message], Kalibro::Error.new(@hash).message  
14 - end  
15 -  
16 - should 'convert error to hash' do  
17 - assert_equal @hash, @error.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/metric_configuration_snapshot_test.rb
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures"  
4 -  
5 -class MetricConfigurationSnapshotTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash  
9 - @hash2 = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_hash_with_2_elements  
10 - @metric_configuration_snapshot = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot  
11 - @metric_configuration_snapshot2 = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot_with_2_elements  
12 - end  
13 -  
14 - should 'create and convert metric configuration snapshot from hash' do  
15 - assert_equal @hash[:code], Kalibro::MetricConfigurationSnapshot.new(@hash).code  
16 - assert_equal @hash[:weight].to_f, @metric_configuration_snapshot.weight  
17 - end  
18 -  
19 - should 'create and convert metric configuration snapshot from hash with 2 elements' do  
20 - assert_equal @hash2[:code], Kalibro::MetricConfigurationSnapshot.new(@hash2).code  
21 - assert_equal @hash2, @metric_configuration_snapshot2.to_hash  
22 - end  
23 -  
24 -end  
plugins/mezuro/test/unit/kalibro/metric_configuration_test.rb
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures"  
4 -  
5 -class MetricConfigurationTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @native_metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration  
9 - @native_metric_configuration_hash = MetricConfigurationFixtures.amloc_metric_configuration_hash  
10 - @created_metric_configuration = MetricConfigurationFixtures.created_metric_configuration  
11 - end  
12 -  
13 - should 'create metric configuration from hash' do  
14 - metric_configuration = Kalibro::MetricConfiguration.new(@native_metric_configuration_hash)  
15 - assert_equal @native_metric_configuration_hash[:code], metric_configuration.code  
16 - assert_equal @native_metric_configuration_hash[:id].to_i, metric_configuration.id  
17 - assert_equal @native_metric_configuration_hash[:reading_group_id].to_i, metric_configuration.reading_group_id  
18 - end  
19 -  
20 - should 'convert metric configuration to hash' do  
21 - assert_equal @native_metric_configuration_hash, @native_metric_configuration.to_hash  
22 - end  
23 -  
24 - should 'get all metric configurations of a configuration' do  
25 - configuration_id = 13  
26 - request_body = { :configuration_id => configuration_id }  
27 - response_hash = {:metric_configuration => [@native_metric_configuration_hash]}  
28 - Kalibro::MetricConfiguration.expects(:request).with(:metric_configurations_of, request_body).returns(response_hash)  
29 - assert_equal @native_metric_configuration.code, Kalibro::MetricConfiguration.metric_configurations_of(configuration_id).first.code  
30 - end  
31 -  
32 - should 'return true when metric configuration is saved successfully' do  
33 - id_from_kalibro = 1  
34 - configuration_id = @created_metric_configuration.configuration_id  
35 - 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)  
36 - assert @created_metric_configuration.save  
37 - assert_equal id_from_kalibro, @created_metric_configuration.id  
38 - end  
39 -  
40 - should 'return false when metric configuration is not saved successfully' do  
41 - configuration_id = @created_metric_configuration.configuration_id  
42 - Kalibro::MetricConfiguration.expects(:request).with(:save_metric_configuration, {:metric_configuration => @created_metric_configuration.to_hash, :configuration_id => configuration_id}).raises(Exception.new)  
43 - assert !(@created_metric_configuration.save)  
44 - assert_nil @created_metric_configuration.id  
45 - end  
46 -  
47 - should 'destroy metric configuration' do  
48 - Kalibro::MetricConfiguration.expects(:request).with(:delete_metric_configuration, :metric_configuration_id => @native_metric_configuration.id)  
49 - @native_metric_configuration.destroy  
50 - end  
51 -  
52 -end  
plugins/mezuro/test/unit/kalibro/metric_result_test.rb
@@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_result_fixtures"  
4 -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures"  
5 -  
6 -class MetricResultTest < ActiveSupport::TestCase  
7 -  
8 - def setup  
9 - @native_hash = MetricResultFixtures.native_metric_result_hash  
10 - @compound_hash = MetricResultFixtures.compound_metric_result_hash  
11 - @result = MetricResultFixtures.native_metric_result  
12 - end  
13 -  
14 - should 'create metric result from hash' do  
15 - metric_result = Kalibro::MetricResult.new(@native_hash)  
16 - assert_equal @native_hash[:configuration][:code], metric_result.configuration.code  
17 - assert_equal @native_hash[:id].to_i, metric_result.id  
18 - assert_equal @native_hash[:value].to_f, metric_result.value  
19 - end  
20 -  
21 - should 'create metric result with aggregated value from hash' do  
22 - hash = @native_hash  
23 - hash[:aggregated_value] = "2.0"  
24 - hash[:value] = "NaN"  
25 - metric_result = Kalibro::MetricResult.new(hash)  
26 - assert_equal @native_hash[:aggregated_value].to_f, metric_result.value  
27 - end  
28 -  
29 - should 'convert metric result to hash' do  
30 - assert_equal @native_hash, @result.to_hash  
31 - end  
32 -  
33 - should 'return descendant results of a metric result' do  
34 - descendant = [31, 13]  
35 - Kalibro::MetricResult.expects(:request).with(:descendant_results_of, {:metric_result_id => @result.id}).returns({:descendant_result => descendant})  
36 - assert_equal descendant, @result.descendant_results  
37 - end  
38 -  
39 - should 'return metric results of a module result' do  
40 - id = 31  
41 - Kalibro::MetricResult.expects(:request).with(:metric_results_of, {:module_result_id => id}).returns(:metric_result => [@native_hash, @compound_hash])  
42 - assert_equal @native_hash[:id].to_i, Kalibro::MetricResult.metric_results_of(id).first.id  
43 - end  
44 -  
45 - should 'return history of a metric with a module result id' do  
46 - module_result_id = 31  
47 - 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})  
48 - 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  
49 - end  
50 -  
51 -end  
plugins/mezuro/test/unit/kalibro/metric_test.rb
@@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
1 -require "test_helper"  
2 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_fixtures"  
3 -  
4 -class MetricTest < ActiveSupport::TestCase  
5 -  
6 - def setup  
7 - @native_hash = MetricFixtures.amloc_hash  
8 - @native = MetricFixtures.amloc  
9 - @compound_hash = MetricFixtures.compound_metric_hash  
10 - @compound = MetricFixtures.compound_metric  
11 - end  
12 -  
13 - should 'create native metric from hash' do  
14 - assert_equal @native_hash[:name], Kalibro::Metric.new(@native_hash).name  
15 - end  
16 -  
17 - should 'convert native metric to hash' do  
18 - assert_equal @native_hash, @native.to_hash  
19 - end  
20 -  
21 - should 'create compound metric from hash' do  
22 - assert_equal @compound_hash[:script], Kalibro::Metric.new(@compound_hash).script  
23 - end  
24 -  
25 - should 'convert compound metric to hash' do  
26 - assert_equal @compound_hash, @compound.to_hash  
27 - end  
28 -  
29 -end  
plugins/mezuro/test/unit/kalibro/module_node_test.rb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -require "test_helper"  
2 -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_node_fixtures"  
3 -  
4 -class ModuleNodeTest < ActiveSupport::TestCase  
5 -  
6 - def setup  
7 - @hash = ModuleNodeFixtures.module_node_hash  
8 - @node = ModuleNodeFixtures.module_node  
9 - end  
10 -  
11 - should 'create module node from hash' do  
12 - assert_equal( @node.child[0].module.name, Kalibro::ModuleNode.new(@hash).child[0].module.name)  
13 - end  
14 -  
15 - should 'convert children hash to array of ModuleNode' do  
16 - assert_equal @hash, @node.to_hash  
17 - end  
18 -  
19 -end  
plugins/mezuro/test/unit/kalibro/module_result_test.rb
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -require "test_helper"  
2 -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures"  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_module_result_fixtures"  
4 -  
5 -class ModuleResultTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ModuleResultFixtures.module_result_hash  
9 - @module_result = ModuleResultFixtures.module_result  
10 - end  
11 -  
12 - should 'create module result' do  
13 - module_result = Kalibro::ModuleResult.new(@hash)  
14 - assert_equal @hash[:id].to_i , module_result.id  
15 - assert_equal @hash[:grade].to_f , module_result.grade  
16 - assert_equal @hash[:parent_id].to_i , module_result.parent_id  
17 - end  
18 -  
19 - should 'convert module result to hash' do  
20 - assert_equal @hash, @module_result.to_hash  
21 - end  
22 -  
23 - should 'find module result' do  
24 - response = {:module_result => @hash}  
25 - Kalibro::ModuleResult.expects(:request).with(:get_module_result, {:module_result_id => @module_result.id}).returns(response)  
26 - assert_equal @module_result.grade, Kalibro::ModuleResult.find(@module_result.id).grade  
27 - end  
28 -  
29 - should 'return children of a module result' do  
30 - response = {:module_result => [@hash]}  
31 - Kalibro::ModuleResult.expects(:request).with(:children_of, {:module_result_id => @module_result.id}).returns(response)  
32 - assert @hash[:id], @module_result.children.first.id  
33 - end  
34 -  
35 - should 'return parents of a module result' do  
36 - parent_module_result = ModuleResultFixtures.parent_module_result_hash  
37 - response = {:module_result => parent_module_result}  
38 - Kalibro::ModuleResult.expects(:request).with(:get_module_result, {:module_result_id => @module_result.parent_id}).returns(response)  
39 - parents = @module_result.parents  
40 - assert parent_module_result[:module][:name], parents.first.module.name  
41 - assert parent_module_result[:module][:name], parents.last.module.name  
42 - end  
43 -  
44 - should 'return history of a module result' do  
45 - Kalibro::ModuleResult.expects(:request).with(:history_of_module, {:module_result_id => @module_result.id}).returns({:date_module_result => [DateModuleResultFixtures.date_module_result_hash]})  
46 - assert_equal DateModuleResultFixtures.date_module_result_hash[:module_result][:id].to_i, Kalibro::ModuleResult.history_of(@module_result.id).first.module_result.id  
47 - end  
48 -  
49 -end  
plugins/mezuro/test/unit/kalibro/module_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures"  
4 -  
5 -class ModuleTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ModuleFixtures.module_hash  
9 - @module = ModuleFixtures.module  
10 - end  
11 -  
12 - should 'create module from hash' do  
13 - assert_equal @hash[:name], Kalibro::Module.new(@hash).name  
14 - end  
15 -  
16 - should 'convert module to hash' do  
17 - assert_equal @hash, @module.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/native_metric_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/native_metric_fixtures"  
4 -  
5 -class NativeMetricTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = NativeMetricFixtures.amloc_hash  
9 - @metric = NativeMetricFixtures.amloc  
10 - end  
11 -  
12 - should 'create native metric from hash' do  
13 - assert_equal @hash[:name], Kalibro::NativeMetric.new(@hash).name  
14 - end  
15 -  
16 - should 'convert native metric to hash' do  
17 - assert_equal @hash, @metric.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/process_time_test.rb
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/process_time_fixtures"  
4 -  
5 -class ProcessTimeTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ProcessTimeFixtures.process_time_hash  
9 - @process_time = ProcessTimeFixtures.process_time  
10 - end  
11 -  
12 - should 'create process time from hash' do  
13 - assert_equal @hash[:state], Kalibro::ProcessTime.new(@hash).state  
14 - assert_equal @hash[:time].to_i, Kalibro::ProcessTime.new(@hash).time  
15 - end  
16 -  
17 - should 'convert process time to hash' do  
18 - assert_equal @hash, @process_time.to_hash  
19 - end  
20 -  
21 - should 'get time as an integer' do  
22 - assert_equal 1.class, @process_time.time.class  
23 - end  
24 -  
25 -end  
plugins/mezuro/test/unit/kalibro/processing_test.rb
@@ -1,98 +0,0 @@ @@ -1,98 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/processing_fixtures"  
4 -class ProcessingTest < ActiveSupport::TestCase  
5 -  
6 - def setup  
7 - @hash = ProcessingFixtures.processing_hash  
8 - @processing = ProcessingFixtures.processing  
9 -  
10 - @repository_id = 31  
11 - end  
12 -  
13 - should 'create processing from hash' do  
14 - processing = Kalibro::Processing.new(@hash)  
15 - assert_equal @hash[:results_root_id].to_i, processing.results_root_id  
16 - assert_equal @hash[:process_time].first[:state], processing.process_times.first.state  
17 - assert_equal @hash[:id].to_i, processing.id  
18 - end  
19 -  
20 - should 'convert processing to hash' do  
21 - assert_equal @hash, @processing.to_hash  
22 - end  
23 -  
24 - should 'verify if a repository has a processing' do  
25 - true_repository_id = 31  
26 - false_repository_id = 32  
27 -  
28 - Kalibro::Processing.expects(:request).with(:has_processing, {:repository_id => true_repository_id}).returns({:exists => true})  
29 - Kalibro::Processing.expects(:request).with(:has_processing, {:repository_id => false_repository_id}).returns({:exists => false})  
30 -  
31 - assert Kalibro::Processing.has_processing(true_repository_id)  
32 - assert !Kalibro::Processing.has_processing(false_repository_id)  
33 - end  
34 -  
35 - should 'verify if a repository has a ready processing' do  
36 - true_repository_id = 31  
37 - false_repository_id = 32  
38 -  
39 - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => true_repository_id}).returns({:exists => true})  
40 - Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => false_repository_id}).returns({:exists => false})  
41 -  
42 - assert Kalibro::Processing.has_ready_processing(true_repository_id)  
43 - assert !Kalibro::Processing.has_ready_processing(false_repository_id)  
44 - end  
45 -  
46 - should 'verify if a repository has a processing after a date' do  
47 - true_repository_id = 31  
48 - false_repository_id = 32  
49 -  
50 - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => true_repository_id, :date => @processing.date}).returns({:exists => true})  
51 - Kalibro::Processing.expects(:request).with(:has_processing_after, {:repository_id => false_repository_id, :date => @processing.date}).returns({:exists => false})  
52 -  
53 - assert Kalibro::Processing.has_processing_after(true_repository_id, @processing.date)  
54 - assert !Kalibro::Processing.has_processing_after(false_repository_id, @processing.date)  
55 - end  
56 -  
57 - should 'verify if a repository has a processing before a date' do  
58 - true_repository_id = 31  
59 - false_repository_id = 32  
60 -  
61 - Kalibro::Processing.expects(:request).with(:has_processing_before, {:repository_id => true_repository_id, :date => @processing.date}).returns({:exists => true})  
62 - Kalibro::Processing.expects(:request).with(:has_processing_before, {:repository_id => false_repository_id, :date => @processing.date}).returns({:exists => false})  
63 -  
64 - assert Kalibro::Processing.has_processing_before(true_repository_id, @processing.date)  
65 - assert !Kalibro::Processing.has_processing_before(false_repository_id, @processing.date)  
66 - end  
67 -  
68 - should 'get last processing state of a repository' do  
69 - Kalibro::Processing.expects(:request).with(:last_processing_state, {:repository_id => @repository_id}).returns({:process_state => @processing.state})  
70 - assert_equal @processing.state, Kalibro::Processing.last_processing_state_of(@repository_id)  
71 - end  
72 -  
73 - should 'get last ready processing of a repository' do  
74 - Kalibro::Processing.expects(:request).with(:last_ready_processing, {:repository_id => @repository_id}).returns({:processing => @hash})  
75 - assert_equal @processing.id, Kalibro::Processing.last_ready_processing_of(@repository_id).id  
76 - end  
77 -  
78 - should 'get first processing of a repository' do  
79 - Kalibro::Processing.expects(:request).with(:first_processing, {:repository_id => @repository_id}).returns({:processing => @hash})  
80 - assert_equal @processing.id, Kalibro::Processing.first_processing_of(@repository_id).id  
81 - end  
82 -  
83 - should 'get last processing of a repository' do  
84 - Kalibro::Processing.expects(:request).with(:last_processing, {:repository_id => @repository_id}).returns({:processing => @hash})  
85 - assert_equal @processing.id, Kalibro::Processing.last_processing_of(@repository_id).id  
86 - end  
87 -  
88 - should 'get first processing after a date of a repository' do  
89 - Kalibro::Processing.expects(:request).with(:first_processing_after, {:repository_id => @repository_id, :date => @processing.date}).returns({:processing => @hash})  
90 - assert_equal @processing.id, Kalibro::Processing.first_processing_after(@repository_id, @processing.date).id  
91 - end  
92 -  
93 - should 'get last processing before a date of a repository' do  
94 - Kalibro::Processing.expects(:request).with(:last_processing_before, {:repository_id => @repository_id, :date => @processing.date}).returns({:processing => @hash})  
95 - assert_equal @processing.id, Kalibro::Processing.last_processing_before(@repository_id, @processing.date).id  
96 - end  
97 -  
98 -end  
plugins/mezuro/test/unit/kalibro/project_result_test.rb
@@ -1,88 +0,0 @@ @@ -1,88 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_result_fixtures"  
4 -  
5 -class ProjectResultTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ProjectResultFixtures.project_result_hash  
9 - @project_result = ProjectResultFixtures.project_result  
10 -  
11 - @project_name = @project_result.project.name  
12 - @date = @project_result.date  
13 - @flag = DateTime.now.sec % 2 == 0 #random choose between true or false  
14 -  
15 - @request = {:project_name => @project_name}  
16 - @request_with_date = {:project_name => @project_name, :date => @date}  
17 - @flag_response = {:has_results => @flag}  
18 - @result_response = {:project_result => @project_result.to_hash}  
19 - end  
20 -  
21 - should 'create project result from hash' do  
22 - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.new(@hash).analysis_time  
23 - end  
24 -  
25 - should 'convert project result to hash' do  
26 - assert_equal @hash, @project_result.to_hash  
27 - end  
28 -  
29 - should 'get last result' do  
30 - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_last_result_of, @request).returns(@result_response)  
31 - assert_equal @project_result.analysis_time , Kalibro::ProjectResult.last_result(@project_name).analysis_time  
32 - end  
33 -  
34 - should 'get first result' do  
35 - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_first_result_of, @request).returns(@result_response)  
36 - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.first_result(@project_name).analysis_time  
37 - end  
38 -  
39 - should 'get first result after date' do  
40 - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_first_result_after, @request_with_date).returns(@result_response)  
41 - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.first_result_after(@project_name, @date).analysis_time  
42 - end  
43 -  
44 - should 'get last result before date' do  
45 - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:get_last_result_before, @request_with_date).returns(@result_response)  
46 - assert_equal @project_result.analysis_time, Kalibro::ProjectResult.last_result_before(@project_name, @date).analysis_time  
47 - end  
48 -  
49 - should 'verify if project has results' do  
50 - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_for, @request).returns(@flag_response)  
51 - assert_equal @flag, Kalibro::ProjectResult.has_results?(@project_name)  
52 - end  
53 -  
54 - should 'verify if project has results before date' do  
55 - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_before, @request_with_date).returns(@flag_response)  
56 - assert_equal @flag, Kalibro::ProjectResult.has_results_before?(@project_name, @date)  
57 - end  
58 -  
59 - should 'verify if project has results after date' do  
60 - Kalibro::ProjectResult.expects(:request).with('ProjectResult',:has_results_after, @request_with_date).returns(@flag_response)  
61 - assert_equal @flag, Kalibro::ProjectResult.has_results_after?(@project_name, @date)  
62 - end  
63 -  
64 - should 'retrieve formatted load time' do  
65 - assert_equal '00:00:14', @project_result.formatted_load_time  
66 - end  
67 -  
68 - should 'retrieve formatted analysis time' do  
69 - assert_equal '00:00:01', @project_result.formatted_analysis_time  
70 - end  
71 -  
72 - should 'retrive complex module' do  
73 - assert_equal @hash[:source_tree][:child][0][:child].first, @project_result.node("org.Window").to_hash  
74 - end  
75 -  
76 - should 'return source tree node when nil is given' do  
77 - assert_equal @hash[:source_tree], @project_result.node(nil).to_hash  
78 - end  
79 -  
80 - should 'return source tree node when project name is given' do  
81 - assert_equal @hash[:source_tree], @project_result.node(@project_result.project.name).to_hash  
82 - end  
83 -  
84 - should 'return correct node when module name is given' do  
85 - assert_equal @hash[:source_tree][:child][2], @project_result.node("main").to_hash  
86 - end  
87 -  
88 -end  
plugins/mezuro/test/unit/kalibro/project_test.rb
@@ -1,75 +0,0 @@ @@ -1,75 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures"  
4 -  
5 -class ProjectTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ProjectFixtures.project_hash  
9 - @project = ProjectFixtures.project  
10 - @created_project = ProjectFixtures.created_project  
11 - end  
12 -  
13 - should 'initialize new project from hash' do  
14 - project = Kalibro::Project.new @hash  
15 - assert_equal @hash[:name], project.name  
16 - assert_equal @hash[:id].to_i, project.id  
17 - end  
18 -  
19 - should 'convert project to hash' do  
20 - hash = @project.to_hash  
21 - assert_equal @project.name, hash[:name]  
22 - end  
23 -  
24 - should 'answer if project exists in kalibro' do  
25 - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => true})  
26 - assert Kalibro::Project.exists?(@project.id)  
27 - end  
28 -  
29 - should 'find project' do  
30 - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => true})  
31 - Kalibro::Project.expects(:request).with(:get_project, {:project_id => @project.id}).returns(:project => @hash)  
32 - assert_equal @hash[:name], Kalibro::Project.find(@project.id).name  
33 - end  
34 -  
35 - should 'raise RecordNotFound exception when project doesnt exist' do  
36 - Kalibro::Project.expects(:request).with(:project_exists, {:project_id => @project.id}).returns({:exists => false})  
37 - assert_raise(Kalibro::Errors::RecordNotFound){Kalibro::Project.find(@project.id)}  
38 - end  
39 -  
40 - should 'get all projects when there is only one project' do  
41 - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => @hash})  
42 - assert_equal @hash[:name], Kalibro::Project.all.first.name  
43 - end  
44 -  
45 - should 'get all projects when there are many projects' do  
46 - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => [@hash, @hash]})  
47 - projects = Kalibro::Project.all  
48 - assert_equal @hash[:name], projects.first.name  
49 - assert_equal @hash[:name], projects.last.name  
50 - end  
51 -  
52 - should 'return empty when there are no projects' do  
53 - Kalibro::Project.expects(:request).with(:all_projects).returns({:project => nil})  
54 - assert_equal [], Kalibro::Project.all  
55 - end  
56 -  
57 - should 'return true when project is saved successfully' do  
58 - id_from_kalibro = 1  
59 - Kalibro::Project.expects(:request).with(:save_project, {:project => @created_project.to_hash}).returns(:project_id => id_from_kalibro)  
60 - assert @created_project.save  
61 - assert_equal id_from_kalibro, @created_project.id  
62 - end  
63 -  
64 - should 'return false when project is not saved successfully' do  
65 - Kalibro::Project.expects(:request).with(:save_project, {:project => @created_project.to_hash}).raises(Exception.new)  
66 - assert !(@created_project.save)  
67 - assert_nil @created_project.id  
68 - end  
69 -  
70 - should 'remove existent project from service' do  
71 - Kalibro::Project.expects(:request).with(:delete_project, {:project_id => @project.id})  
72 - @project.destroy  
73 - end  
74 -  
75 -end  
plugins/mezuro/test/unit/kalibro/range_snapshot_test.rb
@@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/range_snapshot_fixtures"  
4 -  
5 -class RangeSnapshotTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = RangeSnapshotFixtures.range_snapshot_hash  
9 - @range_snapshot_with_infinite_range_hash = RangeSnapshotFixtures.range_snapshot_with_infinite_range_hash  
10 - @range_snapshot = RangeSnapshotFixtures.range_snapshot  
11 - @range_snapshot_with_infinite_range = RangeSnapshotFixtures.range_snapshot_with_infinite_range  
12 - end  
13 -  
14 - should 'create range_snapshot from hash' do  
15 - range_snapshot = Kalibro::RangeSnapshot.new(@hash)  
16 - assert_equal @hash[:comments], range_snapshot.comments  
17 - assert_equal @hash[:beginning].to_f, range_snapshot.beginning  
18 - assert_equal @hash[:end].to_f, range_snapshot.end  
19 - assert_equal @hash[:grade].to_f, range_snapshot.grade  
20 - end  
21 -  
22 - should 'create range_snapshot from hash with infinity values' do  
23 - range_snapshot = Kalibro::RangeSnapshot.new(@range_snapshot_with_infinite_range_hash)  
24 - assert_equal -1.0/0, range_snapshot.beginning  
25 - assert_equal 1.0/0, range_snapshot.end  
26 - end  
27 -  
28 - should 'convert range_snapshot to hash' do  
29 - assert_equal @hash, @range_snapshot.to_hash  
30 - end  
31 -  
32 -end  
plugins/mezuro/test/unit/kalibro/range_test.rb
@@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures"  
4 -  
5 -class RangeTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = RangeFixtures.range_hash  
9 - @range = RangeFixtures.range  
10 - @created_range = RangeFixtures.created_range  
11 - end  
12 -  
13 - should 'create range from hash' do  
14 - assert_equal @hash[:comments], Kalibro::Range.new(@hash).comments  
15 - end  
16 -  
17 - should 'convert range to hash' do  
18 - assert_equal @hash, @range.to_hash  
19 - end  
20 -  
21 - should 'get ranges of a metric configuration' do  
22 - metric_configuration_id = 31  
23 - Kalibro::Range.expects(:request).with(:ranges_of, {:metric_configuration_id => metric_configuration_id}).returns({:range => [@hash]})  
24 - assert_equal @hash[:comments], Kalibro::Range.ranges_of(metric_configuration_id).first.comments  
25 - end  
26 -  
27 - should 'return true when range is saved successfully' do  
28 - id_from_kalibro = 1  
29 - metric_configuration_id = 2  
30 - Kalibro::Range.expects(:request).with(:save_range, {:range => @created_range.to_hash, :metric_configuration_id => metric_configuration_id}).returns(:range_id => id_from_kalibro)  
31 - assert @created_range.save(metric_configuration_id)  
32 - assert_equal id_from_kalibro, @created_range.id  
33 - end  
34 -  
35 - should 'return false when range is not saved successfully' do  
36 - metric_configuration_id = 2  
37 - Kalibro::Range.expects(:request).with(:save_range, {:range => @created_range.to_hash, :metric_configuration_id => metric_configuration_id}).raises(Exception.new)  
38 - assert !(@created_range.save(metric_configuration_id))  
39 - assert_nil @created_range.id  
40 - end  
41 -  
42 - should 'destroy range by id' do  
43 - Kalibro::Range.expects(:request).with(:delete_range, {:range_id => @range.id})  
44 - @range.destroy  
45 - end  
46 -  
47 -end  
plugins/mezuro/test/unit/kalibro/reading_group_test.rb
@@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
1 -require "test_helper"  
2 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures"  
3 -  
4 -class ReadingGroupTest < ActiveSupport::TestCase  
5 -  
6 - def setup  
7 - @hash = ReadingGroupFixtures.reading_group_hash  
8 - @reading_group = ReadingGroupFixtures.reading_group  
9 - @created_reading_group = ReadingGroupFixtures.created_reading_group  
10 - end  
11 -  
12 - should 'create reading group from hash' do  
13 - assert_equal @hash[:name], Kalibro::ReadingGroup.new(@hash).name  
14 - assert_equal @hash[:id].to_i, Kalibro::ReadingGroup.new(@hash).id  
15 - end  
16 -  
17 - should 'convert reading group to hash' do  
18 - assert_equal @hash, @reading_group.to_hash  
19 - end  
20 -  
21 - should 'verify existence of reading group' do  
22 - fake_id = 0  
23 - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => fake_id}).returns({:exists => false})  
24 - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => @hash[:id].to_i}).returns({:exists => true})  
25 - assert !Kalibro::ReadingGroup.exists?(fake_id)  
26 - assert Kalibro::ReadingGroup.exists?(@hash[:id].to_i)  
27 - end  
28 -  
29 - should 'get reading group' do  
30 - Kalibro::ReadingGroup.expects(:request).with(:reading_group_exists, {:group_id => @hash[:id]}).returns({:exists => true})  
31 - Kalibro::ReadingGroup.expects(:request).with(:get_reading_group, {:group_id => @hash[:id]}).  
32 - returns({:reading_group => @hash})  
33 - assert_equal @hash[:name], Kalibro::ReadingGroup.find(@hash[:id]).name  
34 - end  
35 -  
36 - should 'get all reading groups when there is only one reading group' do  
37 - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => @hash})  
38 - assert_equal @hash[:name], Kalibro::ReadingGroup.all.first.name  
39 - end  
40 -  
41 - should 'get all reading groups when there are many reading groups' do  
42 - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => [@hash, @hash]})  
43 - reading_groups = Kalibro::ReadingGroup.all  
44 - assert_equal @hash[:name], reading_groups.first.name  
45 - assert_equal @hash[:name], reading_groups.last.name  
46 - end  
47 -  
48 - should 'return empty when there are no reading groups' do  
49 - Kalibro::ReadingGroup.expects(:request).with(:all_reading_groups).returns({:reading_group => nil})  
50 - assert_equal [], Kalibro::ReadingGroup.all  
51 - end  
52 -  
53 - should 'get reading group of a metric configuration' do  
54 - id = 31  
55 - Kalibro::ReadingGroup.expects(:request).with(:reading_group_of, {:metric_configuration_id => id}).returns({:reading_group => @hash})  
56 - assert_equal @hash[:name], Kalibro::ReadingGroup.reading_group_of(id).name  
57 - end  
58 -  
59 - should 'return true when reading group is saved successfully' do  
60 - id_from_kalibro = 1  
61 - Kalibro::ReadingGroup.expects(:request).with(:save_reading_group, {:reading_group => @created_reading_group.to_hash}).returns(:reading_group_id => id_from_kalibro)  
62 - assert @created_reading_group.save  
63 - assert_equal id_from_kalibro, @created_reading_group.id  
64 - end  
65 -  
66 - should 'return false when reading group is not saved successfully' do  
67 - Kalibro::ReadingGroup.expects(:request).with(:save_reading_group, {:reading_group => @created_reading_group.to_hash}).raises(Exception.new)  
68 - assert !(@created_reading_group.save)  
69 - assert_nil @created_reading_group.id  
70 - end  
71 -  
72 - should 'destroy reading group by id' do  
73 - Kalibro::ReadingGroup.expects(:request).with(:delete_reading_group, {:group_id => @reading_group.id})  
74 - @reading_group.destroy  
75 - end  
76 -  
77 -end  
78 -  
plugins/mezuro/test/unit/kalibro/reading_test.rb
@@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
1 -require "test_helper"  
2 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures"  
3 -  
4 -class ReadingTest < ActiveSupport::TestCase  
5 -  
6 - def setup  
7 - @hash = ReadingFixtures.reading_hash  
8 - @reading = ReadingFixtures.reading  
9 - @created_reading = ReadingFixtures.created_reading  
10 - end  
11 -  
12 - should 'create reading from hash' do  
13 - assert_equal @hash[:label], Kalibro::Reading.new(@hash).label  
14 - assert_equal @hash[:id].to_i, Kalibro::Reading.new(@hash).id  
15 - assert_equal @hash[:grade].to_f, Kalibro::Reading.new(@hash).grade  
16 - end  
17 -  
18 - should 'convert reading to hash' do  
19 - assert_equal @hash, @reading.to_hash  
20 - end  
21 -  
22 - should 'get reading' do  
23 - Kalibro::Reading.expects(:request).with(:get_reading, {:reading_id => @hash[:id]}).  
24 - returns({:reading => @hash})  
25 - assert_equal @hash[:label], Kalibro::Reading.find(@hash[:id]).label  
26 - end  
27 -  
28 - should 'get reading of a range' do  
29 - range_id = 31  
30 - Kalibro::Reading.expects(:request).with(:reading_of, {:range_id => range_id}).returns({:reading => @hash})  
31 - assert_equal @hash[:label], Kalibro::Reading.reading_of(range_id).label  
32 - end  
33 -  
34 - should 'get readings of a reading group' do  
35 - reading_group_id = 31  
36 - Kalibro::Reading.expects(:request).with(:readings_of, {:group_id => reading_group_id}).returns({:reading => [@hash]})  
37 - assert_equal @hash[:label], Kalibro::Reading.readings_of(reading_group_id).first.label  
38 - end  
39 -  
40 - should 'return true when reading is saved successfully' do  
41 - id_from_kalibro = 1  
42 - Kalibro::Reading.expects(:request).with(:save_reading, {:group_id => @created_reading.group_id, :reading => @created_reading.to_hash}).returns(:reading_id => id_from_kalibro)  
43 - assert @created_reading.save  
44 - assert_equal id_from_kalibro, @created_reading.id  
45 - end  
46 -  
47 - should 'return false when reading is not saved successfully' do  
48 - Kalibro::Reading.expects(:request).with(:save_reading, {:group_id => @created_reading.group_id, :reading => @created_reading.to_hash}).raises(Exception.new)  
49 - assert !(@created_reading.save)  
50 - assert_nil @created_reading.id  
51 - end  
52 -  
53 - should 'destroy reading by id' do  
54 - Kalibro::Reading.expects(:request).with(:delete_reading, {:reading_id => @reading.id})  
55 - @reading.destroy  
56 - end  
57 -  
58 -end  
59 -  
plugins/mezuro/test/unit/kalibro/repository_test.rb
@@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/repository_fixtures"  
4 -  
5 -class RepositoryTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = RepositoryFixtures.repository_hash  
9 - @repository = RepositoryFixtures.repository  
10 - @created_repository = RepositoryFixtures.created_repository  
11 - end  
12 -  
13 - should 'new repository from hash' do  
14 - repository = Kalibro::Repository.new(@hash)  
15 - assert_equal @hash[:type], repository.type  
16 - assert_equal @hash[:id].to_i, repository.id  
17 - assert_equal @hash[:process_period].to_i, repository.process_period  
18 - assert_equal @hash[:configuration_id].to_i, repository.configuration_id  
19 - end  
20 -  
21 - should 'convert repository to hash' do  
22 - assert_equal @hash, @repository.to_hash  
23 - end  
24 -  
25 - should 'get supported repository types' do  
26 - types = ['BAZAAR', 'GIT', 'SUBVERSION']  
27 - Kalibro::Repository.expects(:request).with(:supported_repository_types).returns({:supported_type => types})  
28 - assert_equal types, Kalibro::Repository.repository_types  
29 - end  
30 -  
31 - should 'get repositories of a project' do  
32 - project_id = 31  
33 - Kalibro::Repository.expects(:request).with(:repositories_of, {:project_id => project_id}).returns({:repository => [@hash]})  
34 - assert_equal @hash[:name], Kalibro::Repository.repositories_of(project_id).first.name  
35 - end  
36 -  
37 - should 'return true when repository is saved successfully' do  
38 - id_from_kalibro = 1  
39 - Kalibro::Repository.expects(:request).with(:save_repository, {:repository => @created_repository.to_hash, :project_id => @created_repository.project_id}).returns(:repository_id => id_from_kalibro)  
40 - assert @created_repository.save  
41 - assert_equal id_from_kalibro, @created_repository.id  
42 - end  
43 -  
44 - should 'return false when repository is not saved successfully' do  
45 - Kalibro::Repository.expects(:request).with(:save_repository, {:repository => @created_repository.to_hash, :project_id => @created_repository.project_id}).raises(Exception.new)  
46 - assert !(@created_repository.save)  
47 - assert_nil @created_repository.id  
48 - end  
49 -  
50 - should 'destroy repository by id' do  
51 - Kalibro::Repository.expects(:request).with(:delete_repository, {:repository_id => @repository.id})  
52 - @repository.destroy  
53 - end  
54 -  
55 - should 'process repository' do  
56 - Kalibro::Repository.expects(:request).with(:process_repository, {:repository_id => @repository.id});  
57 - @repository.process  
58 - end  
59 -  
60 - should 'cancel processing of a repository' do  
61 - Kalibro::Repository.expects(:request).with(:cancel_processing_of_repository, {:repository_id => @repository.id});  
62 - @repository.cancel_processing_of_repository  
63 - end  
64 -  
65 -end  
plugins/mezuro/test/unit/kalibro/stack_trace_element_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/stack_trace_element_fixtures"  
4 -  
5 -class StackTraceElementTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = StackTraceElementFixtures.stack_trace_element_hash  
9 - @stack_trace_element = StackTraceElementFixtures.stack_trace_element  
10 - end  
11 -  
12 - should 'create stack trace element from hash' do  
13 - assert_equal @hash[:method_name], Kalibro::StackTraceElement.new(@hash).method_name  
14 - end  
15 -  
16 - should 'convert stack trace element to hash' do  
17 - assert_equal @hash, @stack_trace_element.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/kalibro/throwable_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/throwable_fixtures"  
4 -  
5 -class ThrowableTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @hash = ThrowableFixtures.throwable_hash  
9 - @throwable = ThrowableFixtures.throwable  
10 - end  
11 -  
12 - should 'create throwable from hash' do  
13 - assert_equal @hash[:message], Kalibro::Throwable.new(@hash).message  
14 - end  
15 -  
16 - should 'convert throwable to hash' do  
17 - assert_equal @hash, @throwable.to_hash  
18 - end  
19 -  
20 -end  
plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb
@@ -1,90 +0,0 @@ @@ -1,90 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_fixtures"  
4 -require "#{Rails.root}/plugins/mezuro/test/fixtures/configuration_content_fixtures"  
5 -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_fixtures"  
6 -require "#{Rails.root}/plugins/mezuro/test/fixtures/range_fixtures"  
7 -  
8 -class ConfigurationContentTest < ActiveSupport::TestCase  
9 -  
10 - def setup  
11 - @configuration = ConfigurationFixtures.configuration  
12 - @content = ConfigurationContentFixtures.configuration_content  
13 - @created_configuration = ConfigurationFixtures.created_configuration  
14 - @content_hash = ConfigurationContentFixtures.configuration_content_hash  
15 - @configuration_hash = {:name => @content_hash[:name], :description => @content_hash[:description], :id => @content_hash[:configuration_id]}  
16 - @created_content = ConfigurationContentFixtures.created_configuration_content  
17 -  
18 - @metric_configuration = MetricConfigurationFixtures.amloc_metric_configuration  
19 - @range = RangeFixtures.range  
20 - end  
21 -  
22 - should 'be an article' do  
23 - assert_kind_of Article, @content  
24 - end  
25 -  
26 - should 'provide proper short description' do  
27 - assert_equal 'Mezuro configuration', MezuroPlugin::ConfigurationContent.short_description  
28 - end  
29 -  
30 - should 'provide proper description' do  
31 - assert_equal 'Set of metric configurations to interpret a Kalibro project', MezuroPlugin::ConfigurationContent.description  
32 - end  
33 -  
34 - should 'have an html view' do  
35 - assert_not_nil @content.to_html  
36 - end  
37 -  
38 - should 'not save a configuration with an existing cofiguration name in kalibro' do  
39 - Kalibro::Configuration.expects(:all).returns([@configuration])  
40 - @content.send :validate_configuration_name  
41 - assert_equal "Configuration name already exists in Kalibro", @content.errors.on_base  
42 - end  
43 -  
44 - should 'get configuration from service' do  
45 - Kalibro::Configuration.expects(:find).with(@content.configuration_id).returns(@configuration)  
46 - assert_equal @configuration, @content.kalibro_configuration  
47 - end  
48 -  
49 - should 'send configuration to service after saving' do  
50 - @content.expects :send_configuration_to_service  
51 - @content.run_callbacks :before_save  
52 - end  
53 -  
54 - should 'create new configuration' do  
55 - Kalibro::Configuration.expects(:create).with(:name => @created_content.name, :description => @created_content.description, :id => nil).returns(@configuration)  
56 - @created_content.send :send_configuration_to_service  
57 - assert_equal @configuration.id, @created_content.configuration_id  
58 - end  
59 -  
60 - should 'clone configuration' do  
61 - clone_id = @configuration.id  
62 - @content.configuration_to_clone_id = clone_id  
63 - Kalibro::Configuration.expects(:create).with(:id => @content.configuration_id, :name => @content.name, :description => @content.description).returns(@configuration)  
64 - Kalibro::MetricConfiguration.expects(:metric_configurations_of).with(@configuration.id).returns([@metric_configuration])  
65 - Kalibro::MetricConfiguration.expects(:request).returns(:metric_configuration_id => @metric_configuration.id)  
66 - Kalibro::Range.expects(:ranges_of).with(@metric_configuration.id).returns([@range])  
67 - @range.expects(:save).with(@metric_configuration.id).returns(true)  
68 - @content.send :send_configuration_to_service  
69 - end  
70 -  
71 - should 'edit configuration' do  
72 - Kalibro::Configuration.expects(:new).with(@configuration_hash).returns(@configuration)  
73 - @configuration.expects(:save).returns(true)  
74 - @content.send :send_configuration_to_service  
75 - assert_equal @configuration.id, @content.configuration_id  
76 - end  
77 -  
78 - should 'send correct configuration to service but comunication fails' do  
79 - Kalibro::Configuration.expects(:new).with(@configuration_hash).returns(@created_configuration)  
80 - @created_configuration.expects(:save).returns(false)  
81 - @content.send :send_configuration_to_service  
82 - end  
83 -  
84 - should 'remove configuration from service' do  
85 - Kalibro::Configuration.expects(:find).with(@content.configuration_id).returns(@configuration)  
86 - @configuration.expects(:destroy)  
87 - @content.send :remove_configuration_from_service  
88 - end  
89 -  
90 -end  
plugins/mezuro/test/unit/mezuro_plugin/helpers/content_viewer_helper_test.rb
@@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
1 -require "test_helper"  
2 -require "#{Rails.root}/plugins/mezuro/test/fixtures/metric_configuration_snapshot_fixtures"  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures"  
4 -  
5 -class ContentViewerHelperTest < ActiveSupport::TestCase  
6 -  
7 - def setup  
8 - @helper = MezuroPlugin::Helpers::ContentViewerHelper  
9 - end  
10 -  
11 - should 'get the number rounded by two decimal points' do  
12 - assert_equal '4.22', @helper.format_grade('4.22344')  
13 - assert_equal '4.10', @helper.format_grade('4.1')  
14 - assert_equal '4.00', @helper.format_grade('4')  
15 - end  
16 -  
17 - should 'create the periodicity options array' do  
18 - assert_equal [["Not Periodically", 0], ["1 day", 1], ["2 days", 2], ["Weekly", 7], ["Biweekly", 15], ["Monthly", 30]], @helper.periodicity_options  
19 - end  
20 -  
21 - should 'return the correct string for a given periodicity' do  
22 - assert_equal "Not Periodically", @helper.periodicity_option(0)  
23 - assert_equal "1 day", @helper.periodicity_option(1)  
24 - assert_equal "2 days", @helper.periodicity_option(2)  
25 - assert_equal "Weekly", @helper.periodicity_option(7)  
26 - assert_equal "Biweekly", @helper.periodicity_option(15)  
27 - assert_equal "Monthly", @helper.periodicity_option(30)  
28 - end  
29 -  
30 - should 'create the license options array' do  
31 - options = YAML.load_file("#{Rails.root}/plugins/mezuro/licenses.yml")  
32 - options = options.split("; ")  
33 - assert_equal options, @helper.license_options  
34 - end  
35 -  
36 - should 'generate chart from metric result history' do  
37 - 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"  
38 - metric_history = DateMetricResultFixtures.score_history  
39 -  
40 - assert_equal chart, @helper.generate_chart(metric_history)  
41 - end  
42 -  
43 - should 'format time to show a sentence' do  
44 - assert_equal 'less than 5 seconds', @helper.format_time(0)  
45 - assert_equal 'less than 5 seconds', @helper.format_time(4999)  
46 - assert_equal 'less than 10 seconds', @helper.format_time(5000)  
47 - assert_equal '1 minute', @helper.format_time(70000)  
48 - assert_equal 'about 2 hours', @helper.format_time(7000000)  
49 - end  
50 -  
51 - should 'format metric name for metric configuration snapshot' do  
52 - metric_configuration_snapshot = MetricConfigurationSnapshotFixtures.metric_configuration_snapshot  
53 - assert_equal 'AverageMethodLOC', @helper.format_name(metric_configuration_snapshot)  
54 - end  
55 -  
56 - should 'create aggregation options array' do  
57 - assert_equal [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],  
58 - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]], @helper.aggregation_options  
59 - end  
60 -  
61 - should 'create scope options' do  
62 - assert_equal [["Software", "SOFTWARE"], ["Package", "PACKAGE"], ["Class", "CLASS"], ["Method", "METHOD"]], @helper.scope_options  
63 - end  
64 -  
65 -end  
plugins/mezuro/test/unit/mezuro_plugin/helpers/module_result_helper_test.rb
@@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
1 -require "test_helper"  
2 -  
3 -class ModuleResultHelperTest < ActiveSupport::TestCase  
4 -  
5 - should 'return last module name when receive a string' do  
6 - name = 'Class'  
7 - assert_equal name, MezuroPlugin::Helpers::ModuleResultHelper.module_name(name)  
8 - end  
9 -  
10 - should 'return last module name when receive an array of strings' do  
11 - name = ['Class', 'Module']  
12 - assert_equal name.last, MezuroPlugin::Helpers::ModuleResultHelper.module_name(name)  
13 - end  
14 -  
15 -end  
plugins/mezuro/test/unit/mezuro_plugin/project_content_test.rb
@@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_fixtures"  
4 -require "#{Rails.root}/plugins/mezuro/test/fixtures/project_content_fixtures"  
5 -require "#{Rails.root}/plugins/mezuro/test/fixtures/processing_fixtures"  
6 -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_fixtures"  
7 -require "#{Rails.root}/plugins/mezuro/test/fixtures/module_result_fixtures"  
8 -require "#{Rails.root}/plugins/mezuro/test/fixtures/date_metric_result_fixtures"  
9 -  
10 -class ProjectContentTest < ActiveSupport::TestCase  
11 -  
12 - def setup  
13 - @project_content = ProjectContentFixtures.project_content  
14 - @project = ProjectFixtures.project  
15 - @repository = RepositoryFixtures.repository  
16 - @processing = ProcessingFixtures.processing  
17 - @date = @processing.date  
18 - @module = ModuleFixtures.module  
19 - @module_result = ModuleResultFixtures.module_result  
20 - @date_metric_result = DateMetricResultFixtures.date_metric_result  
21 - end  
22 -  
23 - should 'provide proper short description' do  
24 - assert_equal 'Mezuro project', MezuroPlugin::ProjectContent.short_description  
25 - end  
26 -  
27 - should 'provide proper description' do  
28 - assert_equal 'Software project tracked by Kalibro', MezuroPlugin::ProjectContent.description  
29 - end  
30 -  
31 - should 'have an html view' do  
32 - assert_not_nil @project_content.to_html  
33 - end  
34 -  
35 - should 'get project from service' do  
36 - Kalibro::Project.expects(:find).with(@project.id).returns(@project)  
37 - assert_equal @project, @project_content.project  
38 - end  
39 -  
40 - should 'add error to base when the project does not exist' do  
41 - Kalibro::Project.expects(:find).with(@project.id).raises(Kalibro::Errors::RecordNotFound)  
42 - assert_nil @project_content.errors[:base]  
43 - @project_content.project  
44 - assert_not_nil @project_content.errors[:base]  
45 - end  
46 -  
47 - should 'get repositories of the project from service' do  
48 - Kalibro::Repository.expects(:repositories_of).with(@project.id).returns([@repository])  
49 - assert_equal [@repository], @project_content.repositories  
50 - end  
51 -  
52 - should 'add error to base when getting the repositories of a project that does not exist' do  
53 - Kalibro::Repository.expects(:repositories_of).with(@project.id).raises(Kalibro::Errors::RecordNotFound)  
54 - assert_nil @project_content.errors[:base]  
55 - @project_content.repositories  
56 - assert_not_nil @project_content.errors[:base]  
57 - end  
58 -  
59 -end  
plugins/mezuro/test/unit/mezuro_plugin/reading_group_content_test.rb
@@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
1 -require "test_helper"  
2 -  
3 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_fixtures"  
4 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_fixtures"  
5 -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/reading_group_content_fixtures"  
6 -  
7 -class ReadingGroupContentTest < ActiveSupport::TestCase  
8 -  
9 - def setup  
10 - @reading_group_content = ReadingGroupContentFixtures.reading_group_content  
11 - @reading_group = ReadingGroupFixtures.reading_group  
12 - @reading = ReadingFixtures.reading  
13 - end  
14 -  
15 - should 'provide proper short description' do  
16 - assert_equal 'Mezuro reading group', MezuroPlugin::ReadingGroupContent.short_description  
17 - end  
18 -  
19 - should 'provide proper description' do  
20 - assert_equal 'Set of thresholds to interpret metric results', MezuroPlugin::ReadingGroupContent.description  
21 - end  
22 -  
23 - should 'have an html view' do  
24 - assert_not_nil @reading_group_content.to_html  
25 - end  
26 -  
27 - should 'get reading_group from service' do  
28 - Kalibro::ReadingGroup.expects(:find).with(@reading_group.id).returns(@reading_group)  
29 - assert_equal @reading_group, @reading_group_content.reading_group  
30 - end  
31 -  
32 - should 'add error to base when the reading_group does not exist' do  
33 - Kalibro::ReadingGroup.expects(:find).with(@reading_group.id).raises(Kalibro::Errors::RecordNotFound)  
34 - assert_nil @reading_group_content.errors[:base]  
35 - @reading_group_content.reading_group  
36 - assert_not_nil @reading_group_content.errors[:base]  
37 - end  
38 -  
39 - should 'get readings of the reading_group from service' do  
40 - Kalibro::Reading.expects(:readings_of).with(@reading_group.id).returns([@reading])  
41 - assert_equal [@reading], @reading_group_content.readings  
42 - end  
43 -  
44 - should 'add error to base when getting the readings of a reading_group that does not exist' do  
45 - Kalibro::Reading.expects(:readings_of).with(@reading_group.id).raises(Kalibro::Errors::RecordNotFound)  
46 - assert_nil @reading_group_content.errors[:base]  
47 - @reading_group_content.readings  
48 - assert_not_nil @reading_group_content.errors[:base]  
49 - end  
50 -  
51 -end  
plugins/mezuro/test/unit/mezuro_plugin_test.rb
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -require "test_helper"  
2 -  
3 -class MezuroPluginTest < ActiveSupport::TestCase  
4 -  
5 - def setup  
6 - @plugin = MezuroPlugin.new  
7 - end  
8 -  
9 - should 'be a noosfero plugin' do  
10 - assert_kind_of Noosfero::Plugin, @plugin  
11 - end  
12 -  
13 - should 'have name' do  
14 - assert_equal 'Mezuro', MezuroPlugin.plugin_name  
15 - end  
16 -  
17 - should 'have description' do  
18 - assert_equal _('A metric analizer plugin.'), MezuroPlugin.plugin_description  
19 - end  
20 -  
21 - should 'have stylesheet' do  
22 - assert @plugin.stylesheet?  
23 - end  
24 -  
25 -end  
plugins/mezuro/views/cms/mezuro_plugin/_configuration_content.html.erb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -<h1> <%= _(MezuroPlugin::ConfigurationContent.short_description) %> </h1>  
2 -  
3 -<%  
4 - kalibro_configuration = @article.title.nil? ? nil : @article.kalibro_configuration  
5 - configuration_names_and_ids = @article.configuration_names_and_ids  
6 -%>  
7 -  
8 -<%= error_messages_for 'kalibro_configuration' %>  
9 -  
10 -  
11 -<%= hidden_field_tag 'configuration_content[profile_id]', profile.id %>  
12 -<%= hidden_field_tag 'configuration_id', @article.configuration_id %>  
13 -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %>  
14 -  
15 -<br/>  
16 -<%= if kalibro_configuration.nil?  
17 - required labelled_form_field _('Clone Configuration'),  
18 - f.select(:configuration_to_clone_id, configuration_names_and_ids)  
19 -end %>  
plugins/mezuro/views/cms/mezuro_plugin/_mezuro_content_form.html.erb
@@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
1 -<%= hidden_field_tag 'id', @article.id %>  
2 -<%= required_fields_message %>  
3 -<%= required f.text_field(:name) %>  
4 -<%= f.text_field :description %><br/>  
plugins/mezuro/views/cms/mezuro_plugin/_project_content.html.erb
@@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
1 -<h1> <%= _(MezuroPlugin::ProjectContent.short_description) %> </h1>  
2 -  
3 -<%  
4 - @project = @article.title.nil? ? nil : @article.project  
5 -%>  
6 -  
7 -<%= error_messages_for 'project_content' %>  
8 -  
9 -<%= hidden_field_tag 'project_content[profile_id]', profile.id %>  
10 -<%= hidden_field_tag 'project_id', @article.project_id %>  
11 -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %>  
plugins/mezuro/views/cms/mezuro_plugin/_reading_group_content.html.erb
@@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
1 -<h1> <%= _(MezuroPlugin::ReadingGroupContent.short_description) %> </h1>  
2 -  
3 -<%  
4 - reading_group = @article.title.nil? ? nil : @article.reading_group  
5 -%>  
6 -  
7 -<%= error_messages_for 'reading_group_content' %>  
8 -  
9 -<%= hidden_field_tag 'reading_group_content[profile_id]', profile.id %>  
10 -<%= hidden_field_tag 'reading_group_id', (reading_group.id unless reading_group.nil?) %>  
11 -<%= render :partial => "cms/mezuro_plugin/mezuro_content_form", :locals => {:f => f} %>  
plugins/mezuro/views/content_viewer/show_configuration.rhtml
@@ -1,77 +0,0 @@ @@ -1,77 +0,0 @@
1 -<% @configuration_content = @page  
2 -@kalibro_configuration = @page.kalibro_configuration %>  
3 -<!-- #TODO check owner verification to remove or edit metric configuration -->  
4 -<% owner = (not user.nil?) && user.id == @profile.id %>  
5 -<% unless @page.errors[:base].nil? %>  
6 - <% if @page.errors[:base] =~ /Kalibro::Errors::RecordNotFound/ %>  
7 - <h3>Warning:</h3>  
8 - <p>This Configuration doesn't exist on the Web Service.</p>  
9 - <% if owner %>  
10 - <p> 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 %>?</p>  
11 - <% end %>  
12 - <% else %>  
13 - <%= @page.errors[:base] %>  
14 - <% end %>  
15 -<% else %>  
16 -  
17 - <table id="project_info">  
18 - <tr>  
19 - <td><%= _('Name') %></td>  
20 - <td><%= @kalibro_configuration.name %></td>  
21 - </tr>  
22 - <tr>  
23 - <td><%= _('Description') %></td>  
24 - <td><%= @kalibro_configuration.description %></td>  
25 - </tr>  
26 - </table>  
27 -  
28 - <br/>  
29 -  
30 - <% if owner %>  
31 - <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_metric_configuration",  
32 - :profile => @page.profile.identifier,  
33 - :action => "choose_metric",  
34 - :id => @configuration_content.id %><br/>  
35 - <% end %>  
36 -  
37 - <table>  
38 - <tr class="titles">  
39 - <td><h5>Metric Name</h5></td>  
40 - <td><h5>Collector Name</h5></td>  
41 - <td><h5>Metric Code</h5></td>  
42 - <td><h5>Weight</h5></td>  
43 - <td><h5>Aggregation Form</h5></td>  
44 - <td/>  
45 - </tr>  
46 - <% @configuration_content.metric_configurations.each do |metric_configuration| %>  
47 - <tr class="metric">  
48 - <% if metric_configuration.metric.compound  
49 - edit_action = "edit_compound"  
50 - else  
51 - edit_action = "edit_native"  
52 - end  
53 - %>  
54 - <td><%= link_to metric_configuration.metric.name, :controller => "mezuro_plugin_metric_configuration", :action => edit_action,  
55 - :metric_configuration_id => metric_configuration.id, :id => @configuration_content.id,  
56 - :profile => @page.profile.identifier %></td>  
57 - <% if metric_configuration.metric.compound %>  
58 - <td>  
59 - Compound Metric  
60 - </td>  
61 - <% else %>  
62 - <td>  
63 - <%= metric_configuration.base_tool_name %>  
64 - </td>  
65 - <% end %>  
66 - <td><%= metric_configuration.code %></td>  
67 - <td><%= metric_configuration.weight %></td>  
68 - <td><%= metric_configuration.aggregation_form %></td>  
69 - <% if owner %>  
70 - <td><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove",  
71 - :metric_configuration_id => metric_configuration.id, :id => @configuration_content.id,  
72 - :profile => @page.profile.identifier %></td>  
73 - <% end %>  
74 - </tr>  
75 - <% end %>  
76 - </table>  
77 -<% end %>  
plugins/mezuro/views/content_viewer/show_project.rhtml
@@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
1 -<% @project = @page.project %>  
2 -<% unless @page.errors[:base].nil? %>  
3 -<!-- #TODO add owner verification to remove or edit repository -->  
4 - <% if @page.errors[:base] == "Kalibro::Errors::RecordNotFound" %>  
5 - <h3>Warning:</h3>  
6 - <p>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 %>?</p>  
7 - <% else %>  
8 - <%= @page.errors[:base] %>  
9 - <% end %>  
10 -<% else %>  
11 -  
12 - <table>  
13 - <tr>  
14 - <td><%= _('Name') %></td>  
15 - <td><%= @project.name %></td>  
16 - </tr>  
17 - <tr>  
18 - <td><%= _('Description') %></td>  
19 - <td><%= @project.description %></td>  
20 - </tr>  
21 - </table>  
22 - <br/>  
23 - <h5><%= _('Repositories') %></h5>  
24 - <table>  
25 - <% @page.repositories.each do |repository| %>  
26 - <tr>  
27 - <td><%= link_to repository.name, :controller => "mezuro_plugin_repository",  
28 - :profile => @page.profile.identifier,  
29 - :action => "show",  
30 - :id => @page.id,  
31 - :repository_id => repository.id %></td>  
32 - <td ><%= link_to _('Edit'), {:controller => "mezuro_plugin_repository",  
33 - :profile => @page.profile.identifier,  
34 - :action => "edit",  
35 - :id => @page.id,  
36 - :repository_id => repository.id}, :class=>"button with-text icon-edit" %></td>  
37 - <td ><%= link_to _('Remove'), {:controller => "mezuro_plugin_repository",  
38 - :profile => @page.profile.identifier,  
39 - :action => "destroy",  
40 - :id => @page.id,  
41 - :repository_id => repository.id}, :class=>"button with-text icon-delete" %></td>  
42 - </tr>  
43 - <% end %>  
44 - </table>  
45 -  
46 - <br>  
47 - <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Repository", :controller => "mezuro_plugin_repository",  
48 - :profile => @page.profile.identifier,  
49 - :action => "new",  
50 - :id => @page.id %><br/>  
51 -  
52 -<% end %>  
plugins/mezuro/views/content_viewer/show_reading_group.rhtml
@@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
1 -<% @reading_group = @page.reading_group %>  
2 -<!-- #TODO add owner verification to remove or edit reading group -->  
3 -<% unless @page.errors[:base].nil? %>  
4 - <% if @page.errors[:base] == "Kalibro::Errors::RecordNotFound" %>  
5 - <h3>Warning:</h3>  
6 - <p>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 %>?</p>  
7 - <% else %>  
8 - <%= @page.errors[:base] %>  
9 - <% end %>  
10 -<% else %>  
11 -  
12 - <table>  
13 - <tr>  
14 - <td><%= _('Name') %></td>  
15 - <td><%= @reading_group.name %></td>  
16 - </tr>  
17 - <tr>  
18 - <td><%= _('Description') %></td>  
19 - <td><%= @reading_group.description %></td>  
20 - </tr>  
21 - </table>  
22 - <br/>  
23 - <h5><%= _('Readings') %></h5>  
24 - <table>  
25 - <% @page.readings.each do |reading| %>  
26 - <tr>  
27 - <td><%= link_to reading.label, :controller => "mezuro_plugin_reading",  
28 - :profile => @page.profile.identifier,  
29 - :action => "edit",  
30 - :id => @page.id,  
31 - :reading_id => reading.id %></td>  
32 - <td><%= reading.grade %></td>  
33 - <td bgcolor="#<%= reading.color %>"></td>  
34 - <td ><%= link_to _('Remove'), {:controller => "mezuro_plugin_reading",  
35 - :profile => @page.profile.identifier,  
36 - :action => "destroy",  
37 - :id => @page.id,  
38 - :reading_id => reading.id}, :class=>"button with-text icon-delete" %></td>  
39 - </tr>  
40 - <% end %>  
41 - </table>  
42 -  
43 - <br/>  
44 - <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Reading", :controller => "mezuro_plugin_reading",  
45 - :profile => @page.profile.identifier,  
46 - :action => "new",  
47 - :id => @page.id %><br/>  
48 -  
49 -<% end %>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/_compound_metric_configuration_form.html.erb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -<%= hidden_field_tag :id, @configuration_content.id %>  
2 -<%= f.hidden_field :configuration_id, :value => @configuration_content.configuration_id %>  
3 -  
4 -<% f.fields_for :metric do |m| %>  
5 - <%= m.hidden_field :compound, :value => "true" %>  
6 - <%= required labelled_form_field _('Metric Name:'), m.text_field(:name, :value => @metric_configuration.metric.name) %>  
7 - <%= labelled_form_field _('Description:'), m.text_field(:description, :value => @metric_configuration.metric.description) %>  
8 - <%= required labelled_form_field _('Script:'), m.text_area(:script, :rows => 5, :value => @metric_configuration.metric.script) %>  
9 - <%= required labelled_form_field _('Scope:'),  
10 - m.select(:scope, MezuroPlugin::Helpers::ContentViewerHelper.scope_options, :selected => @metric_configuration.metric.scope) %>  
11 -<% end %>  
12 -  
13 -<%= required labelled_form_field _('Code:'), f.text_field(:code) %>  
14 -<%= required labelled_form_field _('Aggregation Form:'),  
15 - f.select(:aggregation_form, MezuroPlugin::Helpers::ContentViewerHelper.aggregation_options) %>  
16 -<%= required labelled_form_field _('Weight:'), f.text_field(:weight) %>  
17 -<%= required labelled_form_field _('Reading Group:'), f.select(:reading_group_id, @reading_group_names_and_ids) %>  
18 -  
19 -<p><%= f.submit "Save" %></p>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/_error_page.html.erb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @message %>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/_metric_codes.html.erb
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -<table>  
2 - <tr class="titles">  
3 - <td><h5>Metric Name</h5></td>  
4 - <td><h5>Metric Code</h5></td>  
5 - </tr>  
6 - <% metric_configurations.each do |metric_configuration| %>  
7 - <tr class="metric">  
8 - <td><%= metric_configuration.metric.name %></td>  
9 - <td><%= metric_configuration.code %></td>  
10 - </tr>  
11 - <% end %>  
12 -</table>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_form.rhtml
@@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
1 -<%= hidden_field_tag :id, @configuration_content.id %>  
2 -<%= f.hidden_field :configuration_id, :value => @configuration_content.configuration_id %>  
3 -  
4 -<%= labelled_form_field _('Collector Name:'), f.text_field(:base_tool_name, :readonly => true) %>  
5 -  
6 -<% f.fields_for :metric do |m| %>  
7 - <%= m.hidden_field :compound, :value => "false" %>  
8 - <% @metric_configuration.metric.language.each do |language| %>  
9 - <%= m.hidden_field :language, :multiple => true, :value => language %>  
10 - <% end %>  
11 - <%= m.hidden_field "scope", :value => @metric.scope %>  
12 - <%= required labelled_form_field _('Metric Name:'), m.text_field(:name, :readonly => true, :value => @metric.name) %>  
13 - <%= labelled_form_field _('Description:'), m.text_field(:description, :readonly => true, :value => @metric.description) %>  
14 -<% end %>  
15 -  
16 -<%= required labelled_form_field _('Code:'), f.text_field(:code) %>  
17 -  
18 -<%= required labelled_form_field _('Aggregation Form:'),  
19 -f.select(:aggregation_form, MezuroPlugin::Helpers::ContentViewerHelper.aggregation_options) %>  
20 -  
21 -<%= required labelled_form_field _('Weight:'), f.text_field(:weight) %>  
22 -  
23 -<%= required labelled_form_field _('Reading Group:'),  
24 -f.select(:reading_group_id, @reading_group_names_and_ids) %>  
25 -  
26 -<p><%= f.submit "Save" %></p>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/_native_metric_configuration_view.rhtml
@@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
1 -<p>  
2 - <b>Collector Name:</b> <%= @metric_configuration.base_tool_name %>  
3 -</p>  
4 -<p>  
5 - <b>Metric Name:</b> <%= @metric.name %>  
6 -</p>  
7 -<p>  
8 - <b>Code:</b> <%= @metric_configuration.code %>  
9 -</p>  
10 -<p>  
11 - <b>Aggregation Form:</b> <%= @metric_configuration.aggregation_form %>  
12 -</p>  
13 -<p>  
14 - <b>Weight:</b> <%= @metric_configuration.weight %>  
15 -</p>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/choose_metric.html.erb
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2>  
2 -  
3 -<%= link_to "New Compound Metric", :controller => "mezuro_plugin_metric_configuration", :action => "new_compound",  
4 - :id => @configuration_content.id %>  
5 -  
6 -<h5>Base Tools:</h5>  
7 -<% @base_tools.each do |base_tool| %>  
8 - <h4><%= link_to base_tool.name, "#", :onclick => "jQuery(\"\##{base_tool.name}\").toggle();"%></h4>  
9 - <hr/>  
10 -  
11 - <div id="<%=base_tool.name%>" style="display:none">  
12 - <% base_tool.supported_metrics.each do |metric| %>  
13 - &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<%= link_to metric.name, :controller => "mezuro_plugin_metric_configuration", :action => "new_native",  
14 - :metric_name => metric.name, :base_tool_name => base_tool.name, :id => @configuration_content.id %>  
15 - <hr size="1" width="93%"/>  
16 - <% end %>  
17 - </div>  
18 -<% end %>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_compound.html.erb
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> -->  
3 -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> -->  
4 -  
5 -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2>  
6 -  
7 -<% owner = (not user.nil?) && user.id == @profile.id %>  
8 -  
9 -<% form_for :metric_configuration, :url => {:action =>"update", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %>  
10 - <%= f.hidden_field :id %>  
11 - <%= render :partial => "compound_metric_configuration_form", :locals => {:f => f} %>  
12 -<% end %>  
13 -  
14 -<%= render :partial => "mezuro_plugin_range/ranges", :locals => {:owner => owner} %>  
15 -<hr>  
16 -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/edit_native.html.erb
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> -->  
3 -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> -->  
4 -  
5 -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2>  
6 -  
7 -<% owner = (not user.nil?) && user.id == @profile.id %>  
8 -  
9 -<% if owner %>  
10 - <% form_for :metric_configuration, :url => {:action =>"update", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %>  
11 - <%= f.hidden_field :id %>  
12 - <%= render :partial => "native_metric_configuration_form", :locals => {:f => f} %>  
13 - <% end %>  
14 -<% else %>  
15 - <%= render :partial => "native_metric_configuration_view" %>  
16 -<% end %>  
17 -  
18 -<%= render :partial => "mezuro_plugin_range/ranges", :locals => {:owner => owner} %>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/new_compound.html.erb
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2>  
2 -  
3 -<% form_for :metric_configuration, :url => {:action =>"create", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %>  
4 - <%= render :partial => "compound_metric_configuration_form", :locals => {:f => f} %>  
5 -<% end %>  
6 -  
7 -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %>  
plugins/mezuro/views/mezuro_plugin_metric_configuration/new_native.html.erb
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -  
3 -<h2><%= link_to("#{@configuration_content.name} Configuration", @configuration_content.view_url) %></h2>  
4 -  
5 -<% form_for :metric_configuration, :url => {:action =>"create", :controller => "mezuro_plugin_metric_configuration"}, :method => :get do |f| %>  
6 - <%= render :partial => "native_metric_configuration_form", :locals => {:f => f} %>  
7 -<% end %>  
plugins/mezuro/views/mezuro_plugin_module_result/_error_page.html.erb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @message %>  
plugins/mezuro/views/mezuro_plugin_module_result/_metric_results.rhtml
@@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
1 -<thead>  
2 - <tr>  
3 - <th style="width: 74%">Metric</th>  
4 - <th>Value</th>  
5 - <th>Weight</th>  
6 - <th>Threshold</th>  
7 - </tr>  
8 -</thead>  
9 -<tbody>  
10 - <% @metric_results.each do |metric_result| %>  
11 - <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%>  
12 - <% range_snapshots = metric_configuration_snapshot.range_snapshot %>  
13 - <% metric_name = metric_configuration_snapshot.metric.name %>  
14 - <% formatted_name = metric_name.delete("() ") %>  
15 - <% if !range_snapshots.nil? %>  
16 - <tr>  
17 - <td style="width: 74%"><a href="#" show-metric-history="<%= formatted_name %>" data-metric-name="<%= metric_name %>" data-module-id="<%= @module_result.id %>"><%= metric_name %></a></td>  
18 - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td>  
19 - <td><%= metric_configuration_snapshot.weight %></td>  
20 - <% range_snapshots.each do |range_snapshot| %>  
21 - <% if range_snapshot.beginning <= metric_result.value and range_snapshot.end > metric_result.value %>  
22 - <td style="background-color: #<%= range_snapshot.color %>">  
23 - <span title="<%= range_snapshot.comments %>" >  
24 - <%= range_snapshot.label %>  
25 - </span>  
26 - </td>  
27 - </tr>  
28 - <tr class="<%= formatted_name %>" style="display: none;">  
29 - <td colspan="3">  
30 - <div id='historical-<%= formatted_name %>'>  
31 - </div>  
32 - </td>  
33 - <td align="right">  
34 - <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %>  
35 - </td>  
36 - </tr>  
37 - <% end %>  
38 - <% end %>  
39 - <% end %>  
40 - <% end %>  
41 -</tbody>  
plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -<%= render :partial => "source_tree", :locals => {:module_result => @module_result} %>  
2 -<h5><%= _"Metric results for: #{MezuroPlugin::Helpers::ModuleResultHelper.module_name(@module_result.module.name)} (#{@module_result.module.granularity})" %> </h5>  
3 -  
4 -<hr/>  
5 -<div class="zoomable-image">  
6 -<table style="width: 100%">  
7 - <%= render :partial => "metric_results", :locals => {:metric_results => @metric_results, :module_result_id => @module_result.id} %>  
8 - <tfoot>  
9 - <tr>  
10 - <td colspan = "3">  
11 - <div id='historical-grade' style="display: none;"></div>  
12 - </td>  
13 - <td align = "right">  
14 - <a href="#" show-grade-history="<%= @module_result.id %>" data-module-id="<%= @module_result.id %>" >  
15 - <strong>  
16 - <%= _('Grade:') %>  
17 - <%= "%.02f" % @module_result.grade %>  
18 - </strong>  
19 - </a>  
20 - </td>  
21 - </tr>  
22 - </tfoot>  
23 -</table>  
24 -</div>  
plugins/mezuro/views/mezuro_plugin_module_result/_score_history.rhtml
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -<%= image_tag(MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(@history)) %>  
plugins/mezuro/views/mezuro_plugin_module_result/_source_tree.rhtml
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -<h4><%= _('Source tree') %></h4>  
2 -<% helper = MezuroPlugin::Helpers::ModuleResultHelper %>  
3 -<% module_name = helper.module_name(module_result.module.name) %>  
4 -<% module_label = "#{module_name} (#{module_result.module.granularity})" %>  
5 -  
6 -<p>  
7 - <h2 class="path">  
8 - <% module_result.parents.each do |parent| %>  
9 - /<a href="#" class="source-tree-link" data-module-id="<%= parent.id %>">  
10 - <%= helper.module_name parent.module.name %>  
11 - </a>  
12 - <% end %>/ <%= helper.module_name module_name %>  
13 - </h2>  
14 -</p>  
15 -  
16 -<table border="0" class="source-tree">  
17 - <% module_result.children.each do |child| %>  
18 - <% if child.module.granularity=='PACKAGE' %>  
19 - <tr>  
20 - <td class="icon"><%= image_tag('/plugins/mezuro/images/folder.png')%></td>  
21 - <td class="source-tree-text"><a href='#' class="source-tree-link" data-module-id="<%= child.id %>"><%= helper.module_name child.module.name %></a></td>  
22 - </tr>  
23 - <% else %>  
24 - <tr>  
25 - <td class="icon"><%= image_tag('/plugins/mezuro/images/file.png') %></td>  
26 - <td class="source-tree-text">  
27 - <a href='#' class="source-tree-link" data-module-id="<%= child.id %>">  
28 - <%= helper.module_name child.module.name %>  
29 - </a>  
30 - </td>  
31 - </tr>  
32 - <% end %>  
33 - <% end %>  
34 -</table>  
plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb
@@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
1 -<%= remote_form_for :range, :url => {:action =>"update_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %>  
2 - <%= hidden_field_tag :beginning_id, beginning_id %>  
3 - <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :id => id, :beginning_id => beginning_id, :range => range } %>  
4 -<% end %>  
plugins/mezuro/views/mezuro_plugin_myprofile/_error_page.html.erb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @message %>  
plugins/mezuro/views/mezuro_plugin_myprofile/_new_range.html.erb
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -<%= remote_form_for :range, :url => {:action =>"create_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %>  
2 - <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :id => id } %>  
3 -<% end %>  
plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb
@@ -1,81 +0,0 @@ @@ -1,81 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script>  
3 -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script>  
4 -  
5 -<h2><%= @configuration_content.name %> Configuration</h2>  
6 -  
7 -<%= form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %>  
8 - <%= hidden_field_tag :id, @configuration_content.id %>  
9 - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %>  
10 -  
11 - <p>  
12 - <%= "Metric Name:" + @metric.name %>  
13 - </p>  
14 - <% f.fields_for :metric do |m| %>  
15 - <%= m.hidden_field :name, :value => @metric.name %>  
16 - <p>  
17 - <%= m.label :description, "Description:" %>  
18 - <%= m.text_field "description", :value => @metric.description %>  
19 - </p>  
20 - <p>  
21 - <%= m.label :scope, "Scope:" %>  
22 - <%= m.select :scope, [["Class", "CLASS"]], :selected => @metric.scope %>  
23 - </p>  
24 - <p>  
25 - <%= m.label :script, "Script:" %>  
26 - <%= m.text_area "script", :value => @metric.script %>  
27 - </p>  
28 - <% end %>  
29 - <p>  
30 - <%= f.label :code, "Code:" %>  
31 - <%= f.text_field "code" %>  
32 - </p>  
33 - <p>  
34 - <%= f.label :aggregation_form, "Aggregation Form:" %>  
35 - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],  
36 - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %>  
37 - </p>  
38 - <p>  
39 - <%= f.label :weight, "Weight:" %>  
40 - <%= f.text_field :weight %>  
41 - </p>  
42 - <p>  
43 - <%= f.submit "Save" %>  
44 - </p>  
45 -<% end %>  
46 -  
47 -  
48 -<h5> Ranges </h5><br/>  
49 -  
50 -<table id="ranges">  
51 - <tr>  
52 - <td>  
53 - Label  
54 - </td>  
55 - <td>  
56 - Beginning  
57 - </td>  
58 - <td>  
59 - End  
60 - </td>  
61 - <td>  
62 - Grade  
63 - </td>  
64 - <td>  
65 - Color  
66 - </td>  
67 - </tr>  
68 - <% if (@metric_configuration.ranges!=nil)  
69 - @metric_configuration.ranges.each do |range| %>  
70 - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id,  
71 - :metric_name => @metric_configuration.metric.name} %>  
72 - <% end  
73 - end %>  
74 -</table>  
75 -  
76 -<br/>  
77 -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :id => @configuration_content.id, :metric_name => @metric.name} %>  
78 -<div id="range_form" style="display:none"></div>  
79 -  
80 -<br/>  
81 -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %>  
plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb
@@ -1,89 +0,0 @@ @@ -1,89 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.min.js" type="text/javascript"></script>  
3 -<script src="/plugins/mezuro/javascripts/colorPicker/jquery.colorPicker.js" type="text/javascript"></script>  
4 -  
5 -<h2><%= @configuration_content.name %> Configuration</h2>  
6 -  
7 -<%= form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %>  
8 - <%= hidden_field_tag :id, @configuration_content.id %>  
9 - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %>  
10 -  
11 - <% f.fields_for :metric do |m| %>  
12 -  
13 - <% @metric.language.each do |language| %>  
14 - <%= m.hidden_field :language, :multiple => true, :value => language %>  
15 - <% end %>  
16 -  
17 - <%= m.hidden_field "scope", :value => @metric.scope %>  
18 - <p>  
19 - <%= m.label :origin, "Collector Name:" %>  
20 - <%= @metric.origin %>  
21 - <%= m.hidden_field "origin", :value => @metric.origin %>  
22 - </p>  
23 - <p>  
24 - <%= m.label :metric_name, "Metric Name:" %>  
25 - <%= @metric.name %>  
26 - <%= m.hidden_field "name", :value => @metric.name %>  
27 - </p>  
28 - <!--<p>-->  
29 - <% m.label :description, "Description:" %>  
30 - <% @metric.description %>  
31 - <% m.hidden_field "description", :value => @metric.description %>  
32 - <!--</p>-->  
33 - <% end %>  
34 - <p>  
35 - <%= f.label :code, "Code:" %>  
36 - <%= @metric_configuration.code %>  
37 - <%= f.hidden_field "code", :value => @metric_configuration.code %>  
38 - </p>  
39 - <p>  
40 - <%= f.label :aggregation_form, "Aggregation Form:" %>  
41 - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],  
42 - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %>  
43 - </p>  
44 - <p>  
45 - <%= f.label :weight, "Weight:" %>  
46 - <%= f.text_field "weight", :value => @metric_configuration.weight %>  
47 - </p>  
48 -  
49 - <p>  
50 - <%= f.submit "Save" %>  
51 - </p>  
52 -<% end %>  
53 -  
54 -  
55 -<h5> Ranges </h5><br/>  
56 -  
57 -<table id="ranges">  
58 - <tr>  
59 - <td>  
60 - Label  
61 - </td>  
62 - <td>  
63 - Beginning  
64 - </td>  
65 - <td>  
66 - End  
67 - </td>  
68 - <td>  
69 - Grade  
70 - </td>  
71 - <td>  
72 - Color  
73 - </td>  
74 - <td></td>  
75 - <td></td>  
76 - </tr>  
77 - <% if (@metric_configuration.ranges!=nil)  
78 - @metric_configuration.ranges.each do |range| %>  
79 - <%= render :partial => "range", :locals => {:range => range, :id => @configuration_content.id,  
80 - :metric_name => @metric.name} %>  
81 - <% end  
82 - end %>  
83 -</table>  
84 -  
85 -<br/>  
86 -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :id => @configuration_content.id, :metric_name => @metric.name} %>  
87 -<div id="range_form" style="display:none"></div>  
88 -  
89 -  
plugins/mezuro/views/mezuro_plugin_myprofile/error_page.html.erb
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @message %>  
3 -<!-- The <%=h is for escaping the URL properly --!>  
plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric_configuration.html.erb
@@ -1,44 +0,0 @@ @@ -1,44 +0,0 @@
1 -<h2><%= @configuration_content.name %> Configuration</h2>  
2 -  
3 -<%= form_for :metric_configuration, :url => {:action =>"create_compound_metric_configuration",  
4 -:controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %>  
5 - <%= hidden_field_tag :id, @configuration_content.id %>  
6 - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %>  
7 -  
8 - <% f.fields_for :metric do |m| %>  
9 - <p>  
10 - <%= m.label :name, "Name:" %>  
11 - <%= m.text_field "name" %>  
12 - </p>  
13 - <p>  
14 - <%= m.label :description, "Description:" %>  
15 - <%= m.text_field "description" %>  
16 - </p>  
17 - <p>  
18 - <%= m.label :scope, "Scope:" %>  
19 - <%= m.select :scope, [["Class", "CLASS"]] %>  
20 - </p>  
21 - <p>  
22 - <%= m.label :script, "Script:" %>  
23 - <%= m.text_area "script" %>  
24 - </p>  
25 - <% end %>  
26 - <p>  
27 - <%= f.label :code, "Code:" %>  
28 - <%= f.text_field "code" %>  
29 - </p>  
30 - <p>  
31 - <%= f.label :aggregation_form, "Aggregation Form:" %>  
32 - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],  
33 - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %>  
34 - </p>  
35 - <p>  
36 - <%= f.label :weight, "Weight:" %>  
37 - <%= f.text_field :weight %>  
38 - </p>  
39 - <p>  
40 - <%= f.submit "Add" %>  
41 - </p>  
42 -<% end %>  
43 -  
44 -<%= render :partial => "metric_codes", :locals => {:metric_configurations => @metric_configurations} %>  
plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb
@@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -  
3 -<h2><%= @configuration_content.name %> Configuration</h2>  
4 -  
5 -<%= form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %>  
6 - <%= hidden_field_tag :id, @configuration_content.id %>  
7 - <%= f.hidden_field :configuration_name, :value => @configuration_content.name %>  
8 -  
9 - <% f.fields_for :metric do |m| %>  
10 -  
11 - <% @metric.language.each do |language| %>  
12 - <%= m.hidden_field :language, :multiple => true, :value => language %>  
13 - <% end %>  
14 -  
15 - <%= m.hidden_field "scope", :value => @metric.scope %>  
16 - <p>  
17 - <%= m.label :origin, "Collector Name:" %>  
18 - <%= @metric.origin %>  
19 - <%= m.hidden_field "origin", :value => @metric.origin %>  
20 - </p>  
21 - <p>  
22 - <%= m.label :name, "Metric Name:" %>  
23 - <%= @metric.name %>  
24 - <%= m.hidden_field "name", :value => @metric.name %>  
25 - </p>  
26 - <!--<p>-->  
27 - <% m.label :description, "Description:" %>  
28 - <% @metric.description %>  
29 - <% m.hidden_field "description", :value => @metric.description %>  
30 - <!--</p>-->  
31 - <% end %>  
32 - <p>  
33 - <%= f.label :code, "Code:" %>  
34 - <%= f.text_field :code %>  
35 - </p>  
36 - <p>  
37 - <%= f.label :aggregation_form, "Aggregation Form:" %>  
38 - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],  
39 - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %>  
40 - </p>  
41 - <p>  
42 - <%= f.label :weight, "Weight:" %>  
43 - <%= f.text_field :weight %>  
44 - </p>  
45 -  
46 - <p>  
47 - <%= f.submit "Add" %>  
48 - </p>  
49 -  
50 -<% end %>  
51 -  
plugins/mezuro/views/mezuro_plugin_processing/_error_page.html.erb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @processing.error.message %>  
plugins/mezuro/views/mezuro_plugin_processing/_processing.rhtml
@@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
1 -<div id="current_processing_date" data-date="<%= @processing.date %>"/>  
2 -  
3 -<h4><%= _('Last Result') %></h4>  
4 -  
5 -<table>  
6 - <tr>  
7 - <td><%= _('Date') %></td>  
8 - <td><%= @processing.date.inspect %></td>  
9 - </tr>  
10 - <% @processing.process_time.each do |process_time| %>  
11 - <tr>  
12 - <td><%= _(process_time.state + ' time') %></td>  
13 - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_time(process_time.time) %></td>  
14 - </tr>  
15 - <% end %>  
16 - <tr>  
17 - <td>Click to choose specific date:</td>  
18 - <td><%= link_to(image_tag('/images/calendar_date_select/calendar.png', :width => 20, :height => 20, :onClick => "$( 'datepicker' ).toggle();"), "javascript:void(0)") %></td>  
19 - </tr>  
20 -</table>  
21 -  
22 -<div id="datepicker"></div>  
23 -  
24 -<script>  
25 - jQuery(document).ready(function($) {  
26 - $("#datepicker").datepicker({  
27 - onSelect: function(dateText, inst) {  
28 - reloadProcessingWithDate(dateText) } });  
29 - $("#datepicker").toggle();  
30 - var date = jQuery("#current_processing_date").attr('data-date').substr(0,10);  
31 - $("#datepicker").datepicker( "setDate" , date.substr(5,2)+"/"+date.substr(8,2)+"/"+date.substr(0,4));  
32 -  
33 - });  
34 -</script>  
35 -  
36 -<span id="module_result_root_id" module_result_root_id="<%= @processing.results_root_id %>">  
plugins/mezuro/views/mezuro_plugin_processing/_processing_error.rhtml
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -<h3><%= _('ERROR') %></h3>  
2 -<p>  
3 - <%= "State when error ocurred: #{@processing.state}" %>  
4 - <br/>  
5 - <% error = @processing.error %>  
6 - <%= error.message %>  
7 -<ul>  
8 - <% error.stack_trace.each do |trace| %>  
9 - <li><%= "#{trace.declaring_class}.#{trace.method_name}(#{trace.file_name}:#{trace.line_number})" %></li>  
10 - <% end %>  
11 -</ul>  
12 -</p>  
plugins/mezuro/views/mezuro_plugin_profile/_error_page.html.erb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @message %>  
plugins/mezuro/views/mezuro_plugin_range/_edit.html.erb
@@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
1 -<% remote_form_for :range, :url => {:action =>"update", :controller => "mezuro_plugin_range"}, :method => :get do |f| %>  
2 - <%= hidden_field_tag :beginning_id, @beginning_id %>  
3 - <%= render :partial => "form", :locals => {:f => f} %>  
4 -<% end %>  
plugins/mezuro/views/mezuro_plugin_range/_error_page.html.erb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @message %>  
plugins/mezuro/views/mezuro_plugin_range/_form.html.erb
@@ -1,37 +0,0 @@ @@ -1,37 +0,0 @@
1 -<%= hidden_field_tag :id, @content_id %>  
2 -<%= hidden_field_tag :metric_configuration_id, @metric_configuration_id %>  
3 -<%= hidden_field_tag :reading_group_id, @reading_group_id %>  
4 -<%= hidden_field_tag :compound, @compound %>  
5 -  
6 -<%= f.hidden_field :id %>  
7 -  
8 - <%= required labelled_form_field _('Label'),  
9 - f.select(:reading_id, @reading_labels_and_ids) %><br/>  
10 -<table>  
11 - <tr>  
12 - <td>  
13 - <%= f.label :beginning, "(*) Beginning:" %>  
14 - </td>  
15 - <td>  
16 - <%= required f.text_field :beginning, :id => "range_beginning" %>&nbsp;<%= link_to('-&#8734', 'javascript:void(0)', :onClick => "jQuery( '#range_beginning' ).val('-INF');") %>  
17 - </td>  
18 - </tr>  
19 - <tr>  
20 - <td>  
21 - <%= f.label :end, "(*) End:" %>  
22 - </td>  
23 - <td>  
24 - <%= required f.text_field(:end, :id => "range_end") %>&nbsp;<%= link_to('+&#8734', 'javascript:void(0)', :onClick => "jQuery( '#range_end' ).val('+INF');") %>  
25 - </td>  
26 - </tr>  
27 - <tr>  
28 - <td>  
29 - <%= f.label :comments, "(*) Comments:" %>  
30 - </td>  
31 - <td>  
32 - <%= required f.text_area :comments, :rows => 3 %>  
33 - </td>  
34 - </tr>  
35 -</table>  
36 -<br/>  
37 -<%= f.submit "Save Range" %>  
plugins/mezuro/views/mezuro_plugin_range/_new.html.erb
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -<% remote_form_for :range, :url => {:action =>"create", :controller => "mezuro_plugin_range"}, :method => :get do |f| %>  
2 - <%= render :partial => "form", :locals => {:f => f} %>  
3 -<% end %>  
plugins/mezuro/views/mezuro_plugin_range/_range.html.erb
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -<tr>  
2 - <td>  
3 - <%=range.label%>  
4 - </td>  
5 - <td>  
6 - <%=range.beginning%>  
7 - </td>  
8 - <td>  
9 - <%=range.end%>  
10 - </td>  
11 - <td>  
12 - <%=range.grade%>  
13 - </td>  
14 - <td bgcolor="#<%= range.color %>"></td>  
15 - <% if (not user.nil?) && user.id == @profile.id %>  
16 - <td><%= 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} %>  
17 - </td>  
18 - <td><%= 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 %>  
19 - </td>  
20 - <% else %>  
21 - <td></td>  
22 - <td></td>  
23 - <% end %>  
24 -</tr>  
plugins/mezuro/views/mezuro_plugin_range/_ranges.html.erb
@@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
1 -<h5> Ranges </h5><br/>  
2 -  
3 -<table id="ranges">  
4 - <tr>  
5 - <td>  
6 - Label  
7 - </td>  
8 - <td>  
9 - Beginning  
10 - </td>  
11 - <td>  
12 - End  
13 - </td>  
14 - <td>  
15 - Grade  
16 - </td>  
17 - <td>  
18 - Color  
19 - </td>  
20 - </tr>  
21 - <% @ranges.each do |range| %>  
22 - <%= render :partial => "mezuro_plugin_range/range", :locals => {:range => range, :id => @configuration_content.id,  
23 - :metric_configuration_id => @metric_configuration.id, :reading_group_id => @metric_configuration.reading_group_id, :compound => @metric_configuration.metric.compound} %>  
24 - <% end %>  
25 -</table>  
26 -  
27 -<br/>  
28 -<% if owner %>  
29 - <%= 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} %>  
30 -<% end %>  
31 -<div id="form" style="display:none"></div>  
plugins/mezuro/views/mezuro_plugin_range/create.rjs
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -if @error.nil?  
2 - page.visual_effect :toggle_slide, "form"  
3 - page.insert_html :bottom, "ranges", :partial => "range", :locals => {:range => @range, :reading_group_id => @reading_group_id, :compound => @compound}  
4 -else  
5 - page.alert @error  
6 -end  
plugins/mezuro/views/mezuro_plugin_range/edit.rjs
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -page.replace_html 'form', :partial => "edit", :locals => {:range => @range}  
2 -page.visual_effect :slide_down, "form"  
3 -  
plugins/mezuro/views/mezuro_plugin_range/new.rjs
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -page.replace_html 'form', :partial => "new"  
2 -page.visual_effect :slide_down, "form"  
3 -  
plugins/mezuro/views/mezuro_plugin_range/update.rjs
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -if @error.nil?  
2 - page.reload()  
3 -else  
4 - page.alert @error  
5 -end  
plugins/mezuro/views/mezuro_plugin_reading/_form.html.erb
@@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
1 -<%= hidden_field_tag :id, @reading_group_content.id %>  
2 -<%= f.hidden_field(:group_id, :value => @reading_group_content.reading_group_id) %>  
3 -  
4 -<%= required labelled_form_field _('Label:'), f.text_field(:label) %>  
5 -  
6 -<%= required labelled_form_field _('Grade:'), f.text_field(:grade) %>  
7 -  
8 -<%= required labelled_form_field _('Color:'),  
9 -colorpicker_field(:reading, :color) %>Click in the field to change Color  
10 -  
11 -<div id="labels_and_grades" data-list="<%= @labels_and_grades %>" data-parser="<%= @parser %>"/>  
12 -  
13 -<p><%= f.submit "Save" %></p>  
plugins/mezuro/views/mezuro_plugin_reading/edit.html.erb
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> -->  
2 -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> -->  
3 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
4 -  
5 -<h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2>  
6 -  
7 -<% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %>  
8 - <%= f.hidden_field :id %>  
9 - <%= render :partial => "form", :locals => {:f => f} %>  
10 -<% end %>  
plugins/mezuro/views/mezuro_plugin_reading/new.html.erb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -<!-- <script src="/javascripts/colorpicker.js" type="text/javascript"></script> -->  
2 -<!-- <script src="/javascripts/colorpicker-noosfero.js" type="text/javascript"></script> -->  
3 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
4 -  
5 -<h2><%= link_to("#{@reading_group_content.name} Reading Group", @reading_group_content.view_url) %></h2>  
6 -  
7 -<% form_for :reading, :url => {:action =>"save", :controller => "mezuro_plugin_reading"}, :method => :get do |f| %>  
8 - <%= render :partial => "form", :locals => {:f => f} %>  
9 -<% end %>  
plugins/mezuro/views/mezuro_plugin_repository/_error_page.html.erb
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -<h2> An error occured: </h2>  
2 -<%= @message %>  
plugins/mezuro/views/mezuro_plugin_repository/_form.html.erb
@@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
1 -<%= hidden_field_tag :id, @project_content.id %>  
2 -<%= f.hidden_field(:project_id, :value => @project_content.project_id) %>  
3 -  
4 -<%= required labelled_form_field _('Name'), f.text_field(:name) %>  
5 -  
6 -<%= labelled_form_field _("Description"), f.text_field(:description) %>  
7 -  
8 -<%= required labelled_form_field _('License'),  
9 -f.select(:license, MezuroPlugin::Helpers::ContentViewerHelper.license_options) %>  
10 -  
11 -<%= required labelled_form_field _('Process Period'),  
12 -f.select(:process_period, MezuroPlugin::Helpers::ContentViewerHelper.periodicity_options) %>  
13 -  
14 -<%= required labelled_form_field _('Type'),  
15 -f.select(:type, @repository_types) %>  
16 -  
17 -<%= required labelled_form_field _('Address'),  
18 -f.text_field(:address) %>  
19 -  
20 -<%= required labelled_form_field _('Configuration'),  
21 -f.select(:configuration_id, @configuration_select) %>  
22 -  
23 -<p> <%= f.submit "Add" %> </p>  
plugins/mezuro/views/mezuro_plugin_repository/edit.html.erb
@@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -  
3 -<h2><%= link_to("#{@project_content.name} Project", @project_content.view_url) %></h2>  
4 -<% form_for :repository, :url => {:action =>"save", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %>  
5 - <%= f.hidden_field :id %>  
6 - <%= render :partial => "form", :locals => {:f => f} %>  
7 -<% end %>  
plugins/mezuro/views/mezuro_plugin_repository/new.html.erb
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/validations.js" type="text/javascript"></script>  
2 -  
3 -<h2><%= link_to("#{@project_content.name} Project", @project_content.view_url) %></h2>  
4 -<% form_for :repository, :url => {:action =>"save", :controller => "mezuro_plugin_repository"}, :method => :get do |f| %>  
5 - <%= render :partial => "form", :locals => {:f => f} %>  
6 -<% end %>  
plugins/mezuro/views/mezuro_plugin_repository/show.html.erb
@@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
1 -<script src="/plugins/mezuro/javascripts/processing.js" type="text/javascript"></script>  
2 -<h2><%= link_to("#{@project_content.name} Project", @project_content.view_url) %></h2>  
3 -  
4 -<table>  
5 - <tr>  
6 - <td><%= _('Name') %></td>  
7 - <td><%= @repository.name %></td>  
8 - </tr>  
9 - <tr>  
10 - <td><%= _('Description') %></td>  
11 - <td><%= @repository.description %></td>  
12 - </tr>  
13 - <tr>  
14 - <td><%= _('License') %></td>  
15 - <td><%= @repository.license %></td>  
16 - </tr>  
17 - <tr>  
18 - <td><%= _('Process Period') %></td>  
19 - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.periodicity_option(@repository.process_period.to_i) %></td>  
20 - </tr>  
21 - <tr>  
22 - <td><%= _('Type') %></td>  
23 - <td><%= @repository.type %></td>  
24 - </tr>  
25 - <tr>  
26 - <td><%= _('Address') %></td>  
27 - <td><%= @repository.address %></td>  
28 - </tr>  
29 - <tr>  
30 - <td><%= _('Configuration') %></td>  
31 - <td><%= @configuration_name %></td>  
32 - </tr>  
33 - <tr>  
34 - <td><%= _('Status')%></td>  
35 - <td>  
36 - <div id="processing-state" style="color:DarkGoldenRod">Retrieving</div>  
37 - <div id="msg-time"></div>  
38 - </td>  
39 - </tr>  
40 -</table>  
41 -<br />  
42 -  
43 -<div id="processing" data-profile="<%= @project_content.profile.identifier %>" data-content="<%= @project_content.id %>"  
44 - data-repository-id="<%= @repository.id %>"></div>  
45 -<div id="module-result"></div>