aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-09-30 08:26:35 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-09-30 08:26:35 +0000
commit54ff2c451b9d39995c688bc374144d0e3b447aca (patch)
treebb1d0af5eb041354b6378677d6e532de091e6666 /sonar-batch
parent2df21daab1bb544a0060abfcd8eaebb00f2a08e4 (diff)
downloadsonarqube-54ff2c451b9d39995c688bc374144d0e3b447aca.tar.gz
sonarqube-54ff2c451b9d39995c688bc374144d0e3b447aca.zip
fix execution of jacoco and emma plugins
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/BatchPluginRepository.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/BatchPluginRepositoryTest.java25
2 files changed, 38 insertions, 1 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/BatchPluginRepository.java b/sonar-batch/src/main/java/org/sonar/batch/BatchPluginRepository.java
index 51a2e095380..6ee190fabec 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/BatchPluginRepository.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/BatchPluginRepository.java
@@ -22,6 +22,7 @@ package org.sonar.batch;
import com.google.common.collect.HashMultimap;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
import org.picocontainer.MutablePicoContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -113,7 +114,18 @@ public class BatchPluginRepository extends AbstractPluginRepository {
if (ArrayUtils.isEmpty(selectedPluginKeys)) {
selectedPluginKeys = new String[]{AbstractCoverageExtension.DEFAULT_PLUGIN};
}
- return ArrayUtils.contains(selectedPluginKeys, pluginKey);
+ String oldCoveragePluginKey = getOldCoveragePluginKey(pluginKey);
+ return ArrayUtils.contains(selectedPluginKeys, pluginKey) || ArrayUtils.contains(selectedPluginKeys, oldCoveragePluginKey);
+ }
+
+ private String getOldCoveragePluginKey(String pluginKey) {
+ if (StringUtils.equals("sonar-jacoco-plugin", pluginKey)) {
+ return "jacoco";
+ }
+ if (StringUtils.equals("sonar-emma-plugin", pluginKey)) {
+ return "emma";
+ }
+ return null;
}
@Override
diff --git a/sonar-batch/src/test/java/org/sonar/batch/BatchPluginRepositoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/BatchPluginRepositoryTest.java
index 1f7696ea5d8..337d40f81e1 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/BatchPluginRepositoryTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/BatchPluginRepositoryTest.java
@@ -65,6 +65,31 @@ public class BatchPluginRepositoryTest {
assertThat(repository.shouldRegisterCoverageExtension("other"), is(false));
}
+ @Test
+ public void shouldActivateOldVersionOfEmma() {
+ Configuration conf = new PropertiesConfiguration();
+ conf.setProperty(AbstractCoverageExtension.PARAM_PLUGIN, "emma");
+ BatchPluginRepository repository = new BatchPluginRepository(conf);
+
+ assertThat(repository.shouldRegisterCoverageExtension("sonar-emma-plugin"), is(true));
+ assertThat(repository.shouldRegisterCoverageExtension("emma"), is(true));
+
+ assertThat(repository.shouldRegisterCoverageExtension("sonar-jacoco-plugin"), is(false));
+ assertThat(repository.shouldRegisterCoverageExtension("jacoco"), is(false));
+ assertThat(repository.shouldRegisterCoverageExtension("clover"), is(false));
+ assertThat(repository.shouldRegisterCoverageExtension("cobertura"), is(false));
+ }
+
+ @Test
+ public void shouldActivateOldVersionOfJacoco() {
+ Configuration conf = new PropertiesConfiguration();
+ conf.setProperty(AbstractCoverageExtension.PARAM_PLUGIN, "cobertura,jacoco");
+ BatchPluginRepository repository = new BatchPluginRepository(conf);
+
+ assertThat(repository.shouldRegisterCoverageExtension("sonar-jacoco-plugin"), is(true));
+ assertThat(repository.shouldRegisterCoverageExtension("jacoco"), is(true));
+ assertThat(repository.shouldRegisterCoverageExtension("emma"), is(false));
+ }
public static class FakeBatchExtension implements BatchExtension {