20
20
package org .sonar .plugins .csharp ;
21
21
22
22
import com .google .common .collect .ImmutableList ;
23
+ import java .util .List ;
23
24
import org .sonar .api .batch .fs .FileSystem ;
24
25
import org .sonar .api .config .PropertyDefinition ;
25
26
import org .sonar .api .config .Settings ;
28
29
import org .sonar .plugins .dotnet .tests .CoverageConfiguration ;
29
30
import org .sonar .plugins .dotnet .tests .CoverageReportImportSensor ;
30
31
31
- import java .util .List ;
32
-
33
32
public class CSharpCodeCoverageProvider {
34
33
35
34
private static final String CATEGORY = "C#" ;
@@ -40,43 +39,84 @@ public class CSharpCodeCoverageProvider {
40
39
private static final String DOTCOVER_PROPERTY_KEY = "sonar.cs.dotcover.reportsPaths" ;
41
40
private static final String VISUAL_STUDIO_COVERAGE_XML_PROPERTY_KEY = "sonar.cs.vscoveragexml.reportsPaths" ;
42
41
42
+ private static final String IT_NCOVER3_PROPERTY_KEY = "sonar.cs.ncover3.it.reportsPaths" ;
43
+ private static final String IT_OPENCOVER_PROPERTY_KEY = "sonar.cs.opencover.it.reportsPaths" ;
44
+ private static final String IT_DOTCOVER_PROPERTY_KEY = "sonar.cs.dotcover.it.reportsPaths" ;
45
+ private static final String IT_VISUAL_STUDIO_COVERAGE_XML_PROPERTY_KEY = "sonar.cs.vscoveragexml.it.reportsPaths" ;
46
+
43
47
private static final CoverageConfiguration COVERAGE_CONF = new CoverageConfiguration (
44
48
CSharpPlugin .LANGUAGE_KEY ,
45
49
NCOVER3_PROPERTY_KEY ,
46
50
OPENCOVER_PROPERTY_KEY ,
47
51
DOTCOVER_PROPERTY_KEY ,
48
52
VISUAL_STUDIO_COVERAGE_XML_PROPERTY_KEY );
49
53
54
+ private static final CoverageConfiguration IT_COVERAGE_CONF = new CoverageConfiguration (
55
+ CSharpPlugin .LANGUAGE_KEY ,
56
+ IT_NCOVER3_PROPERTY_KEY ,
57
+ IT_OPENCOVER_PROPERTY_KEY ,
58
+ IT_DOTCOVER_PROPERTY_KEY ,
59
+ IT_VISUAL_STUDIO_COVERAGE_XML_PROPERTY_KEY );
60
+
50
61
private CSharpCodeCoverageProvider () {
51
62
}
52
63
53
64
public static List extensions () {
54
65
return ImmutableList .of (
55
- CSharpCoverageAggregator .class ,
56
- CSharpCoverageReportImportSensor .class ,
66
+ CSharpCoverageAggregator .class , CSharpIntegrationCoverageAggregator .class ,
67
+ CSharpCoverageReportImportSensor .class , CSharpIntegrationCoverageReportImportSensor .class ,
68
+
57
69
PropertyDefinition .builder (NCOVER3_PROPERTY_KEY )
58
- .name ("NCover3 Reports Paths" )
70
+ .name ("NCover3 Unit Tests Reports Paths" )
71
+ .description ("Example: \" report.nccov\" , \" report1.nccov,report2.nccov\" or \" C:/report.nccov\" " )
72
+ .category (CATEGORY )
73
+ .subCategory (SUBCATEGORY )
74
+ .onlyOnQualifiers (Qualifiers .PROJECT , Qualifiers .MODULE )
75
+ .build (),
76
+ PropertyDefinition .builder (IT_NCOVER3_PROPERTY_KEY )
77
+ .name ("NCover3 Integration Tests Reports Paths" )
59
78
.description ("Example: \" report.nccov\" , \" report1.nccov,report2.nccov\" or \" C:/report.nccov\" " )
60
79
.category (CATEGORY )
61
80
.subCategory (SUBCATEGORY )
62
81
.onlyOnQualifiers (Qualifiers .PROJECT , Qualifiers .MODULE )
63
82
.build (),
64
83
PropertyDefinition .builder (OPENCOVER_PROPERTY_KEY )
65
- .name ("OpenCover Reports Paths" )
84
+ .name ("OpenCover Unit Tests Reports Paths" )
85
+ .description ("Example: \" report.xml\" , \" report1.xml,report2.xml\" or \" C:/report.xml\" " )
86
+ .category (CATEGORY )
87
+ .subCategory (SUBCATEGORY )
88
+ .onlyOnQualifiers (Qualifiers .PROJECT , Qualifiers .MODULE )
89
+ .build (),
90
+ PropertyDefinition .builder (IT_OPENCOVER_PROPERTY_KEY )
91
+ .name ("OpenCover Integration Tests Reports Paths" )
66
92
.description ("Example: \" report.xml\" , \" report1.xml,report2.xml\" or \" C:/report.xml\" " )
67
93
.category (CATEGORY )
68
94
.subCategory (SUBCATEGORY )
69
95
.onlyOnQualifiers (Qualifiers .PROJECT , Qualifiers .MODULE )
70
96
.build (),
71
97
PropertyDefinition .builder (DOTCOVER_PROPERTY_KEY )
72
- .name ("dotCover (HTML) Reports Paths" )
98
+ .name ("dotCover Unit Tests (HTML) Reports Paths" )
99
+ .description ("Example: \" report.html\" , \" report1.html,report2.html\" or \" C:/report.html\" " )
100
+ .category (CATEGORY )
101
+ .subCategory (SUBCATEGORY )
102
+ .onlyOnQualifiers (Qualifiers .PROJECT , Qualifiers .MODULE )
103
+ .build (),
104
+ PropertyDefinition .builder (IT_DOTCOVER_PROPERTY_KEY )
105
+ .name ("dotCover Integration Tests (HTML) Reports Paths" )
73
106
.description ("Example: \" report.html\" , \" report1.html,report2.html\" or \" C:/report.html\" " )
74
107
.category (CATEGORY )
75
108
.subCategory (SUBCATEGORY )
76
109
.onlyOnQualifiers (Qualifiers .PROJECT , Qualifiers .MODULE )
77
110
.build (),
78
111
PropertyDefinition .builder (VISUAL_STUDIO_COVERAGE_XML_PROPERTY_KEY )
79
- .name ("Visual Studio (XML) Reports Paths" )
112
+ .name ("Visual Studio Unit Tests (XML) Reports Paths" )
113
+ .description ("Example: \" report.coveragexml\" , \" report1.coveragexml,report2.coveragexml\" or \" C:/report.coveragexml\" " )
114
+ .category (CATEGORY )
115
+ .subCategory (SUBCATEGORY )
116
+ .onlyOnQualifiers (Qualifiers .PROJECT , Qualifiers .MODULE )
117
+ .build (),
118
+ PropertyDefinition .builder (IT_VISUAL_STUDIO_COVERAGE_XML_PROPERTY_KEY )
119
+ .name ("Visual Studio Integration Tests (XML) Reports Paths" )
80
120
.description ("Example: \" report.coveragexml\" , \" report1.coveragexml,report2.coveragexml\" or \" C:/report.coveragexml\" " )
81
121
.category (CATEGORY )
82
122
.subCategory (SUBCATEGORY )
@@ -95,7 +135,23 @@ public CSharpCoverageAggregator(Settings settings) {
95
135
public static class CSharpCoverageReportImportSensor extends CoverageReportImportSensor {
96
136
97
137
public CSharpCoverageReportImportSensor (CSharpCoverageAggregator coverageAggregator , FileSystem fs ) {
98
- super (COVERAGE_CONF , coverageAggregator , fs );
138
+ super (COVERAGE_CONF , coverageAggregator , fs , false );
139
+ }
140
+
141
+ }
142
+
143
+ public static class CSharpIntegrationCoverageAggregator extends CoverageAggregator {
144
+
145
+ public CSharpIntegrationCoverageAggregator (Settings settings ) {
146
+ super (IT_COVERAGE_CONF , settings );
147
+ }
148
+
149
+ }
150
+
151
+ public static class CSharpIntegrationCoverageReportImportSensor extends CoverageReportImportSensor {
152
+
153
+ public CSharpIntegrationCoverageReportImportSensor (CSharpIntegrationCoverageAggregator coverageAggregator , FileSystem fs ) {
154
+ super (IT_COVERAGE_CONF , coverageAggregator , fs , true );
99
155
}
100
156
101
157
}
0 commit comments