diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-11-02 11:28:12 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-11-02 11:28:50 +0100 |
commit | 13ff8a717d1837a2a430aec0a2e1cb115da0afeb (patch) | |
tree | 0b4ee8c7708763979e37a619040fc708dc957c7b /plugins/sonar-jacoco-plugin/src | |
parent | 41fdffbc9ce51080a55e33fcee1a2f5b7e1573cc (diff) | |
download | sonarqube-13ff8a717d1837a2a430aec0a2e1cb115da0afeb.tar.gz sonarqube-13ff8a717d1837a2a430aec0a2e1cb115da0afeb.zip |
SONAR-2963 Add the widget "Integration Test Coverage"
Diffstat (limited to 'plugins/sonar-jacoco-plugin/src')
-rw-r--r-- | plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoItSensor.java (renamed from plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java) | 6 | ||||
-rw-r--r-- | plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java | 5 | ||||
-rw-r--r-- | plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidget.java | 44 | ||||
-rw-r--r-- | plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/widget.html.erb | 32 | ||||
-rw-r--r-- | plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoItSensorTest.java (renamed from plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java) | 5 | ||||
-rw-r--r-- | plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidgetTest.java | 38 |
6 files changed, 5 insertions, 125 deletions
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoItSensor.java index 8d1d54604bd..89a1c83ddf0 100644 --- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensor.java +++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoItSensor.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.jacoco.itcoverage; +package org.sonar.plugins.jacoco; import org.apache.commons.lang.StringUtils; import org.sonar.api.batch.Sensor; @@ -26,15 +26,13 @@ import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; import org.sonar.api.resources.JavaFile; import org.sonar.api.resources.Project; -import org.sonar.plugins.jacoco.AbstractAnalyzer; -import org.sonar.plugins.jacoco.JacocoConfiguration; import java.util.Collection; /** * Note that this class can't extend {@link org.sonar.api.batch.AbstractCoverageExtension}, because in this case this extension will be * disabled under Sonar 2.3, if JaCoCo is not defined as the default code coverage plugin. - * + * * @author Evgeny Mandrikov */ public class JaCoCoItSensor implements Sensor { diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java index aee588e9d47..447f746a826 100644 --- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java +++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JaCoCoPlugin.java @@ -22,7 +22,6 @@ package org.sonar.plugins.jacoco; import org.sonar.api.Properties; import org.sonar.api.Property; import org.sonar.api.SonarPlugin; -import org.sonar.plugins.jacoco.itcoverage.*; import java.util.Arrays; import java.util.List; @@ -99,9 +98,7 @@ public class JaCoCoPlugin extends SonarPlugin { JaCoCoMavenPluginHandler.class, // Unit tests JaCoCoSensor.class, - // Integration tests - JaCoCoItSensor.class, - ItCoverageWidget.class); + JaCoCoItSensor.class); } } diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidget.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidget.java deleted file mode 100644 index 65ef6ef25bb..00000000000 --- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidget.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.jacoco.itcoverage; - -import org.sonar.api.web.AbstractRubyTemplate; -import org.sonar.api.web.NavigationSection; -import org.sonar.api.web.RubyRailsWidget; -import org.sonar.api.web.UserRole; - -@NavigationSection(NavigationSection.RESOURCE) -@UserRole(UserRole.USER) -public class ItCoverageWidget extends AbstractRubyTemplate implements RubyRailsWidget { - - @Override - protected String getTemplatePath() { - return "/org/sonar/plugins/jacoco/itcoverage/widget.html.erb"; - } - - public String getId() { - return "it-coverage"; - } - - public String getTitle() { - return "IT Coverage widget"; - } - -} diff --git a/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/widget.html.erb b/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/widget.html.erb deleted file mode 100644 index 00f91c0bb2b..00000000000 --- a/plugins/sonar-jacoco-plugin/src/main/resources/org/sonar/plugins/jacoco/itcoverage/widget.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<% - it_coverage_measure=measure('it_coverage') - if it_coverage_measure %> - <table width="100%"> - <tr> - <td valign="top" width="100%"> - <div class="dashbox"> - <p class="title">IT Code coverage</p> - - <p> - <span class="big"><%= format_measure(it_coverage_measure, :suffix => '', :url => url_for_drilldown('it_coverage'), :default => '-') %></span> - <%= dashboard_configuration.selected_period? ? format_variation(it_coverage_measure) : trend_icon(it_coverage_measure) -%> - </p> - <% it_line_coverage=measure('it_line_coverage') - if it_line_coverage %> - <p> - <%= format_measure(it_line_coverage, :suffix => ' IT line coverage', :url => url_for_drilldown('it_uncovered_lines', :highlight => 'it_line_coverage')) %> - <%= dashboard_configuration.selected_period? ? format_variation(it_line_coverage) : trend_icon(it_line_coverage) -%> - </p> - <% end %> - <% it_branch_coverage=measure('it_branch_coverage') - if it_branch_coverage %> - <p> - <%= format_measure(it_branch_coverage, :suffix => ' IT branch coverage', :url => url_for_drilldown('it_uncovered_conditions', :highlight => 'it_branch_coverage')) %> - <%= dashboard_configuration.selected_period? ? format_variation(it_branch_coverage) : trend_icon(it_branch_coverage) -%> - </p> - <% end %> - </div> - </td> - </tr> - </table> -<% end %> diff --git a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoItSensorTest.java index 524e9070908..2e2da4db9a6 100644 --- a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/JaCoCoItSensorTest.java +++ b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoItSensorTest.java @@ -17,7 +17,7 @@ * License along with Sonar; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.jacoco.itcoverage; +package org.sonar.plugins.jacoco; import org.junit.Before; import org.junit.Test; @@ -30,7 +30,6 @@ import org.sonar.api.resources.Project.AnalysisType; import org.sonar.api.resources.ProjectFileSystem; import org.sonar.api.resources.Resource; import org.sonar.api.test.IsMeasure; -import org.sonar.plugins.jacoco.JacocoConfiguration; import java.io.File; @@ -95,7 +94,7 @@ public class JaCoCoItSensorTest { verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_LINES_TO_COVER, 7.0))); verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_UNCOVERED_LINES, 3.0))); verify(context).saveMeasure(eq(resource), - argThat(new IsMeasure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, "6=1;7=1;8=1;11=1;15=0;16=0;18=0"))); + argThat(new IsMeasure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, "6=1;7=1;8=1;11=1;15=0;16=0;18=0"))); verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_CONDITIONS_TO_COVER, 2.0))); verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_UNCOVERED_CONDITIONS, 2.0))); verify(context).saveMeasure(eq(resource), argThat(new IsMeasure(CoreMetrics.IT_CONDITIONS_BY_LINE, "15=2"))); diff --git a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidgetTest.java b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidgetTest.java deleted file mode 100644 index bb5870e7733..00000000000 --- a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/itcoverage/ItCoverageWidgetTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2011 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.jacoco.itcoverage; - -import org.junit.Test; - -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; - -/** - * @author Evgeny Mandrikov - */ -public class ItCoverageWidgetTest { - - @Test - public void testGetTemplatePath() { - String path = new ItCoverageWidget().getTemplatePath(); - assertThat(getClass().getResource(path), notNullValue()); - } - -} |