aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-07-22 09:27:34 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-07-22 12:35:56 +0200
commita1defc3dd106409930d9323d7bc055f816c2bcd3 (patch)
treef07e884153f38592a4359d9a2be3cf6270c2ab1c /plugins
parent6d5f68a9de9c3c0365921ad95304ea7051640c7b (diff)
downloadsonarqube-a1defc3dd106409930d9323d7bc055f816c2bcd3.tar.gz
sonarqube-a1defc3dd106409930d9323d7bc055f816c2bcd3.zip
SONAR-5389 Add InputDir concept in batch API
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java8
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/FileHashSensorTest.java10
2 files changed, 9 insertions, 9 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java
index b1c5dac5147..d18e146fe53 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/FileHashSensor.java
@@ -27,7 +27,7 @@ import org.sonar.api.batch.fs.internal.DeprecatedDefaultInputFile;
import org.sonar.api.resources.Project;
import org.sonar.api.utils.KeyValueFormat;
import org.sonar.batch.index.ComponentDataCache;
-import org.sonar.batch.scan.filesystem.InputFileCache;
+import org.sonar.batch.scan.filesystem.InputPathCache;
import org.sonar.core.DryRunIncompatible;
import org.sonar.core.source.SnapshotDataTypes;
@@ -43,10 +43,10 @@ import java.util.Map;
@DryRunIncompatible
public final class FileHashSensor implements Sensor {
- private final InputFileCache fileCache;
+ private final InputPathCache fileCache;
private final ComponentDataCache componentDataCache;
- public FileHashSensor(InputFileCache fileCache, ComponentDataCache componentDataCache) {
+ public FileHashSensor(InputPathCache fileCache, ComponentDataCache componentDataCache) {
this.fileCache = fileCache;
this.componentDataCache = componentDataCache;
}
@@ -58,7 +58,7 @@ public final class FileHashSensor implements Sensor {
@Override
public void analyse(Project project, SensorContext context) {
Map<String, String> map = Maps.newHashMap();
- for (InputFile inputFile : fileCache.byModule(project.key())) {
+ for (InputFile inputFile : fileCache.filesByModule(project.key())) {
String hash = ((DeprecatedDefaultInputFile) inputFile).hash();
if (hash != null) {
map.put(inputFile.relativePath(), hash);
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/FileHashSensorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/FileHashSensorTest.java
index 29f5e64cce9..4f851f39cae 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/FileHashSensorTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/FileHashSensorTest.java
@@ -31,7 +31,7 @@ import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DeprecatedDefaultInputFile;
import org.sonar.api.resources.Project;
import org.sonar.batch.index.ComponentDataCache;
-import org.sonar.batch.scan.filesystem.InputFileCache;
+import org.sonar.batch.scan.filesystem.InputPathCache;
import org.sonar.core.source.SnapshotDataTypes;
import java.util.Collections;
@@ -51,13 +51,13 @@ public class FileHashSensorTest {
public ExpectedException thrown = ExpectedException.none();
Project project = new Project("struts");
- InputFileCache fileCache = mock(InputFileCache.class);
+ InputPathCache fileCache = mock(InputPathCache.class);
ComponentDataCache componentDataCache = mock(ComponentDataCache.class);
FileHashSensor sensor = new FileHashSensor(fileCache, componentDataCache);
@Test
public void store_file_hashes() throws Exception {
- when(fileCache.byModule("struts")).thenReturn(Lists.<InputFile>newArrayList(
+ when(fileCache.filesByModule("struts")).thenReturn(Lists.<InputFile>newArrayList(
new DeprecatedDefaultInputFile("src/Foo.java").setFile(temp.newFile()).setHash("ABC"),
new DeprecatedDefaultInputFile("src/Bar.java").setFile(temp.newFile()).setHash("DEF")));
@@ -71,7 +71,7 @@ public class FileHashSensorTest {
@Test
public void store_file_hashes_for_branches() throws Exception {
project = new Project("struts", "branch-2.x", "Struts 2.x");
- when(fileCache.byModule("struts:branch-2.x")).thenReturn(Lists.<InputFile>newArrayList(
+ when(fileCache.filesByModule("struts:branch-2.x")).thenReturn(Lists.<InputFile>newArrayList(
new DeprecatedDefaultInputFile("src/Foo.java").setFile(temp.newFile()).setHash("ABC"),
new DeprecatedDefaultInputFile("src/Bar.java").setFile(temp.newFile()).setHash("DEF")));
@@ -90,7 +90,7 @@ public class FileHashSensorTest {
@Test
public void dont_save_hashes_if_no_files() throws Exception {
- when(fileCache.byModule("struts")).thenReturn(Collections.<InputFile>emptyList());
+ when(fileCache.filesByModule("struts")).thenReturn(Collections.<InputFile>emptyList());
SensorContext sensorContext = mock(SensorContext.class);
sensor.analyse(project, sensorContext);