aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-deprecated
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-01-14 17:14:00 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-01-15 09:08:58 +0100
commit12c4a20acb61ff6f516c7e7bb8996db606b263ab (patch)
treeb831b5467f8e37d05b8329e398141f99caa98a4f /sonar-deprecated
parent1e6facc12390d970ad259af550ea3dba8426a79f (diff)
downloadsonarqube-12c4a20acb61ff6f516c7e7bb8996db606b263ab.tar.gz
sonarqube-12c4a20acb61ff6f516c7e7bb8996db606b263ab.zip
SONAR-5931 Publish new measure API
Diffstat (limited to 'sonar-deprecated')
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java10
-rw-r--r--sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java8
2 files changed, 9 insertions, 9 deletions
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java b/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java
index 7626ce1e018..16aa183e3a5 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/checks/NoSonarFilter.java
@@ -21,7 +21,7 @@ package org.sonar.api.checks;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
-import org.sonar.api.batch.SensorContext;
+import org.sonar.api.batch.SonarIndex;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.batch.IssueFilterChain;
import org.sonar.api.resources.Resource;
@@ -37,16 +37,16 @@ import java.util.Set;
public class NoSonarFilter implements org.sonar.api.issue.batch.IssueFilter {
private final Map<String, Set<Integer>> noSonarLinesByKey = Maps.newHashMap();
- private SensorContext context;
+ private SonarIndex sonarIndex;
- public NoSonarFilter(SensorContext context) {
- this.context = context;
+ public NoSonarFilter(SonarIndex sonarIndex) {
+ this.sonarIndex = sonarIndex;
}
public void addResource(Resource model, Set<Integer> noSonarLines) {
if (model != null && noSonarLines != null) {
// Reload resource to handle backward compatibility of resource keys
- Resource resource = context.getResource(model);
+ Resource resource = sonarIndex.getResource(model);
if (resource != null) {
noSonarLinesByKey.put(resource.getEffectiveKey(), noSonarLines);
}
diff --git a/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java b/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java
index 5be33366643..1521ca67b52 100644
--- a/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java
+++ b/sonar-deprecated/src/test/java/org/sonar/api/checks/NoSonarFilterTest.java
@@ -21,7 +21,7 @@ package org.sonar.api.checks;
import org.junit.Before;
import org.junit.Test;
-import org.sonar.api.batch.SensorContext;
+import org.sonar.api.batch.SonarIndex;
import org.sonar.api.issue.Issue;
import org.sonar.api.issue.batch.IssueFilterChain;
import org.sonar.api.resources.File;
@@ -37,8 +37,8 @@ import static org.mockito.Mockito.when;
public class NoSonarFilterTest {
- private SensorContext sensorContext = mock(SensorContext.class);
- NoSonarFilter filter = new NoSonarFilter(sensorContext);
+ private SonarIndex sonarIndex = mock(SonarIndex.class);
+ NoSonarFilter filter = new NoSonarFilter(sonarIndex);
private File javaFile;
IssueFilterChain chain = mock(IssueFilterChain.class);
@@ -47,7 +47,7 @@ public class NoSonarFilterTest {
when(chain.accept(isA(Issue.class))).thenReturn(true);
javaFile = new File("org.foo.Bar");
javaFile.setEffectiveKey("struts:org.apache.Action");
- when(sensorContext.getResource(javaFile)).thenReturn(javaFile);
+ when(sonarIndex.getResource(javaFile)).thenReturn(javaFile);
}
@Test