aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-xoo-plugin
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-07-31 13:12:10 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2017-08-04 14:58:16 +0200
commit75e47ba5a19b3d4ab901d2ed7a180714b141d580 (patch)
tree9f15f196571ed354b9a17e0a790734813d7493ed /plugins/sonar-xoo-plugin
parent2183aa17c17e8cb7385bf1662a57368c0b2979fd (diff)
downloadsonarqube-75e47ba5a19b3d4ab901d2ed7a180714b141d580.tar.gz
sonarqube-75e47ba5a19b3d4ab901d2ed7a180714b141d580.zip
Rework file indexing
* Drop cycle ModuleFileSystem -> FileIndexer -> ModuleFileSystem * Ensure basedir is initialized once * Drop useless FileSystemLogger, and log in ModuleFileSystemInitializer
Diffstat (limited to 'plugins/sonar-xoo-plugin')
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
index ecddb37cba9..851bf8903d3 100644
--- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
@@ -19,23 +19,21 @@
*/
package org.sonar.xoo.lang;
+import java.io.File;
+import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
+import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.component.ResourcePerspectives;
import org.sonar.api.source.Symbol;
import org.sonar.api.source.Symbolizable;
-import java.io.File;
-import java.io.IOException;
-
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -43,8 +41,7 @@ import static org.mockito.Mockito.when;
public class SymbolReferencesSensorTest {
private SymbolReferencesSensor sensor;
- private SensorContext context = mock(SensorContext.class);
- private DefaultFileSystem fileSystem;
+ private SensorContextTester context;
@Rule
public TemporaryFolder temp = new TemporaryFolder();
@@ -56,8 +53,7 @@ public class SymbolReferencesSensorTest {
baseDir = temp.newFolder();
perspectives = mock(ResourcePerspectives.class);
sensor = new SymbolReferencesSensor(perspectives);
- fileSystem = new DefaultFileSystem(baseDir.toPath());
- when(context.fileSystem()).thenReturn(fileSystem);
+ context = SensorContextTester.create(baseDir);
}
@Test
@@ -68,7 +64,7 @@ public class SymbolReferencesSensorTest {
@Test
public void testNoExecutionIfNoSymbolFile() {
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").setModuleBaseDir(baseDir.toPath()).build();
- fileSystem.add(inputFile);
+ context.fileSystem().add(inputFile);
sensor.execute(context);
}
@@ -77,7 +73,7 @@ public class SymbolReferencesSensorTest {
File symbol = new File(baseDir, "src/foo.xoo.symbol");
FileUtils.write(symbol, "1:4,7\n12:15,23:33\n\n#comment");
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").setModuleBaseDir(baseDir.toPath()).build();
- fileSystem.add(inputFile);
+ context.fileSystem().add(inputFile);
Symbolizable symbolizable = mock(Symbolizable.class);
when(perspectives.as(Symbolizable.class, inputFile)).thenReturn(symbolizable);
Symbolizable.SymbolTableBuilder symbolTableBuilder = mock(Symbolizable.SymbolTableBuilder.class);