diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-01-28 22:41:25 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-02-10 17:16:01 +0100 |
commit | e9b5effe30cf68820a3dfb00bf736a325313206b (patch) | |
tree | 74323c9b304a2b5f76d2f77ca6c4b86d03fa4296 /plugins/sonar-xoo-plugin | |
parent | 46b6c6f692964e6202aa269245e579badb856e94 (diff) | |
download | sonarqube-e9b5effe30cf68820a3dfb00bf736a325313206b.tar.gz sonarqube-e9b5effe30cf68820a3dfb00bf736a325313206b.zip |
SONAR-6134, SONAR-6048 Improve performance of FS indexation
Diffstat (limited to 'plugins/sonar-xoo-plugin')
9 files changed, 29 insertions, 29 deletions
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java index 7cf94a15d02..4b57e397362 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/CoveragePerTestSensorTest.java @@ -57,7 +57,7 @@ public class CoveragePerTestSensorTest { public void prepare() throws IOException { baseDir = temp.newFolder(); sensor = new CoveragePerTestSensor(); - fileSystem = new DefaultFileSystem(baseDir); + fileSystem = new DefaultFileSystem(baseDir.toPath()); when(context.fileSystem()).thenReturn(fileSystem); } @@ -68,7 +68,7 @@ public class CoveragePerTestSensorTest { @Test public void testNoExecutionIfCoveragePerTestFile() { - DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setAbsolutePath(new File(baseDir, "test/fooTest.xoo").getAbsolutePath()).setLanguage("xoo") + DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo") .setType(Type.TEST); fileSystem.add(testFile); sensor.execute(context); @@ -78,8 +78,8 @@ public class CoveragePerTestSensorTest { public void testExecution() throws IOException { File coverPerTest = new File(baseDir, "test/fooTest.xoo.coveragePerTest"); FileUtils.write(coverPerTest, "test1:src/foo.xoo:1,2,3,4\ntest2:src/foo.xoo:5,6,7\n\n#comment"); - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); - DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setAbsolutePath(new File(baseDir, "test/fooTest.xoo").getAbsolutePath()).setLanguage("xoo") + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); + DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo") .setType(Type.TEST); fileSystem.add(inputFile); fileSystem.add(testFile); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/DependencySensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/DependencySensorTest.java index 46f6e56c69d..e586263feda 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/DependencySensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/DependencySensorTest.java @@ -56,7 +56,7 @@ public class DependencySensorTest { public void prepare() throws IOException { baseDir = temp.newFolder(); sensor = new DependencySensor(); - fileSystem = new DefaultFileSystem(baseDir); + fileSystem = new DefaultFileSystem(baseDir.toPath()); when(context.fileSystem()).thenReturn(fileSystem); } @@ -67,7 +67,7 @@ public class DependencySensorTest { @Test public void testNoExecutionIfNoDepsFile() { - DefaultInputFile file = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo") + DefaultInputFile file = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo") .setType(Type.MAIN); fileSystem.add(file); sensor.execute(context); @@ -77,9 +77,9 @@ public class DependencySensorTest { public void testExecution() throws IOException { File deps = new File(baseDir, "src/foo.xoo.deps"); FileUtils.write(deps, "src/foo2.xoo:2\nsrc2/foo3.xoo:6\n\n#comment"); - DefaultInputFile inputFile1 = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); - DefaultInputFile inputFile2 = new DefaultInputFile("foo", "src/foo2.xoo").setAbsolutePath(new File(baseDir, "src/foo2.xoo").getAbsolutePath()).setLanguage("xoo"); - DefaultInputFile inputFile3 = new DefaultInputFile("foo", "src2/foo3.xoo").setAbsolutePath(new File(baseDir, "src2/foo3.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile1 = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); + DefaultInputFile inputFile2 = new DefaultInputFile("foo", "src/foo2.xoo").setLanguage("xoo"); + DefaultInputFile inputFile3 = new DefaultInputFile("foo", "src2/foo3.xoo").setLanguage("xoo"); fileSystem.add(inputFile1); fileSystem.add(inputFile2); fileSystem.add(inputFile3); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/MeasureSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/MeasureSensorTest.java index ade948848f7..6626a5e9545 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/MeasureSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/MeasureSensorTest.java @@ -65,7 +65,7 @@ public class MeasureSensorTest { baseDir = temp.newFolder(); metricFinder = mock(MetricFinder.class); sensor = new MeasureSensor(metricFinder); - fileSystem = new DefaultFileSystem(baseDir); + fileSystem = new DefaultFileSystem(baseDir.toPath()); when(context.fileSystem()).thenReturn(fileSystem); storage = mock(SensorStorage.class); when(context.newMeasure()).then(new Answer<DefaultMeasure>() { @@ -83,7 +83,7 @@ public class MeasureSensorTest { @Test public void testNoExecutionIfNoMeasureFile() { - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); sensor.execute(context); } @@ -92,7 +92,7 @@ public class MeasureSensorTest { public void testExecution() throws IOException { File measures = new File(baseDir, "src/foo.xoo.measures"); FileUtils.write(measures, "ncloc:12\nbranch_coverage:5.3\nsqale_index:300\nbool:true\n\n#comment"); - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); Metric<Boolean> booleanMetric = new Metric.Builder("bool", "Bool", Metric.ValueType.BOOL) @@ -115,7 +115,7 @@ public class MeasureSensorTest { public void failIfMetricNotFound() throws IOException { File measures = new File(baseDir, "src/foo.xoo.measures"); FileUtils.write(measures, "unknow:12\n\n#comment"); - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); thrown.expect(IllegalStateException.class); 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 945253e72b0..5673221a46e 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 @@ -52,7 +52,7 @@ public class SymbolReferencesSensorTest { public void prepare() throws IOException { baseDir = temp.newFolder(); sensor = new SymbolReferencesSensor(); - fileSystem = new DefaultFileSystem(baseDir); + fileSystem = new DefaultFileSystem(baseDir.toPath()); when(context.fileSystem()).thenReturn(fileSystem); } @@ -63,7 +63,7 @@ public class SymbolReferencesSensorTest { @Test public void testNoExecutionIfNoSymbolFile() { - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); sensor.execute(context); } @@ -72,7 +72,7 @@ public class SymbolReferencesSensorTest { public void testExecution() throws IOException { File symbol = new File(baseDir, "src/foo.xoo.symbol"); FileUtils.write(symbol, "1,4,7\n12,15,23\n\n#comment"); - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); SymbolTableBuilder symbolTableBuilder = mock(SymbolTableBuilder.class); when(context.symbolTableBuilder(inputFile)).thenReturn(symbolTableBuilder); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java index 75c5a1c6685..559f6b37b08 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SyntaxHighlightingSensorTest.java @@ -52,7 +52,7 @@ public class SyntaxHighlightingSensorTest { public void prepare() throws IOException { baseDir = temp.newFolder(); sensor = new SyntaxHighlightingSensor(); - fileSystem = new DefaultFileSystem(baseDir); + fileSystem = new DefaultFileSystem(baseDir.toPath()); when(context.fileSystem()).thenReturn(fileSystem); } @@ -63,7 +63,7 @@ public class SyntaxHighlightingSensorTest { @Test public void testNoExecutionIfNoSyntaxFile() { - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); sensor.execute(context); } @@ -72,7 +72,7 @@ public class SyntaxHighlightingSensorTest { public void testExecution() throws IOException { File symbol = new File(baseDir, "src/foo.xoo.highlighting"); FileUtils.write(symbol, "1:4:k\n12:15:cppd\n\n#comment"); - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); HighlightingBuilder builder = mock(HighlightingBuilder.class); when(context.highlightingBuilder(inputFile)).thenReturn(builder); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java index 41109c800c4..5e1a1344f4e 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/TestCaseSensorTest.java @@ -56,7 +56,7 @@ public class TestCaseSensorTest { public void prepare() throws IOException { baseDir = temp.newFolder(); sensor = new TestCaseSensor(); - fileSystem = new DefaultFileSystem(baseDir); + fileSystem = new DefaultFileSystem(baseDir.toPath()); when(context.fileSystem()).thenReturn(fileSystem); } @@ -67,7 +67,7 @@ public class TestCaseSensorTest { @Test public void testNoExecutionIfNoTestFile() { - DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setAbsolutePath(new File(baseDir, "test/fooTest.xoo").getAbsolutePath()).setLanguage("xoo") + DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo") .setType(Type.TEST); fileSystem.add(testFile); sensor.execute(context); @@ -77,7 +77,7 @@ public class TestCaseSensorTest { public void testExecution() throws IOException { File testPlan = new File(baseDir, "test/fooTest.xoo.testplan"); FileUtils.write(testPlan, "test1:UNIT:OK:::10\ntest2:INTEGRATION:ERROR:message:stack:15\n\n#comment"); - DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setAbsolutePath(new File(baseDir, "test/fooTest.xoo").getAbsolutePath()).setLanguage("xoo") + DefaultInputFile testFile = new DefaultInputFile("foo", "test/fooTest.xoo").setLanguage("xoo") .setType(Type.TEST); fileSystem.add(testFile); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/XooTokenizerSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/XooTokenizerSensorTest.java index 752f4144aba..1fe44615f9b 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/XooTokenizerSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/XooTokenizerSensorTest.java @@ -57,7 +57,7 @@ public class XooTokenizerSensorTest { public void prepare() throws IOException { baseDir = temp.newFolder(); sensor = new XooTokenizerSensor(); - fileSystem = new DefaultFileSystem(baseDir); + fileSystem = new DefaultFileSystem(baseDir.toPath()); when(context.fileSystem()).thenReturn(fileSystem); settings = new Settings(); when(context.settings()).thenReturn(settings); @@ -70,7 +70,7 @@ public class XooTokenizerSensorTest { @Test public void testNoExecutionIfExclusion() { - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); settings.setProperty(CoreProperties.CPD_EXCLUSIONS, "**/foo.xoo"); sensor.execute(context); @@ -81,7 +81,7 @@ public class XooTokenizerSensorTest { public void testExecution() throws IOException { File source = new File(baseDir, "src/foo.xoo"); FileUtils.write(source, "token1 token2 token3\ntoken4"); - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage("xoo"); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo"); fileSystem.add(inputFile); DuplicationTokenBuilder builder = mock(DuplicationTokenBuilder.class); when(context.duplicationTokenBuilder(inputFile)).thenReturn(builder); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java index f283ffb0cd1..9f1a4436a0e 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/rule/OneIssuePerLineSensorTest.java @@ -60,7 +60,7 @@ public class OneIssuePerLineSensorTest { @Test public void testRule() throws IOException { - DefaultFileSystem fs = new DefaultFileSystem(temp.newFolder()); + DefaultFileSystem fs = new DefaultFileSystem(temp.newFolder().toPath()); DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10); fs.add(inputFile); @@ -84,7 +84,7 @@ public class OneIssuePerLineSensorTest { @Test public void testForceSeverity() throws IOException { - DefaultFileSystem fs = new DefaultFileSystem(temp.newFolder()); + DefaultFileSystem fs = new DefaultFileSystem(temp.newFolder().toPath()); DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10); fs.add(inputFile); diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java index d0156cc083d..eda682a7a43 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/scm/XooBlameCommandTest.java @@ -57,7 +57,7 @@ public class XooBlameCommandTest { @Before public void prepare() throws IOException { baseDir = temp.newFolder(); - fs = new DefaultFileSystem(baseDir); + fs = new DefaultFileSystem(baseDir.toPath()); input = mock(BlameInput.class); when(input.fileSystem()).thenReturn(fs); } @@ -68,7 +68,7 @@ public class XooBlameCommandTest { FileUtils.write(source, "sample content"); File scm = new File(baseDir, "src/foo.xoo.scm"); FileUtils.write(scm, "123,julien,2014-12-12\n234,julien,2014-12-24"); - DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setAbsolutePath(new File(baseDir, "src/foo.xoo").getAbsolutePath()).setLanguage(Xoo.KEY); + DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage(Xoo.KEY); fs.add(inputFile); BlameOutput result = mock(BlameOutput.class); |