aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-27 13:30:22 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-27 13:30:39 +0100
commitd8feb63fb401efb71b8ff9eec6ca80666efa9cb0 (patch)
treef32889f09a2c87c7db804686e4a5661c7eeb9535 /sonar-batch
parent466e1de5aa9a6bcb8d402169453fe88ab0769a2e (diff)
downloadsonarqube-d8feb63fb401efb71b8ff9eec6ca80666efa9cb0.tar.gz
sonarqube-d8feb63fb401efb71b8ff9eec6ca80666efa9cb0.zip
Fix some quality flaws
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java9
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java13
2 files changed, 6 insertions, 16 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
index c203dd73446..4e0a361beeb 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
@@ -22,14 +22,11 @@ package org.sonar.batch.scan.filesystem;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.CharMatcher;
import com.google.common.io.Files;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.sonar.api.BatchComponent;
import org.sonar.api.batch.SonarIndex;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DeprecatedDefaultInputFile;
-import org.sonar.api.config.Settings;
import org.sonar.api.resources.File;
import org.sonar.api.resources.Languages;
import org.sonar.api.resources.Project;
@@ -45,19 +42,15 @@ import org.sonar.batch.util.DeprecatedKeyUtils;
*/
public class ComponentIndexer implements BatchComponent {
- private static final Logger LOG = LoggerFactory.getLogger(ComponentIndexer.class);
-
private final Languages languages;
- private final Settings settings;
private final SonarIndex sonarIndex;
private final ResourceKeyMigration migration;
private final Project module;
- public ComponentIndexer(Project module, Languages languages, SonarIndex sonarIndex, Settings settings, ResourceKeyMigration migration) {
+ public ComponentIndexer(Project module, Languages languages, SonarIndex sonarIndex, ResourceKeyMigration migration) {
this.module = module;
this.languages = languages;
this.sonarIndex = sonarIndex;
- this.settings = settings;
this.migration = migration;
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java
index 7ad42ecbcbb..a692e548b26 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java
@@ -33,7 +33,6 @@ import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.DeprecatedDefaultInputFile;
-import org.sonar.api.config.Settings;
import org.sonar.api.resources.AbstractLanguage;
import org.sonar.api.resources.Java;
import org.sonar.api.resources.Languages;
@@ -60,7 +59,6 @@ public class ComponentIndexerTest {
SonarIndex sonarIndex;
AbstractLanguage cobolLanguage;
Project project;
- Settings settings;
String aClaess;
String explicacao;
@@ -70,7 +68,6 @@ public class ComponentIndexerTest {
baseDir = temp.newFolder();
sonarIndex = mock(SonarIndex.class);
project = mock(Project.class);
- settings = new Settings();
cobolLanguage = new AbstractLanguage("cobol") {
@Override
public String[] getFileSuffixes() {
@@ -88,7 +85,7 @@ public class ComponentIndexerTest {
fs.add(newInputFile("src/main/java2/foo/bar/Foo.java", "", "foo/bar/Foo.java", "java", false));
fs.add(newInputFile("src/test/java/foo/bar/FooTest.java", "", "foo/bar/FooTest.java", "java", true));
Languages languages = new Languages(Java.INSTANCE);
- ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, settings, mock(ResourceKeyMigration.class));
+ ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, mock(ResourceKeyMigration.class));
indexer.execute(fs);
verify(sonarIndex).index(org.sonar.api.resources.File.create("src/main/java/foo/bar/Foo.java", "foo/bar/Foo.java", Java.INSTANCE, false));
@@ -111,7 +108,7 @@ public class ComponentIndexerTest {
fs.add(newInputFile("src/test/foo/bar/FooTest.cbl", "", "foo/bar/FooTest.cbl", "cobol", true));
Languages languages = new Languages(cobolLanguage);
- ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, settings, mock(ResourceKeyMigration.class));
+ ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, mock(ResourceKeyMigration.class));
indexer.execute(fs);
verify(sonarIndex).index(org.sonar.api.resources.File.create("/src/foo/bar/Foo.cbl", "foo/bar/Foo.cbl", cobolLanguage, false));
@@ -123,7 +120,7 @@ public class ComponentIndexerTest {
public void shouldImportSource() throws IOException {
fs.add(newInputFile("src/main/java/foo/bar/Foo.java", "sample code", "foo/bar/Foo.java", "java", false));
Languages languages = new Languages(Java.INSTANCE);
- ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, settings, mock(ResourceKeyMigration.class));
+ ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, mock(ResourceKeyMigration.class));
indexer.execute(fs);
Resource sonarFile = org.sonar.api.resources.File.create("src/main/java/foo/bar/Foo.java", "foo/bar/Foo.java", Java.INSTANCE, false);
@@ -161,7 +158,7 @@ public class ComponentIndexerTest {
.setFile(javaFile1)
.setLanguage("java"));
Languages languages = new Languages(Java.INSTANCE);
- ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, settings, mock(ResourceKeyMigration.class));
+ ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, mock(ResourceKeyMigration.class));
indexer.execute(fs);
Resource sonarFile = org.sonar.api.resources.File.create("src/main/java/foo/bar/Foo.java", "foo/bar/Foo.java", Java.INSTANCE, false);
@@ -185,7 +182,7 @@ public class ComponentIndexerTest {
.setFile(javaFile1)
.setLanguage("java"));
Languages languages = new Languages(Java.INSTANCE);
- ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, settings, mock(ResourceKeyMigration.class));
+ ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, mock(ResourceKeyMigration.class));
indexer.execute(fs);
Resource sonarFile = org.sonar.api.resources.File.create("/src/main/java/foo/bar/Foo.java", "foo/bar/Foo.java", Java.INSTANCE, false);