aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJenkins CI <ci@sonarsource.com>2012-07-26 09:36:08 +0200
committerJenkins CI <ci@sonarsource.com>2012-07-26 09:36:08 +0200
commit46bdccbe256e72340d6f55ab0ccb2c2c1f86318e (patch)
treec364a38ca1e60d8954b5882c5b687f3bb7526cc6 /plugins
parent054f94941fb53ef4b976131d00b94a9065204640 (diff)
parentd33e0b2fb918d5a9ffd680eb826bd0b54b601c05 (diff)
downloadsonarqube-46bdccbe256e72340d6f55ab0ccb2c2c1f86318e.tar.gz
sonarqube-46bdccbe256e72340d6f55ab0ccb2c2c1f86318e.zip
Automatic merge from branch-3.2
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-java-plugin/pom.xml2
-rw-r--r--plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java23
-rw-r--r--plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java3
3 files changed, 19 insertions, 9 deletions
diff --git a/plugins/sonar-java-plugin/pom.xml b/plugins/sonar-java-plugin/pom.xml
index ecd12e01755..845f4b2d074 100644
--- a/plugins/sonar-java-plugin/pom.xml
+++ b/plugins/sonar-java-plugin/pom.xml
@@ -22,7 +22,7 @@
<dependency>
<groupId>org.codehaus.sonar.common-rules</groupId>
<artifactId>sonar-common-rules</artifactId>
- <version>1.0</version>
+ <version>1.0.1</version>
</dependency>
<!-- unit tests -->
diff --git a/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java b/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java
index e72d78ec3ae..0fdd3cd15ba 100644
--- a/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java
+++ b/plugins/sonar-java-plugin/src/main/java/org/sonar/plugins/java/JavaCommonRulesEngineProvider.java
@@ -19,25 +19,32 @@
*/
package org.sonar.plugins.java;
-import org.sonar.api.BatchExtension;
-import org.sonar.api.ExtensionProvider;
-import org.sonar.api.ServerExtension;
import org.sonar.api.resources.Java;
+import org.sonar.api.resources.Project;
import org.sonar.commonrules.api.CommonRulesEngine;
+import org.sonar.commonrules.api.CommonRulesEngineProvider;
-import java.util.List;
+public class JavaCommonRulesEngineProvider extends CommonRulesEngineProvider {
-public class JavaCommonRulesEngineProvider extends ExtensionProvider implements ServerExtension, BatchExtension {
+ public JavaCommonRulesEngineProvider() {
+ super();
+ }
+
+ public JavaCommonRulesEngineProvider(Project project) {
+ super(project);
+ }
@Override
- public List provide() {
- CommonRulesEngine engine = new CommonRulesEngine(Java.KEY);
+ protected void doActivation(CommonRulesEngine engine) {
engine.activateRule("InsufficientBranchCoverage");
engine.activateRule("InsufficientCommentDensity");
engine.activateRule("DuplicatedBlocks");
engine.activateRule("InsufficientLineCoverage");
+ }
- return engine.getExtensions();
+ @Override
+ protected String getLanguageKey() {
+ return Java.KEY;
}
}
diff --git a/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java b/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java
index a82d1debfd0..b43e8eabb22 100644
--- a/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java
+++ b/plugins/sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaCommonRulesEngineProviderTest.java
@@ -29,6 +29,9 @@ public class JavaCommonRulesEngineProviderTest {
public void shouldProvideExpectedExtensions() {
JavaCommonRulesEngineProvider provider = new JavaCommonRulesEngineProvider();
assertThat(provider.provide().size()).isGreaterThan(1);
+
+ provider = new JavaCommonRulesEngineProvider(null);
+ assertThat(provider.provide().size()).isGreaterThan(1);
}
}