aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-cpd-plugin/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2014-02-26 12:15:38 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2014-02-26 12:15:59 +0100
commit40f8b2e97602948cec51fb7c21f2c261c85e9a68 (patch)
tree188846c997155fe7082f99a111b2fb3bcc2ff4eb /plugins/sonar-cpd-plugin/src
parentffff70267607aed5f93a01c8f995934e51e0d473 (diff)
downloadsonarqube-40f8b2e97602948cec51fb7c21f2c261c85e9a68.tar.gz
sonarqube-40f8b2e97602948cec51fb7c21f2c261c85e9a68.zip
SONAR-926 remove ModuleLanguages from API. Replaced by FileSystem#languages()
Diffstat (limited to 'plugins/sonar-cpd-plugin/src')
-rw-r--r--plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdSensor.java10
-rw-r--r--plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java9
2 files changed, 9 insertions, 10 deletions
diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdSensor.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdSensor.java
index 0488a9b63af..b305052e7de 100644
--- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdSensor.java
+++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdSensor.java
@@ -23,9 +23,9 @@ import com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
-import org.sonar.api.batch.ModuleLanguages;
import org.sonar.api.batch.Sensor;
import org.sonar.api.batch.SensorContext;
+import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.config.Settings;
import org.sonar.api.resources.Project;
@@ -36,13 +36,13 @@ public class CpdSensor implements Sensor {
private CpdEngine sonarEngine;
private CpdEngine sonarBridgeEngine;
private Settings settings;
- private ModuleLanguages moduleLanguages;
+ private FileSystem fs;
- public CpdSensor(SonarEngine sonarEngine, SonarBridgeEngine sonarBridgeEngine, Settings settings, ModuleLanguages moduleLanguages) {
+ public CpdSensor(SonarEngine sonarEngine, SonarBridgeEngine sonarBridgeEngine, Settings settings, FileSystem fs) {
this.sonarEngine = sonarEngine;
this.sonarBridgeEngine = sonarBridgeEngine;
this.settings = settings;
- this.moduleLanguages = moduleLanguages;
+ this.fs = fs;
}
public boolean shouldExecuteOnProject(Project project) {
@@ -67,7 +67,7 @@ public class CpdSensor implements Sensor {
}
public void analyse(Project project, SensorContext context) {
- for (String language : moduleLanguages.keys()) {
+ for (String language : fs.languages()) {
if (isSkipped(language)) {
LOG.info("Detection of duplicated code is skipped for {}", language);
continue;
diff --git a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java
index 5fb30de0227..0d6429dce62 100644
--- a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java
+++ b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java
@@ -21,13 +21,10 @@ package org.sonar.plugins.cpd;
import org.junit.Before;
import org.junit.Test;
+import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.config.Settings;
-import org.sonar.api.resources.AbstractLanguage;
import org.sonar.api.resources.Java;
-import org.sonar.api.resources.Language;
-import org.sonar.api.resources.Languages;
-import org.sonar.batch.scan.language.DefaultModuleLanguages;
import org.sonar.plugins.cpd.index.IndexFactory;
import static org.fest.assertions.Assertions.assertThat;
@@ -46,7 +43,9 @@ public class CpdSensorTest {
sonarEngine = new SonarEngine(indexFactory, null, null);
sonarBridgeEngine = new SonarBridgeEngine(indexFactory, null, null);
settings = new Settings(new PropertyDefinitions(CpdPlugin.class));
- sensor = new CpdSensor(sonarEngine, sonarBridgeEngine, settings, new DefaultModuleLanguages(settings, new Languages()));
+
+ DefaultFileSystem fs = new DefaultFileSystem();
+ sensor = new CpdSensor(sonarEngine, sonarBridgeEngine, settings, fs);
}
@Test