diff options
13 files changed, 15 insertions, 536 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java index 0b22c904e59..44e3b343aa0 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java @@ -81,7 +81,6 @@ import org.sonar.plugins.core.timemachine.NewOverallCoverageFileAnalyzer; import org.sonar.plugins.core.timemachine.TendencyDecorator; import org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister; import org.sonar.plugins.core.timemachine.VariationDecorator; -import org.sonar.plugins.core.web.TestsViewer; import org.sonar.plugins.core.widgets.AlertsWidget; import org.sonar.plugins.core.widgets.BubbleChartWidget; import org.sonar.plugins.core.widgets.ComplexityWidget; @@ -271,9 +270,6 @@ public final class CorePlugin extends SonarPlugin { UserManagedMetrics.class, Periods.class, - // pages - TestsViewer.class, - // measure filters ProjectFilter.class, MyFavouritesFilter.class, diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java deleted file mode 100644 index 894c54fded7..00000000000 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/TestsViewer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.plugins.core.web; - -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.resources.Qualifiers; -import org.sonar.api.web.*; - -@ResourceQualifier(Qualifiers.UNIT_TEST_FILE) -@NavigationSection(NavigationSection.RESOURCE_TAB) -@DefaultTab(metrics = { - CoreMetrics.TESTS_KEY, CoreMetrics.TEST_EXECUTION_TIME_KEY, CoreMetrics.TEST_SUCCESS_DENSITY_KEY, - CoreMetrics.TEST_FAILURES_KEY, CoreMetrics.TEST_ERRORS_KEY, CoreMetrics.SKIPPED_TESTS_KEY}) -@UserRole(UserRole.USER) -public class TestsViewer extends AbstractRubyTemplate implements RubyRailsPage { - - public String getId() { - return "tests_viewer"; - } - - public String getTitle() { - return "Tests"; - } - - @Override - protected String getTemplatePath() { - return "/org/sonar/plugins/core/web/tests_viewer.html.erb"; - } -} diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/package-info.java deleted file mode 100644 index 09ed3e65f6b..00000000000 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/web/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -@ParametersAreNonnullByDefault -package org.sonar.plugins.core.web; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb deleted file mode 100644 index 4314fded31d..00000000000 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb +++ /dev/null @@ -1,140 +0,0 @@ -<div class="tab_header tests_viewer tests_header"> - <table> - <tr> - <% test_success_density = measure('test_success_density') %> - <td id="test_success_density" class=" big"><%= test_success_density ? number_with_precision(test_success_density.value(), :precision => 1) : "100.0" -%>%</td> - <td class="sep"></td> - <td class="name"><%= message('test_viewer.tests') -%>:</td> - <% - tests = measure('tests') - tests_display = tests ? format_measure(tests) : "-" - skipped_tests = measure('skipped_tests') - if skipped_tests - tests_display = tests_display + " (+" + format_measure(skipped_tests) + " " + message('test_viewer.skipped') + ")" - end - %> - <td id="tests" class="value"><%= tests_display -%></td> - <td class="sep"></td> - <td class="name"><%= message('test_viewer.failures') -%>/<%= message('test_viewer.errors') -%>:</td> - <% - test_failures = measure('test_failures') ? format_measure(measure('test_failures')) : "0" - test_errors = measure('test_errors') ? format_measure(measure('test_errors')) : "0" - %> - <td id="test_failures_errors" class="value"><%= test_failures -%>/<%= test_errors -%></td> - <td class="sep"></td> - <td class="name"><%= message('test_viewer.duration') -%>:</td> - <% test_execution_time = measure('test_execution_time') %> - <td id="test_execution_time" class="value"><%= test_execution_time ? format_measure(test_execution_time) : "-" -%></td> - </tr> - </table> -</div> - -<% - test_cases = [] - has_covered_lines = false - - test_data = measure('test_data') - if test_data - blocks = REXML::Document.new test_data.data - blocks.elements.each("tests-details/testcase") do |block| - test_case = {} - test_case[:name] = block.attributes['name'] - test_case[:status] = block.attributes['status'].upcase - test_case[:time] = block.attributes['time'] - - error = block.elements['error'] - block_message = !error.nil? ? error : nil - failure = block.elements['failure'] - block_message = !failure.nil? ? failure : block_message - test_case[:message] = block_message.attributes['message'] if block_message - test_case[:stack_trace] = block_message.first.to_s if test_case[:message] - test_cases << test_case - end - else - # New Test API - test_plan = controller.java_facade.testPlan(@snapshot.id) - if test_plan - test_plan.testCases().each do |test| - test_case = {} - test_case[:name] = test.name - test_case[:status] = test.status.name - test_case[:time] = test.durationInMs - has_covered_lines ||= test.doesCover - test_case[:covered_lines] = test.countCoveredLines if test.doesCover - if test.status().to_s != 'ok' - test_case[:message] = '' - test_case[:message] = test.message if test.message - test_case[:stack_trace] = html_escape(test.stackTrace) - end - test_cases << test_case - end - end - end - test_cases = test_cases.sort_by { |test_case| test_case[:name] } -%> -<% if !test_cases.empty? %> - <table class="data width100 tests_viewer" id="test_data"> - <thead class="tests-viewer-head"> - <tr> - <th class="thin"> </th> - <th class="thin right"><%= message('test_viewer.duration') -%></th> - <% if has_covered_lines %> - <th class="thin" nowrap><%= message('test_viewer.covered_lines') -%></th> - <% end %> - <th><%= message('test_viewer.unit_test_name') -%></th> - </tr> - </thead> - <tbody class="tests-viewer-body"> - - <% - test_cases.each_with_index do |test_case, index| - %> - <tr class="<%= cycle("even", "odd") -%> testdata_<%= index -%>" display="table-row"> - <td class="thin" nowrap> - <img id="test_status_<%= index -%>_<%= test_case[:status] -%>" src="<%= ApplicationController.root_context + "/images/test/" + test_case[:status] + ".png" -%>"/> - </td> - <td id="test_time_<%= index -%>" class="thin right" nowrap><%= test_case[:time] -%> ms</td> - <% if has_covered_lines %> - <td id="test_covered_lines_<%= index -%>" class="test-covered-lines-<%= index -%>" class="thin right" nowrap> - <a id="test_covered_lines_link_<%= index -%>" class="test-overed-lines-link-<%= index -%>" - href="<%= ApplicationController.root_context -%>/test/testcase/<%= h @snapshot.resource.key -%>?test=<%= test_case[:name] -%>" - onclick="openAccordionItem(this.href, this); return false;"><%= number_with_precision(test_case[:covered_lines], :precision => 0) -%> - </a> - </td> - <% end %> - <td> - <span class="test_name_<%= index -%>"> - <% name = test_case[:name] %> - <% if !test_case[:message].blank? || !test_case[:stack_trace].blank? %> - <a class="test_expandLink_<%= index -%>" href="#" onclick="expandTests(<%= index -%>, this);"><%= name -%></a> - <a class="test_collapseLink_<%= index -%>" class="collapse" href="#" onclick="collapseTests(<%= index -%>, this);" style="display: none;"><%= name -%></a> - <% else %> - <%= name -%> - <% end %> - </span> - - <% if !test_case[:message].blank? || !test_case[:stack_trace].blank? %> - <div class="test_message_<%= index -%> message" style="display:none; margin-top:5px;"> - <% message = test_case[:message] %> - <% if !message.nil? %> - <span><%= h message -%></span> - <% end %> - <pre style="border: 1px solid #ddd; padding: 5px; margin: 5px 0"><%= test_case[:stack_trace] -%></pre> - </div> - <% end %> - </td> - </tr> - - <% - end - %> - </tbody> - </table> - -<% - else -%> - <p><%= message('no_data') -%></p> -<% - end -%>
\ No newline at end of file diff --git a/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java b/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java deleted file mode 100644 index caa02568abc..00000000000 --- a/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.ui; - -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.resources.Qualifiers; -import org.sonar.api.web.*; - -/** - * @since 2.7 - */ -public final class DefaultPages { - - private static final View[] PAGES = {new SourceTab(), new CoverageTab(), new IssuesTab(), new DuplicationsTab()}; - private static final String NOT_APPLICABLE = "browse/index"; - - private DefaultPages() { - } - - public static View[] getPages() { - return PAGES.clone(); - } - - // should be qualifier FILE only but waiting for java refactoring - @NavigationSection(NavigationSection.RESOURCE_TAB) - @DefaultTab - @ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS, Qualifiers.UNIT_TEST_FILE}) - @UserRole(UserRole.USER) - private static final class SourceTab implements RubyRailsPage { - public String getTemplate() { - return NOT_APPLICABLE; - } - - public String getId() { - return "source"; - } - - public String getTitle() { - return "Source"; - } - } - - @NavigationSection(NavigationSection.RESOURCE_TAB) - @ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS}) - @DefaultTab( - metrics = { - /* unit tests */ - CoreMetrics.COVERAGE_KEY, CoreMetrics.LINES_TO_COVER_KEY, CoreMetrics.UNCOVERED_LINES_KEY, CoreMetrics.LINE_COVERAGE_KEY, - CoreMetrics.CONDITIONS_TO_COVER_KEY, CoreMetrics.UNCOVERED_CONDITIONS_KEY, CoreMetrics.BRANCH_COVERAGE_KEY, - CoreMetrics.NEW_COVERAGE_KEY, CoreMetrics.NEW_UNCOVERED_LINES_KEY, CoreMetrics.NEW_LINE_COVERAGE_KEY, - CoreMetrics.NEW_LINES_TO_COVER_KEY, CoreMetrics.NEW_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_CONDITIONS_TO_COVER_KEY, CoreMetrics.NEW_UNCOVERED_CONDITIONS_KEY, - - /* integration tests */ - CoreMetrics.IT_COVERAGE_KEY, CoreMetrics.IT_LINES_TO_COVER_KEY, CoreMetrics.IT_UNCOVERED_LINES_KEY, CoreMetrics.IT_LINE_COVERAGE_KEY, - CoreMetrics.IT_CONDITIONS_TO_COVER_KEY, CoreMetrics.IT_UNCOVERED_CONDITIONS_KEY, CoreMetrics.IT_BRANCH_COVERAGE_KEY, - CoreMetrics.NEW_IT_COVERAGE_KEY, CoreMetrics.NEW_IT_UNCOVERED_LINES_KEY, CoreMetrics.NEW_IT_LINE_COVERAGE_KEY, - CoreMetrics.NEW_IT_LINES_TO_COVER_KEY, CoreMetrics.NEW_IT_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_IT_CONDITIONS_TO_COVER_KEY, CoreMetrics.NEW_IT_UNCOVERED_CONDITIONS_KEY, - - /* overall tests */ - CoreMetrics.OVERALL_COVERAGE_KEY, CoreMetrics.OVERALL_LINES_TO_COVER_KEY, CoreMetrics.OVERALL_UNCOVERED_LINES_KEY, CoreMetrics.OVERALL_LINE_COVERAGE_KEY, - CoreMetrics.OVERALL_CONDITIONS_TO_COVER_KEY, CoreMetrics.OVERALL_UNCOVERED_CONDITIONS_KEY, CoreMetrics.OVERALL_BRANCH_COVERAGE_KEY, - CoreMetrics.NEW_OVERALL_COVERAGE_KEY, CoreMetrics.NEW_OVERALL_UNCOVERED_LINES_KEY, CoreMetrics.NEW_OVERALL_LINE_COVERAGE_KEY, - CoreMetrics.NEW_OVERALL_LINES_TO_COVER_KEY, CoreMetrics.NEW_OVERALL_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_OVERALL_CONDITIONS_TO_COVER_KEY, - CoreMetrics.NEW_OVERALL_UNCOVERED_CONDITIONS_KEY}) - @RequiredMeasures(anyOf = {CoreMetrics.COVERAGE_KEY, CoreMetrics.IT_COVERAGE_KEY, CoreMetrics.OVERALL_COVERAGE_KEY}) - @UserRole(UserRole.USER) - private static final class CoverageTab implements RubyRailsPage { - public String getTemplate() { - return NOT_APPLICABLE; - } - - public String getId() { - return "coverage"; - } - - public String getTitle() { - return "Coverage"; - } - } - - @NavigationSection(NavigationSection.RESOURCE_TAB) - @DefaultTab( - metrics = {CoreMetrics.WEIGHTED_VIOLATIONS_KEY, CoreMetrics.VIOLATIONS_KEY, CoreMetrics.BLOCKER_VIOLATIONS_KEY, - CoreMetrics.CRITICAL_VIOLATIONS_KEY, CoreMetrics.MAJOR_VIOLATIONS_KEY, CoreMetrics.MINOR_VIOLATIONS_KEY, CoreMetrics.INFO_VIOLATIONS_KEY, - CoreMetrics.NEW_VIOLATIONS_KEY, CoreMetrics.NEW_BLOCKER_VIOLATIONS_KEY, CoreMetrics.NEW_CRITICAL_VIOLATIONS_KEY, CoreMetrics.NEW_MAJOR_VIOLATIONS_KEY, - CoreMetrics.NEW_MINOR_VIOLATIONS_KEY, CoreMetrics.NEW_INFO_VIOLATIONS_KEY, - CoreMetrics.FALSE_POSITIVE_ISSUES_KEY, - CoreMetrics.TECHNICAL_DEBT_KEY, CoreMetrics.NEW_TECHNICAL_DEBT_KEY - }) - @ResourceQualifier( - value = {Qualifiers.FILE, Qualifiers.CLASS, Qualifiers.UNIT_TEST_FILE}) - @UserRole(UserRole.USER) - private static final class IssuesTab implements RubyRailsPage { - public String getTemplate() { - return NOT_APPLICABLE; - } - - public String getId() { - return "issues"; - } - - public String getTitle() { - return "Issues"; - } - } - - @NavigationSection(NavigationSection.RESOURCE_TAB) - @DefaultTab(metrics = {CoreMetrics.DUPLICATED_LINES_KEY, CoreMetrics.DUPLICATED_BLOCKS_KEY, CoreMetrics.DUPLICATED_FILES_KEY, CoreMetrics.DUPLICATED_LINES_DENSITY_KEY}) - @ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS}) - @UserRole(UserRole.USER) - private static final class DuplicationsTab implements RubyRailsPage { - public String getTemplate() { - return NOT_APPLICABLE; - } - - public String getId() { - return "duplications"; - } - - public String getTitle() { - return "Duplications"; - } - } -} diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index ecad707f006..4c93d8a66cb 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -31,14 +31,11 @@ import org.sonar.api.platform.PluginRepository; import org.sonar.api.resources.Language; import org.sonar.api.resources.ResourceType; import org.sonar.api.resources.ResourceTypes; -import org.sonar.api.test.MutableTestPlan; -import org.sonar.api.test.MutableTestable; -import org.sonar.api.test.TestPlan; -import org.sonar.api.test.Testable; -import org.sonar.api.web.*; -import org.sonar.core.component.SnapshotPerspectives; -import org.sonar.server.measure.MeasureFilterEngine; -import org.sonar.server.measure.MeasureFilterResult; +import org.sonar.api.web.Footer; +import org.sonar.api.web.NavigationSection; +import org.sonar.api.web.Page; +import org.sonar.api.web.RubyRailsWebservice; +import org.sonar.api.web.Widget; import org.sonar.core.persistence.Database; import org.sonar.core.preview.PreviewCache; import org.sonar.core.purge.PurgeDao; @@ -46,11 +43,17 @@ import org.sonar.core.resource.ResourceIndexerDao; import org.sonar.core.resource.ResourceKeyUpdaterDao; import org.sonar.core.timemachine.Periods; import org.sonar.server.db.migrations.DatabaseMigrator; +import org.sonar.server.measure.MeasureFilterEngine; +import org.sonar.server.measure.MeasureFilterResult; import org.sonar.server.platform.Platform; import org.sonar.server.platform.ServerIdGenerator; import org.sonar.server.platform.ServerSettings; import org.sonar.server.platform.SettingsChangeNotifier; -import org.sonar.server.plugins.*; +import org.sonar.server.plugins.InstalledPluginReferentialFactory; +import org.sonar.server.plugins.PluginDownloader; +import org.sonar.server.plugins.ServerPluginJarsInstaller; +import org.sonar.server.plugins.ServerPluginRepository; +import org.sonar.server.plugins.UpdateCenterMatrixFactory; import org.sonar.server.rule.RuleRepositories; import org.sonar.server.source.CodeColorizers; import org.sonar.server.user.NewUserNotifier; @@ -418,20 +421,4 @@ public final class JRubyFacade { public String getPeriodAbbreviation(int periodIndex) { return get(Periods.class).abbreviation(periodIndex); } - - public TestPlan testPlan(long snapshotId) { - return get(SnapshotPerspectives.class).as(MutableTestPlan.class, snapshotId); - } - - public TestPlan testPlan(String componentKey) { - return get(SnapshotPerspectives.class).as(MutableTestPlan.class, componentKey); - } - - public Testable testable(long snapshotId) { - return get(SnapshotPerspectives.class).as(MutableTestable.class, snapshotId); - } - - public Testable testable(String componentKey) { - return get(SnapshotPerspectives.class).as(MutableTestable.class, componentKey); - } } diff --git a/sonar-server/src/main/java/org/sonar/server/ui/Views.java b/sonar-server/src/main/java/org/sonar/server/ui/Views.java index 9108716d58b..bf9201934e2 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/Views.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/Views.java @@ -44,9 +44,6 @@ public class Views implements ServerComponent { } public Views(View[] views) { - for (View view : DefaultPages.getPages()) { - register(view); - } for (View view : views) { register(view); } @@ -84,7 +81,7 @@ public class Views implements ServerComponent { } public List<ViewProxy<Page>> getPagesForMetric(String section, String resourceScope, String resourceQualifier, String resourceLanguage, - String[] availableMeasures, String metric) { + String[] availableMeasures, String metric) { List<ViewProxy<Page>> result = Lists.newArrayList(); for (ViewProxy<Page> proxy : pages) { if (accept(proxy, section, resourceScope, resourceQualifier, resourceLanguage, availableMeasures) && proxy.supportsMetric(metric)) { diff --git a/sonar-server/src/main/js/resource.js b/sonar-server/src/main/js/resource.js index 35af666b403..5008fdb4285 100644 --- a/sonar-server/src/main/js/resource.js +++ b/sonar-server/src/main/js/resource.js @@ -2,25 +2,6 @@ Functions used in resource viewers */ -/* - Functions used in tests viewer - */ -function expandTests(index, elt){ - expandAccordionItem(elt); - var parent = $j(elt).closest('.test_name_'+index); - parent.find(".test_expandLink_"+ index).hide(); - parent.find(".test_collapseLink_"+ index).show(); - parent.next(".tests_viewer .test_message_"+ index).show(); -} - -function collapseTests(index, elt){ - expandAccordionItem(elt); - var parent = $j(elt).closest('.test_name_'+index); - parent.find(".test_collapseLink_"+ index).hide(); - parent.find(".test_expandLink_"+ index).show(); - parent.next(".tests_viewer .test_message_"+ index).hide(); -} - /* Source decoration functions */ function highlightUsages(event){ var isAlreadyHighlighted = false; diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb deleted file mode 100644 index a25b78309ed..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb +++ /dev/null @@ -1,52 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -class TestController < ApplicationController - - def testcase - verify_ajax_request - require_parameters :id, :test - component_key = params[:id].to_s - - @test = params[:test].to_s - @test_plan = java_facade.testPlan(component_key) - - @test_case = @test_plan.testCasesByName(@test).first - render :partial => 'test/testcase' - end - - def testable - verify_ajax_request - require_parameters :id, :line - component_key = params[:id].to_s - - @line = params[:line].to_i - @testable = java_facade.testable(component_key) - @test_case_by_test_plan = {} - @testable.testCasesOfLine(@line).each do |test_case| - test_plan = test_case.testPlan - test_cases = @test_case_by_test_plan[test_plan] - test_cases = [] unless test_cases - test_cases << test_case - @test_case_by_test_plan[test_plan] = test_cases - end - render :partial => 'test/testable' - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb index 067f707aee5..775cc1a5236 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter_display_treemap.rb @@ -140,8 +140,8 @@ class Sonar::HtmlOutput < Treemap::HtmlOutput def draw_label(node) if node.leaf - "<a onclick=\"window.open(this.href,'resource','height=800,width=900,scrollbars=1,resizable=1');return false;\" " + - "href=\"#{ApplicationController.root_context}/resource/index/#{node.rid}\">#{node_label(node)}</a>" + "<a onclick=\"window.open(this.href,'resource-#{node.rid}','height=800,width=900,scrollbars=1,resizable=1');return false;\" " + + "href=\"#{ApplicationController.root_context}/dashboard/index/#{node.rid}\">#{node_label(node)}</a>" else "<a href='#{ApplicationController.root_context}/dashboard/index/#{node.rid}'>#{node_label(node)}</a>" end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb deleted file mode 100644 index c1907a5f488..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -<div> - <div class="accordion-item-header"> - <div class="source_title"> - <div class="subtitle"><%= message('test_viewer.tests_covering', :params => [@testable.component.longName, @line]) %></div> - </div> - </div> - <div class="accordion-item-body"> - <% @test_case_by_test_plan.sort_by { |test_plan, test_cases| test_plan.component.longName }.each do |test_plan, test_cases| %> - <p style="padding: 0 0 2px 5px"> - <% resource_key = test_plan.component.key %> - <a href="<%= ApplicationController.root_context -%>/component/index#component=<%= resource_key -%>" - class="testable-testplan-link" onclick="openAccordionItem(this.href, this); return false;"><%= h test_plan.component.longName %> - </a> - </p> - <table class="data marginbottom10"> - <thead> - <tr> - <td colspan="3"></td> - </tr> - </thead> - <tbody class="testable-body"> - <% reset_cycle %> - <% test_cases.sort_by { |test_case| test_case.name }.each do |test_case| %> - <tr class="<%= cycle('even', 'odd') -%>"> - <td class="thin" nowrap> - <img src="<%= ApplicationController.root_context + "/images/test/" + test_case.status.name + ".png" -%>"/> - </td> - <td class="thin right" nowrap><%= test_case.durationInMs -%> ms</td> - <td> - <a href="<%= ApplicationController.root_context -%>/test/testcase/<%= h resource_key -%>?test=<%= test_case.name -%>" - class="testable-testcase-link" onclick="openAccordionItem(this.href, this); return false;"><%= h test_case.name -%> - </a> - </td> - </tr> - <% end %> - </tbody> - </table> - <% end %> - </div> -</div> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb deleted file mode 100644 index bf53b59b175..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<div> - <div class="accordion-item-header"> - <div class="source_title"> - <div class="subtitle"> - <%= message('test_viewer.files_covered_by', :params => [@test, @test_plan.component.longName]) %> - </div> - </div> - </div> - <div class="accordion-item-body"> - <table class="data"> - <thead class="testcase-head"> - <tr> - <th class="thin" nowrap><%= message('test_viewer.covered_lines') %></th> - <th><%= message('file') %></th> - </tr> - </thead> - <tbody class="testcase-body"> - <% @test_case.coverageBlocks.sort_by { |cover| cover.testable.component.longName }.each do |cover| - %> - <tr class="<%= cycle("even", "odd") -%>"> - <td class="right"><%= cover.lines.size -%></td> - <td> - <a href="<%= ApplicationController.root_context -%>/resource/index/<%= h cover.testable.component.key -%>?display_title=true&tab=coverage&coverage_filter=lines_covered_per_test&test_case_filter=<%= @test -%>" - class="testcase-testable-link" onclick="openAccordionItem(this.href, this); return false;"><%= h cover.testable.component.longName -%> - </a> - </td> - </tr> - <% end %> - </tbody> - </table> - </div> -</div>
\ No newline at end of file diff --git a/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java b/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java index 4ebf876be3c..e10387fb557 100644 --- a/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java +++ b/sonar-server/src/test/java/org/sonar/server/ui/ViewsTest.java @@ -63,14 +63,6 @@ public class ViewsTest { } @Test - public void should_get_resource_viewers() { - final Views views = new Views(VIEWS); - List resourceViewers = views.getPages(NavigationSection.RESOURCE_TAB); - assertThat(resourceViewers.size()).isEqualTo(1 + 4 /* default */); - assertThat(resourceViewers.contains(new ViewProxy<FakeResourceViewer>(FAKE_TAB))).isEqualTo(true); - } - - @Test public void should_get_widgets() { final Views views = new Views(VIEWS); List<ViewProxy<Widget>> widgets = views.getWidgets(null, null, null, null); |