From c9387788b44e4f151d2f2c72d33cbb4409e1a03e Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 12 Oct 2016 16:11:42 +0200 Subject: SONAR-8281 Change coverage API to accept unlimited reports/deprecate coverage type --- .../sonar/api/batch/sensor/coverage/CoverageType.java | 3 +++ .../org/sonar/api/batch/sensor/coverage/NewCoverage.java | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'sonar-plugin-api') diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java index 6597c3bcc01..019624c0dbb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/CoverageType.java @@ -48,7 +48,10 @@ import static org.sonar.api.measures.CoreMetrics.UNCOVERED_LINES; /** * Different coverage categories. * @since 5.2 + * + * @deprecated since 6.2 SonarQube merge all coverage reports and don't keep track of different test category */ +@Deprecated public enum CoverageType { UNIT(LINES_TO_COVER, UNCOVERED_LINES, COVERAGE_LINE_HITS_DATA, CONDITIONS_TO_COVER, UNCOVERED_CONDITIONS, COVERED_CONDITIONS_BY_LINE, CONDITIONS_BY_LINE), diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java index 63877cbe34d..81dce497138 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/NewCoverage.java @@ -22,13 +22,12 @@ package org.sonar.api.batch.sensor.coverage; import org.sonar.api.batch.fs.InputFile; /** - * This builder is used to define code coverage by tests of a given type (UT/IT/Overall) on files. + * This class is used to report code coverage on files. * * Example: * *
  *   sensorContext.newCoverage().onFile(file)
-       .ofType(UNIT)
        .lineHits(1, 2)
        .lineHits(2, 5)
        .lineHits(3, 0)
@@ -39,6 +38,13 @@ import org.sonar.api.batch.fs.InputFile;
        .save();
  *     
  * 
+ * + * Since 6.2 you can save several reports for the same file and reports will be merged using the following "additive" strategy: + * + * * @since 5.2 */ public interface NewCoverage { @@ -48,6 +54,10 @@ public interface NewCoverage { */ NewCoverage onFile(InputFile inputFile); + /** + * @deprecated since 6.2 SonarQube merge all coverage reports and don't keep track of different test category + */ + @Deprecated NewCoverage ofType(CoverageType type); /** @@ -66,7 +76,7 @@ public interface NewCoverage { NewCoverage conditions(int line, int conditions, int coveredConditions); /** - * Call this method only once when your are done with defining coverage of the file. + * Call this method to save the coverage report for the given file. Data will be merged with existing coverage information. */ void save(); } -- cgit v1.2.3