diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-09-15 16:50:12 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-09-17 16:48:24 +0200 |
commit | ce60ac8d2e137f33bb111668e54e78c195c73d79 (patch) | |
tree | 7a99ab075ee9c85ec71cfa5ee65c2aed794feb04 /sonar-batch/src | |
parent | 0d1b0b7a200c12d6f966cf1d7e7ec23d3db30760 (diff) | |
download | sonarqube-ce60ac8d2e137f33bb111668e54e78c195c73d79.tar.gz sonarqube-ce60ac8d2e137f33bb111668e54e78c195c73d79.zip |
No op for highlighting and symbol references in issues mode
Diffstat (limited to 'sonar-batch/src')
14 files changed, 198 insertions, 33 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java index a4f7c8c8b2e..04b5724b2c3 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java @@ -76,9 +76,9 @@ public class TaskResult implements org.sonar.batch.mediumtest.ScanTaskObserver { issues.add(issue); } + ReportPublisher reportPublisher = container.getComponentByType(ReportPublisher.class); + reader = new BatchReportReader(reportPublisher.getReportDir()); if (!container.getComponentByType(AnalysisMode.class).isIssues()) { - ReportPublisher reportPublisher = container.getComponentByType(ReportPublisher.class); - reader = new BatchReportReader(reportPublisher.getReportDir()); Metadata readMetadata = getReportReader().readMetadata(); int rootComponentRef = readMetadata.getRootComponentRef(); storeReportComponents(rootComponentRef, null, readMetadata.hasBranch() ? readMetadata.getBranch() : null); diff --git a/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorContext.java b/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorContext.java index 57197abc0a1..cb58332f96c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorContext.java +++ b/sonar-batch/src/main/java/org/sonar/batch/sensor/DefaultSensorContext.java @@ -19,8 +19,10 @@ */ package org.sonar.batch.sensor; +import java.io.Serializable; import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.rule.ActiveRules; import org.sonar.api.batch.sensor.SensorContext; import org.sonar.api.batch.sensor.coverage.NewCoverage; @@ -28,6 +30,7 @@ import org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage; import org.sonar.api.batch.sensor.duplication.NewDuplication; import org.sonar.api.batch.sensor.duplication.internal.DefaultDuplication; import org.sonar.api.batch.sensor.highlighting.NewHighlighting; +import org.sonar.api.batch.sensor.highlighting.TypeOfText; import org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting; import org.sonar.api.batch.sensor.internal.SensorStorage; import org.sonar.api.batch.sensor.issue.NewIssue; @@ -36,10 +39,29 @@ import org.sonar.api.batch.sensor.measure.NewMeasure; import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure; import org.sonar.api.config.Settings; -import java.io.Serializable; - public class DefaultSensorContext implements SensorContext { + private static final NoOpNewHighlighting NO_OP_NEW_HIGHLIGHTING = new NoOpNewHighlighting(); + + private static final class NoOpNewHighlighting implements NewHighlighting { + @Override + public void save() { + // Do nothing + } + + @Override + public NewHighlighting onFile(InputFile inputFile) { + // Do nothing + return this; + } + + @Override + public NewHighlighting highlight(int startOffset, int endOffset, TypeOfText typeOfText) { + // Do nothing + return this; + } + } + private final Settings settings; private final FileSystem fs; private final ActiveRules activeRules; @@ -86,6 +108,9 @@ public class DefaultSensorContext implements SensorContext { @Override public NewHighlighting newHighlighting() { + if (analysisMode.isIssues()) { + return NO_OP_NEW_HIGHLIGHTING; + } return new DefaultHighlighting(sensorStorage); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultHighlightable.java b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultHighlightable.java index e03531d243e..6d38bbb320b 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultHighlightable.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultHighlightable.java @@ -19,6 +19,7 @@ */ package org.sonar.batch.source; +import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.sensor.highlighting.TypeOfText; import org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting; @@ -30,21 +31,40 @@ import org.sonar.api.source.Highlightable; */ public class DefaultHighlightable implements Highlightable { + private static final HighlightingBuilder NO_OP_BUILDER = new NoOpHighlightingBuilder(); private final DefaultInputFile inputFile; private final SensorStorage sensorStorage; + private final AnalysisMode analysisMode; - public DefaultHighlightable(DefaultInputFile inputFile, SensorStorage sensorStorage) { + public DefaultHighlightable(DefaultInputFile inputFile, SensorStorage sensorStorage, AnalysisMode analysisMode) { this.inputFile = inputFile; this.sensorStorage = sensorStorage; + this.analysisMode = analysisMode; } @Override public HighlightingBuilder newHighlighting() { + if (analysisMode.isIssues()) { + return NO_OP_BUILDER; + } DefaultHighlighting defaultHighlighting = new DefaultHighlighting(sensorStorage); defaultHighlighting.onFile(inputFile); return new DefaultHighlightingBuilder(defaultHighlighting); } + private static final class NoOpHighlightingBuilder implements HighlightingBuilder { + @Override + public HighlightingBuilder highlight(int startOffset, int endOffset, String typeOfText) { + // Do nothing + return this; + } + + @Override + public void done() { + // Do nothing + } + } + private static class DefaultHighlightingBuilder implements HighlightingBuilder { private final DefaultHighlighting defaultHighlighting; diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java index e2bbf13bfa8..ce9766e0859 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolTable.java @@ -20,13 +20,18 @@ package org.sonar.batch.source; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import org.sonar.api.batch.fs.TextRange; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.source.Symbol; import org.sonar.api.source.Symbolizable; -import java.util.*; - public class DefaultSymbolTable implements Symbolizable.SymbolTable { private Map<Symbol, Set<TextRange>> referencesBySymbol; @@ -55,6 +60,25 @@ public class DefaultSymbolTable implements Symbolizable.SymbolTable { public static class Builder implements Symbolizable.SymbolTableBuilder { + private static final FakeSymbol FAKE_SYMBOL = new FakeSymbol(); + + private static final class FakeSymbol implements Symbol { + @Override + public String getFullyQualifiedName() { + return null; + } + + @Override + public int getDeclarationStartOffset() { + return 0; + } + + @Override + public int getDeclarationEndOffset() { + return 0; + } + } + private final Map<Symbol, Set<TextRange>> referencesBySymbol = new LinkedHashMap<>(); private final DefaultInputFile inputFile; diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java index f65cb609c21..5089a9cca47 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/DefaultSymbolizable.java @@ -20,27 +20,90 @@ package org.sonar.batch.source; +import java.util.Collections; +import java.util.List; +import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.internal.DefaultInputFile; +import org.sonar.api.source.Symbol; import org.sonar.api.source.Symbolizable; import org.sonar.batch.sensor.DefaultSensorStorage; public class DefaultSymbolizable implements Symbolizable { + private static final NoOpSymbolTableBuilder NO_OP_SYMBOL_TABLE_BUILDER = new NoOpSymbolTableBuilder(); + private static final NoOpSymbolTable NO_OP_SYMBOL_TABLE = new NoOpSymbolTable(); + private static final NoOpSymbol NO_OP_SYMBOL = new NoOpSymbol(); + + private static final class NoOpSymbolTableBuilder implements SymbolTableBuilder { + @Override + public Symbol newSymbol(int fromOffset, int toOffset) { + return NO_OP_SYMBOL; + } + + @Override + public void newReference(Symbol symbol, int fromOffset) { + // Do nothing + } + + @Override + public SymbolTable build() { + return NO_OP_SYMBOL_TABLE; + } + } + + private static final class NoOpSymbolTable implements SymbolTable { + @Override + public List<Symbol> symbols() { + return Collections.emptyList(); + } + + @Override + public List<Integer> references(Symbol symbol) { + return Collections.emptyList(); + } + } + + private static final class NoOpSymbol implements Symbol { + @Override + public String getFullyQualifiedName() { + return null; + } + + @Override + public int getDeclarationStartOffset() { + return 0; + } + + @Override + public int getDeclarationEndOffset() { + return 0; + } + } + private final DefaultInputFile inputFile; private final DefaultSensorStorage sensorStorage; + private final AnalysisMode analysisMode; - public DefaultSymbolizable(DefaultInputFile inputFile, DefaultSensorStorage sensorStorage) { + public DefaultSymbolizable(DefaultInputFile inputFile, DefaultSensorStorage sensorStorage, AnalysisMode analysisMode) { this.inputFile = inputFile; this.sensorStorage = sensorStorage; + this.analysisMode = analysisMode; } @Override public SymbolTableBuilder newSymbolTableBuilder() { + if (analysisMode.isIssues()) { + return NO_OP_SYMBOL_TABLE_BUILDER; + } return new DefaultSymbolTable.Builder(inputFile); } @Override public void setSymbolTable(SymbolTable symbolTable) { + if (analysisMode.isIssues()) { + // No need for symbols in issues mode + return; + } sensorStorage.store(inputFile, ((DefaultSymbolTable) symbolTable).getReferencesBySymbol()); } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/HighlightableBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/source/HighlightableBuilder.java index 067b96d882e..69acf876cd9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/HighlightableBuilder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/HighlightableBuilder.java @@ -20,6 +20,7 @@ package org.sonar.batch.source; import javax.annotation.CheckForNull; +import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.sensor.internal.SensorStorage; @@ -30,10 +31,12 @@ import org.sonar.batch.index.BatchComponent; public class HighlightableBuilder extends PerspectiveBuilder<Highlightable> { private final SensorStorage sensorStorage; + private final AnalysisMode analysisMode; - public HighlightableBuilder(SensorStorage sensorStorage) { + public HighlightableBuilder(SensorStorage sensorStorage, AnalysisMode analysisMode) { super(Highlightable.class); this.sensorStorage = sensorStorage; + this.analysisMode = analysisMode; } @CheckForNull @@ -41,7 +44,7 @@ public class HighlightableBuilder extends PerspectiveBuilder<Highlightable> { public Highlightable loadPerspective(Class<Highlightable> perspectiveClass, BatchComponent component) { if (component.isFile()) { InputFile path = (InputFile) component.inputComponent(); - return new DefaultHighlightable((DefaultInputFile) path, sensorStorage); + return new DefaultHighlightable((DefaultInputFile) path, sensorStorage, analysisMode); } return null; } diff --git a/sonar-batch/src/main/java/org/sonar/batch/source/SymbolizableBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/source/SymbolizableBuilder.java index fc377e0d820..48d7033a6b5 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/source/SymbolizableBuilder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/source/SymbolizableBuilder.java @@ -21,6 +21,7 @@ package org.sonar.batch.source; import javax.annotation.CheckForNull; +import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.source.Symbolizable; @@ -31,10 +32,12 @@ import org.sonar.batch.sensor.DefaultSensorStorage; public class SymbolizableBuilder extends PerspectiveBuilder<Symbolizable> { private final DefaultSensorStorage sensorStorage; + private final AnalysisMode analysisMode; - public SymbolizableBuilder(DefaultSensorStorage sensorStorage) { + public SymbolizableBuilder(DefaultSensorStorage sensorStorage, AnalysisMode analysisMode) { super(Symbolizable.class); this.sensorStorage = sensorStorage; + this.analysisMode = analysisMode; } @CheckForNull @@ -42,7 +45,7 @@ public class SymbolizableBuilder extends PerspectiveBuilder<Symbolizable> { public Symbolizable loadPerspective(Class<Symbolizable> perspectiveClass, BatchComponent component) { if (component.isFile()) { InputFile path = (InputFile) component.inputComponent(); - return new DefaultSymbolizable((DefaultInputFile) path, sensorStorage); + return new DefaultSymbolizable((DefaultInputFile) path, sensorStorage, analysisMode); } return null; } diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/highlighting/HighlightingMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/highlighting/HighlightingMediumTest.java index 5dcc1d57af9..bb0ad02c659 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/highlighting/HighlightingMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/highlighting/HighlightingMediumTest.java @@ -71,7 +71,6 @@ public class HighlightingMediumTest { TaskResult result = tester.newTask() .properties(ImmutableMap.<String, String>builder() - .put("sonar.task", "scan") .put("sonar.projectBaseDir", baseDir.getAbsolutePath()) .put("sonar.projectKey", "com.foo.project") .put("sonar.projectName", "Foo Project") @@ -112,7 +111,6 @@ public class HighlightingMediumTest { long start = System.currentTimeMillis(); TaskResult result = tester.newTask() .properties(ImmutableMap.<String, String>builder() - .put("sonar.task", "scan") .put("sonar.projectBaseDir", baseDir.getAbsolutePath()) .put("sonar.projectKey", "com.foo.project") .put("sonar.projectName", "Foo Project") diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java index 83b5c18433a..47d0589c0c3 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java @@ -19,17 +19,14 @@ */ package org.sonar.batch.mediumtest.issuesmode; -import org.sonar.batch.protocol.input.BatchInput.ServerIssue; - import com.google.common.collect.ImmutableMap; - import java.io.File; +import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedList; import java.util.List; - import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.FileFilterUtils; @@ -45,9 +42,11 @@ import org.sonar.batch.mediumtest.BatchMediumTester; import org.sonar.batch.mediumtest.TaskResult; import org.sonar.batch.protocol.Constants.Severity; import org.sonar.batch.protocol.input.ActiveRule; +import org.sonar.batch.protocol.input.BatchInput.ServerIssue; import org.sonar.batch.scan.report.ConsoleReport; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; + import static org.assertj.core.api.Assertions.assertThat; public class IssueModeAndReportsMediumTest { @@ -156,7 +155,8 @@ public class IssueModeAndReportsMediumTest { int openIssues = 0; int resolvedIssue = 0; for (Issue issue : result.trackedIssues()) { - System.out.println(issue.message() + " " + issue.key() + " " + issue.ruleKey() + " " + issue.isNew() + " " + issue.resolution() + " " + issue.componentKey() + " " + issue.line()); + System.out + .println(issue.message() + " " + issue.key() + " " + issue.ruleKey() + " " + issue.isNew() + " " + issue.resolution() + " " + issue.componentKey() + " " + issue.line()); if (issue.isNew()) { newIssues++; } else if (issue.resolution() != null) { @@ -165,7 +165,7 @@ public class IssueModeAndReportsMediumTest { openIssues++; } } - System.out.println("new: " + newIssues + " open: " + openIssues + " resolved " + resolvedIssue); + System.out.println("new: " + newIssues + " open: " + openIssues + " resolved " + resolvedIssue); assertThat(newIssues).isEqualTo(16); assertThat(openIssues).isEqualTo(3); assertThat(resolvedIssue).isEqualTo(1); @@ -263,4 +263,32 @@ public class IssueModeAndReportsMediumTest { } } + @Test + public void noSyntaxHighlightingInIssuesMode() throws IOException { + + File baseDir = temp.newFolder(); + File srcDir = new File(baseDir, "src"); + srcDir.mkdir(); + + File xooFile = new File(srcDir, "sample.xoo"); + File xoohighlightingFile = new File(srcDir, "sample.xoo.highlighting"); + FileUtils.write(xooFile, "Sample xoo\ncontent plop"); + FileUtils.write(xoohighlightingFile, "0:10:s\n11:18:k"); + + TaskResult result = tester.newTask() + .properties(ImmutableMap.<String, String>builder() + .put("sonar.projectBaseDir", baseDir.getAbsolutePath()) + .put("sonar.projectKey", "com.foo.project") + .put("sonar.projectName", "Foo Project") + .put("sonar.projectVersion", "1.0-SNAPSHOT") + .put("sonar.projectDescription", "Description of Foo Project") + .put("sonar.sources", "src") + .build()) + .start(); + + assertThat(result.getReportReader().hasSyntaxHighlighting(1)).isFalse(); + assertThat(result.getReportReader().hasSyntaxHighlighting(2)).isFalse(); + assertThat(result.getReportReader().hasSyntaxHighlighting(3)).isFalse(); + } + } diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java index 4ef06e4a0e5..5cf546a7be4 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultHighlightableTest.java @@ -19,17 +19,17 @@ */ 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; -import java.io.StringReader; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -44,7 +44,7 @@ public class DefaultHighlightableTest { SensorStorage sensorStorage = mock(SensorStorage.class); DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php") .initMetadata(new FileMetadata().readMetadata(new StringReader("azerty\nbla bla"))); - DefaultHighlightable highlightablePerspective = new DefaultHighlightable(inputFile, sensorStorage); + DefaultHighlightable highlightablePerspective = new DefaultHighlightable(inputFile, sensorStorage, mock(AnalysisMode.class)); highlightablePerspective.newHighlighting().highlight(0, 6, "k").highlight(7, 10, "cppd").done(); ArgumentCaptor<DefaultHighlighting> argCaptor = ArgumentCaptor.forClass(DefaultHighlighting.class); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java index 385ce1bbd6a..465c26fbf67 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolTableTest.java @@ -21,6 +21,7 @@ package org.sonar.batch.source; import com.google.common.base.Strings; +import java.io.StringReader; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -30,8 +31,6 @@ import org.sonar.api.batch.fs.internal.FileMetadata; import org.sonar.api.source.Symbol; import org.sonar.api.source.Symbolizable; -import java.io.StringReader; - import static org.assertj.core.api.Assertions.assertThat; public class DefaultSymbolTableTest { diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java index 21803da6c85..7423d81b77a 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/DefaultSymbolizableTest.java @@ -21,17 +21,17 @@ package org.sonar.batch.source; import com.google.common.base.Strings; +import java.io.StringReader; +import java.util.Map; 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.source.Symbol; import org.sonar.api.source.Symbolizable; import org.sonar.batch.sensor.DefaultSensorStorage; -import java.io.StringReader; -import java.util.Map; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; @@ -46,7 +46,7 @@ public class DefaultSymbolizableTest { DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.php") .initMetadata(new FileMetadata().readMetadata(new StringReader(Strings.repeat("azerty\n", 20)))); - DefaultSymbolizable symbolPerspective = new DefaultSymbolizable(inputFile, sensorStorage); + DefaultSymbolizable symbolPerspective = new DefaultSymbolizable(inputFile, sensorStorage, mock(AnalysisMode.class)); Symbolizable.SymbolTableBuilder symbolTableBuilder = symbolPerspective.newSymbolTableBuilder(); Symbol firstSymbol = symbolTableBuilder.newSymbol(4, 8); symbolTableBuilder.newReference(firstSymbol, 12); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java index 2b3d0cc4abf..2ec6988e950 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/HighlightableBuilderTest.java @@ -20,6 +20,7 @@ package org.sonar.batch.source; import org.junit.Test; +import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.sensor.internal.SensorStorage; @@ -39,7 +40,7 @@ public class HighlightableBuilderTest { Resource file = File.create("foo.c").setEffectiveKey("myproject:path/to/foo.c"); BatchComponent component = new BatchComponent(1, file, null).setInputComponent(new DefaultInputFile("foo", "foo.c")); - HighlightableBuilder builder = new HighlightableBuilder(mock(SensorStorage.class)); + HighlightableBuilder builder = new HighlightableBuilder(mock(SensorStorage.class), mock(AnalysisMode.class)); Highlightable perspective = builder.loadPerspective(Highlightable.class, component); assertThat(perspective).isNotNull().isInstanceOf(DefaultHighlightable.class); @@ -49,7 +50,7 @@ public class HighlightableBuilderTest { public void project_should_not_be_highlightable() { BatchComponent component = new BatchComponent(1, new Project("struts").setEffectiveKey("org.struts"), null).setInputComponent(new DefaultInputModule("struts")); - HighlightableBuilder builder = new HighlightableBuilder(mock(SensorStorage.class)); + HighlightableBuilder builder = new HighlightableBuilder(mock(SensorStorage.class), mock(AnalysisMode.class)); Highlightable perspective = builder.loadPerspective(Highlightable.class, component); assertThat(perspective).isNull(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java index 2bc3f32368f..76d0f64b691 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/SymbolizableBuilderTest.java @@ -21,6 +21,7 @@ package org.sonar.batch.source; import org.junit.Test; +import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.component.Perspective; @@ -41,7 +42,7 @@ public class SymbolizableBuilderTest { Resource file = File.create("foo.c").setEffectiveKey("myproject:path/to/foo.c"); BatchComponent component = new BatchComponent(1, file, null).setInputComponent(new DefaultInputFile("foo", "foo.c")); - SymbolizableBuilder perspectiveBuilder = new SymbolizableBuilder(mock(DefaultSensorStorage.class)); + SymbolizableBuilder perspectiveBuilder = new SymbolizableBuilder(mock(DefaultSensorStorage.class), mock(AnalysisMode.class)); Perspective perspective = perspectiveBuilder.loadPerspective(Symbolizable.class, component); assertThat(perspective).isInstanceOf(Symbolizable.class); @@ -51,7 +52,7 @@ public class SymbolizableBuilderTest { public void project_should_not_be_highlightable() { BatchComponent component = new BatchComponent(1, new Project("struts").setEffectiveKey("org.struts"), null).setInputComponent(new DefaultInputModule("struts")); - SymbolizableBuilder builder = new SymbolizableBuilder(mock(DefaultSensorStorage.class)); + SymbolizableBuilder builder = new SymbolizableBuilder(mock(DefaultSensorStorage.class), mock(AnalysisMode.class)); Perspective perspective = builder.loadPerspective(Symbolizable.class, component); assertThat(perspective).isNull(); |