summaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2016-05-10 18:45:48 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2016-05-12 08:49:09 +0200
commitf58fdc8b6b65f998e6addfecf7269625366523a5 (patch)
tree84612146b8e01196cb046ca0f4d2185194e3c2a6 /sonar-scanner-engine
parent1ea649ef747a5938369b6c63c27e767a550f476b (diff)
downloadsonarqube-f58fdc8b6b65f998e6addfecf7269625366523a5.tar.gz
sonarqube-f58fdc8b6b65f998e6addfecf7269625366523a5.zip
SONAR-7612 Improve documentation and SensorContextTester
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/batch/sensor/noop/NoOpNewCpdTokens.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/source/DeprecatedDefaultSymbolTableTest.java4
5 files changed, 10 insertions, 12 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/sensor/noop/NoOpNewCpdTokens.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/sensor/noop/NoOpNewCpdTokens.java
index afd00476b2a..7ad3056b4ec 100644
--- a/sonar-scanner-engine/src/main/java/org/sonar/batch/sensor/noop/NoOpNewCpdTokens.java
+++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/sensor/noop/NoOpNewCpdTokens.java
@@ -40,4 +40,10 @@ public class NoOpNewCpdTokens implements NewCpdTokens {
// Do nothing
return this;
}
+
+ @Override
+ public NewCpdTokens addToken(int startLine, int startLineOffset, int endLine, int endLineOffset, String image) {
+ // Do nothing
+ return this;
+ }
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java
index af84563a8b8..47726bc8a2e 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/issue/ModuleIssuesTest.java
@@ -19,7 +19,6 @@
*/
package org.sonar.batch.issue;
-import java.io.StringReader;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -28,7 +27,6 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.batch.rule.internal.ActiveRulesBuilder;
import org.sonar.api.batch.rule.internal.RulesBuilder;
import org.sonar.api.batch.sensor.issue.internal.DefaultIssue;
@@ -67,7 +65,7 @@ public class ModuleIssuesTest {
ModuleIssues moduleIssues;
BatchComponentCache componentCache = new BatchComponentCache();
- InputFile file = new DefaultInputFile("foo", "src/Foo.php").initMetadata(new FileMetadata().readMetadata(new StringReader("Foo\nBar\nBiz\n")));
+ InputFile file = new DefaultInputFile("foo", "src/Foo.php").initMetadata("Foo\nBar\nBiz\n");
ReportPublisher reportPublisher = mock(ReportPublisher.class, RETURNS_DEEP_STUBS);
@Before
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java
index 3a791783b1d..d1f20eb1d16 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java
@@ -19,14 +19,12 @@
*/
package org.sonar.batch.source;
-import java.io.StringReader;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting;
import org.sonar.api.batch.sensor.internal.SensorStorage;
@@ -43,7 +41,7 @@ public class DefaultHighlightableTest {
public void should_store_highlighting_rules() {
SensorStorage sensorStorage = mock(SensorStorage.class);
DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php")
- .initMetadata(new FileMetadata().readMetadata(new StringReader("azerty\nbla bla")));
+ .initMetadata("azerty\nbla bla");
DefaultHighlightable highlightablePerspective = new DefaultHighlightable(inputFile, sensorStorage, mock(AnalysisMode.class));
highlightablePerspective.newHighlighting().highlight(0, 6, "k").highlight(7, 10, "cppd").done();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java
index a6dde755b35..3f16b9331a6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java
@@ -20,12 +20,10 @@
package org.sonar.batch.source;
import com.google.common.base.Strings;
-import java.io.StringReader;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable;
import org.sonar.api.source.Symbol;
import org.sonar.api.source.Symbolizable;
@@ -42,7 +40,7 @@ public class DefaultSymbolizableTest {
DefaultSensorStorage sensorStorage = mock(DefaultSensorStorage.class);
DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php")
- .initMetadata(new FileMetadata().readMetadata(new StringReader(Strings.repeat("azerty\n", 20))));
+ .initMetadata(Strings.repeat("azerty\n", 20));
DefaultSymbolizable symbolPerspective = new DefaultSymbolizable(inputFile, sensorStorage, mock(AnalysisMode.class));
Symbolizable.SymbolTableBuilder symbolTableBuilder = symbolPerspective.newSymbolTableBuilder();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DeprecatedDefaultSymbolTableTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DeprecatedDefaultSymbolTableTest.java
index e8b6d6df380..7c24a2384b0 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DeprecatedDefaultSymbolTableTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/source/DeprecatedDefaultSymbolTableTest.java
@@ -20,7 +20,6 @@
package org.sonar.batch.source;
import com.google.common.base.Strings;
-import java.io.StringReader;
import java.util.Set;
import org.junit.Before;
import org.junit.Rule;
@@ -28,7 +27,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.batch.fs.TextRange;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
-import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable;
import org.sonar.api.source.Symbol;
import org.sonar.api.source.Symbolizable;
@@ -44,7 +42,7 @@ public class DeprecatedDefaultSymbolTableTest {
@Before
public void prepare() {
inputFile = new DefaultInputFile("foo", "src/Foo.php")
- .initMetadata(new FileMetadata().readMetadata(new StringReader(Strings.repeat("azerty\n", 20))));
+ .initMetadata(Strings.repeat("azerty\n", 20));
}
@Test