aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-04 15:14:50 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-05 13:40:26 +0200
commit92ab7df5f6d58a9711cdc00dbaafd0648b22e940 (patch)
tree4a1101db723ac3d89c734d05b22d034acc1f38fa /sonar-batch
parent15ec53105ce82aa3d85ad322b0a2cca16cfe7d0b (diff)
downloadsonarqube-92ab7df5f6d58a9711cdc00dbaafd0648b22e940.tar.gz
sonarqube-92ab7df5f6d58a9711cdc00dbaafd0648b22e940.zip
SONAR-6761 Drop incremental mode
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java3
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java11
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java49
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ProjectAnalysisMode.java16
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilder.java10
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalModeTest.java6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java155
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/ProjectAnalysisModeTest.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java5
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderTest.java9
11 files changed, 15 insertions, 271 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java
index 83c2249ad65..1965abc1730 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java
@@ -40,8 +40,7 @@ public class GlobalMode {
preview = "true".equals(props.property(CoreProperties.DRY_RUN));
} else {
String mode = props.property(CoreProperties.ANALYSIS_MODE);
- preview = CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode) || CoreProperties.ANALYSIS_MODE_INCREMENTAL.equals(mode) ||
- CoreProperties.ANALYSIS_MODE_QUICK.equals(mode);
+ preview = CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode) || CoreProperties.ANALYSIS_MODE_QUICK.equals(mode);
}
if (preview) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
index ecd8ba5ad2c..01a218c2ae9 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/LocalIssueTracking.java
@@ -31,7 +31,6 @@ import java.util.Set;
import javax.annotation.CheckForNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.rule.ActiveRule;
@@ -69,7 +68,6 @@ public class LocalIssueTracking {
private final ActiveRules activeRules;
private final BatchComponentCache componentCache;
private final ServerIssueRepository serverIssueRepository;
- private final AnalysisMode analysisMode;
private final ReportPublisher reportPublisher;
private final Date analysisDate;
@@ -78,7 +76,7 @@ public class LocalIssueTracking {
public LocalIssueTracking(BatchComponentCache resourceCache, IssueCache issueCache, IssueTracking tracking,
ServerLineHashesLoader lastLineHashes, IssueWorkflow workflow, IssueUpdater updater,
ActiveRules activeRules, ServerIssueRepository serverIssueRepository,
- ProjectRepositories projectRepositories, AnalysisMode analysisMode, ReportPublisher reportPublisher) {
+ ProjectRepositories projectRepositories, ReportPublisher reportPublisher) {
this.componentCache = resourceCache;
this.issueCache = issueCache;
this.tracking = tracking;
@@ -86,7 +84,6 @@ public class LocalIssueTracking {
this.workflow = workflow;
this.updater = updater;
this.serverIssueRepository = serverIssueRepository;
- this.analysisMode = analysisMode;
this.reportPublisher = reportPublisher;
this.analysisDate = ((Project) resourceCache.getRoot().resource()).getAnalysisDate();
this.changeContext = IssueChangeContext.createScan(analysisDate);
@@ -107,12 +104,6 @@ public class LocalIssueTracking {
}
public void trackIssues(BatchReportReader reader, BatchComponent component) {
-
- if (analysisMode.isIncremental() && !component.isFile()) {
- // No need to report issues on project or directories in preview mode since it is likely to be wrong anyway
- return;
- }
-
// raw issues = all the issues created by rule engines during this module scan and not excluded by filters
Set<BatchReport.Issue> rawIssues = Sets.newIdentityHashSet();
try (CloseableIterator<BatchReport.Issue> it = reader.readComponentIssues(component.batchId())) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
index bfb4370340a..1212dd7ceaf 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/issue/tracking/ServerIssueRepository.java
@@ -21,17 +21,10 @@ package org.sonar.batch.issue.tracking;
import com.google.common.base.Function;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
import javax.annotation.Nullable;
-import org.sonar.api.batch.AnalysisMode;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
-import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.InputFile.Status;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
@@ -42,7 +35,6 @@ import org.sonar.batch.index.Caches;
import org.sonar.batch.protocol.input.BatchInput.ServerIssue;
import org.sonar.batch.repository.ServerIssuesLoader;
import org.sonar.batch.scan.ImmutableProjectReactor;
-import org.sonar.batch.scan.filesystem.InputPathCache;
import org.sonar.core.component.ComponentKeys;
@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
@@ -56,21 +48,15 @@ public class ServerIssueRepository {
private final ServerIssuesLoader previousIssuesLoader;
private final ImmutableProjectReactor reactor;
private final BatchComponentCache resourceCache;
- private final AnalysisMode analysisMode;
- public ServerIssueRepository(Caches caches, ServerIssuesLoader previousIssuesLoader, ImmutableProjectReactor reactor, BatchComponentCache resourceCache,
- AnalysisMode analysisMode) {
+ public ServerIssueRepository(Caches caches, ServerIssuesLoader previousIssuesLoader, ImmutableProjectReactor reactor, BatchComponentCache resourceCache) {
this.caches = caches;
this.previousIssuesLoader = previousIssuesLoader;
this.reactor = reactor;
this.resourceCache = resourceCache;
- this.analysisMode = analysisMode;
}
public void load() {
- if (analysisMode.isIncremental()) {
- return;
- }
Profiler profiler = Profiler.create(LOG).startInfo("Load server issues");
this.issuesCache = caches.createCache("previousIssues");
caches.registerValueCoder(ServerIssue.class, new ServerIssueValueCoder());
@@ -79,22 +65,7 @@ public class ServerIssueRepository {
}
public Iterable<ServerIssue> byComponent(BatchComponent component) {
- if (analysisMode.isIncremental()) {
- if (!component.isFile()) {
- throw new UnsupportedOperationException("Incremental mode should only get issues on files");
- }
- InputFile inputFile = (InputFile) component.inputComponent();
- if (inputFile.status() == Status.ADDED) {
- return Collections.emptyList();
- }
- Profiler profiler = Profiler.create(LOG).startInfo("Load server issues for " + component.resource().getPath());
- ServerIssueConsumer consumer = new ServerIssueConsumer();
- boolean fromCache = previousIssuesLoader.load(component.key(), consumer, true);
- stopDebug(profiler, "Load server issues for " + component.resource().getPath(), fromCache);
- return consumer.issueList;
- } else {
- return issuesCache.values(component.batchId());
- }
+ return issuesCache.values(component.batchId());
}
private static void stopDebug(Profiler profiler, String msg, boolean fromCache) {
@@ -124,23 +95,7 @@ public class ServerIssueRepository {
}
}
- private static class ServerIssueConsumer implements Function<ServerIssue, Void> {
- List<ServerIssue> issueList = new LinkedList<>();
-
- @Override
- public Void apply(@Nullable ServerIssue issue) {
- if (issue == null) {
- return null;
- }
- issueList.add(issue);
- return null;
- }
- }
-
public Iterable<ServerIssue> issuesOnMissingComponents() {
- if (analysisMode.isIncremental()) {
- throw new UnsupportedOperationException("Only issues of analyzed components are loaded in incremental mode");
- }
return issuesCache.values(0);
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectAnalysisMode.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectAnalysisMode.java
index 051fdcb2c0f..d13d1710e55 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectAnalysisMode.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectAnalysisMode.java
@@ -39,7 +39,6 @@ public class ProjectAnalysisMode implements AnalysisMode {
private static final Logger LOG = LoggerFactory.getLogger(ProjectAnalysisMode.class);
private boolean preview;
- private boolean incremental;
private boolean quick;
private boolean mediumTestMode;
@@ -49,7 +48,7 @@ public class ProjectAnalysisMode implements AnalysisMode {
@Override
public boolean isPreview() {
- return preview || incremental || quick;
+ return preview || quick;
}
@Override
@@ -57,11 +56,6 @@ public class ProjectAnalysisMode implements AnalysisMode {
return quick;
}
- @Override
- public boolean isIncremental() {
- return incremental;
- }
-
public boolean isMediumTest() {
return mediumTestMode;
}
@@ -82,18 +76,14 @@ public class ProjectAnalysisMode implements AnalysisMode {
if (getPropertyWithFallback(analysisProps, globalProps, CoreProperties.DRY_RUN) != null) {
LOG.warn(MessageFormat.format("Property {0} is deprecated. Please use {1} instead.", CoreProperties.DRY_RUN, CoreProperties.ANALYSIS_MODE));
preview = "true".equals(getPropertyWithFallback(analysisProps, globalProps, CoreProperties.DRY_RUN));
- incremental = false;
} else {
String mode = getPropertyWithFallback(analysisProps, globalProps, CoreProperties.ANALYSIS_MODE);
preview = CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode);
- incremental = CoreProperties.ANALYSIS_MODE_INCREMENTAL.equals(mode);
quick = CoreProperties.ANALYSIS_MODE_QUICK.equals(mode);
}
mediumTestMode = "true".equals(getPropertyWithFallback(analysisProps, globalProps, BatchMediumTester.MEDIUM_TEST_ENABLED));
- if (incremental) {
- LOG.info("Incremental mode");
- } else if (preview) {
+ if (preview) {
LOG.info("Preview mode");
} else if (quick) {
LOG.info("Quick mode");
@@ -115,6 +105,6 @@ public class ProjectAnalysisMode implements AnalysisMode {
String mode = props.get(CoreProperties.ANALYSIS_MODE);
return "true".equals(props.get(CoreProperties.DRY_RUN)) || CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode) ||
- CoreProperties.ANALYSIS_MODE_INCREMENTAL.equals(mode) || CoreProperties.ANALYSIS_MODE_QUICK.equals(mode);
+ CoreProperties.ANALYSIS_MODE_QUICK.equals(mode);
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilder.java
index f7296e97de5..7eed7121d6c 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilder.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilder.java
@@ -19,8 +19,6 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.batch.scan.ProjectAnalysisMode;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
@@ -44,18 +42,16 @@ class InputFileBuilder {
private final LanguageDetection langDetection;
private final StatusDetection statusDetection;
private final DefaultModuleFileSystem fs;
- private final ProjectAnalysisMode analysisMode;
private final Settings settings;
private final FileMetadata fileMetadata;
InputFileBuilder(String moduleKey, PathResolver pathResolver, LanguageDetection langDetection,
- StatusDetection statusDetection, DefaultModuleFileSystem fs, ProjectAnalysisMode analysisMode, Settings settings, FileMetadata fileMetadata) {
+ StatusDetection statusDetection, DefaultModuleFileSystem fs, Settings settings, FileMetadata fileMetadata) {
this.moduleKey = moduleKey;
this.pathResolver = pathResolver;
this.langDetection = langDetection;
this.statusDetection = statusDetection;
this.fs = fs;
- this.analysisMode = analysisMode;
this.settings = settings;
this.fileMetadata = fileMetadata;
}
@@ -108,9 +104,7 @@ class InputFileBuilder {
inputFile.initMetadata(fileMetadata.readMetadata(inputFile.file(), fs.encoding()));
inputFile.setStatus(statusDetection.status(inputFile.moduleKey(), inputFile.relativePath(), inputFile.hash()));
- if (analysisMode.isIncremental() && inputFile.status() == InputFile.Status.SAME) {
- return null;
- }
+
return inputFile;
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java
index 3e9d31fbd89..9fcc20120b5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactory.java
@@ -19,8 +19,6 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.batch.scan.ProjectAnalysisMode;
-
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.fs.internal.FileMetadata;
@@ -34,22 +32,20 @@ public class InputFileBuilderFactory {
private final PathResolver pathResolver;
private final LanguageDetectionFactory langDetectionFactory;
private final StatusDetectionFactory statusDetectionFactory;
- private final ProjectAnalysisMode analysisMode;
private final Settings settings;
private final FileMetadata fileMetadata;
public InputFileBuilderFactory(ProjectDefinition def, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory,
- StatusDetectionFactory statusDetectionFactory, ProjectAnalysisMode analysisMode, Settings settings, FileMetadata fileMetadata) {
+ StatusDetectionFactory statusDetectionFactory, Settings settings, FileMetadata fileMetadata) {
this.fileMetadata = fileMetadata;
this.moduleKey = def.getKeyWithBranch();
this.pathResolver = pathResolver;
this.langDetectionFactory = langDetectionFactory;
this.statusDetectionFactory = statusDetectionFactory;
- this.analysisMode = analysisMode;
this.settings = settings;
}
InputFileBuilder create(DefaultModuleFileSystem fs) {
- return new InputFileBuilder(moduleKey, pathResolver, langDetectionFactory.create(), statusDetectionFactory.create(), fs, analysisMode, settings, fileMetadata);
+ return new InputFileBuilder(moduleKey, pathResolver, langDetectionFactory.create(), statusDetectionFactory.create(), fs, settings, fileMetadata);
}
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalModeTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalModeTest.java
index fb174d9d506..1c01582f13a 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalModeTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/GlobalModeTest.java
@@ -41,12 +41,6 @@ public class GlobalModeTest {
}
@Test
- public void testIncremental() {
- GlobalMode mode = createMode(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_INCREMENTAL);
- assertThat(mode.isPreview()).isTrue();
- }
-
- @Test
public void testOtherProperty() {
GlobalMode mode = createMode(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ANALYSIS);
assertThat(mode.isPreview()).isFalse();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java
deleted file mode 100644
index 6d1685a3d1f..00000000000
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/preview/IncrementalModeMediumTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.batch.mediumtest.preview;
-
-import com.google.common.collect.ImmutableMap;
-import java.io.File;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.io.FileUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.rule.RuleKey;
-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.FileData;
-import org.sonar.xoo.XooPlugin;
-import org.sonar.xoo.rule.XooRulesDefinition;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.groups.Tuple.tuple;
-
-public class IncrementalModeMediumTest {
-
- private static final String SAMPLE_CONTENT = "Sample content\nwith\n4\nlines";
-
- @org.junit.Rule
- public TemporaryFolder temp = new TemporaryFolder();
-
- private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
-
- private static Long date(String date) {
- try {
- return sdf.parse(date).getTime();
- } catch (ParseException e) {
- throw new IllegalStateException(e);
- }
- }
-
- public BatchMediumTester tester = BatchMediumTester
- .builder()
- .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_INCREMENTAL))
- .registerPlugin("xoo", new XooPlugin())
- .addRules(new XooRulesDefinition())
- .addDefaultQProfile("xoo", "Sonar Way")
- .activateRule(new ActiveRule("xoo", "OneIssuePerLine", null, "One issue per line", "MAJOR", null, "xoo"))
- .activateRule(new ActiveRule("manual", "MyManualIssue", null, "My manual issue", "MAJOR", null, null))
- .setPreviousAnalysisDate(new Date())
- .addFileData("sample", "src/sample.xoo", new FileData(DigestUtils.md5Hex(SAMPLE_CONTENT), false))
- .mockLineHashes("sample:src/sample.xoo",
- new String[] {DigestUtils.md5Hex("Samplecontent"), DigestUtils.md5Hex("oldcode"), DigestUtils.md5Hex("4"), DigestUtils.md5Hex("lines")})
- // Remote open issue => will be tracked and not new
- .mockServerIssue(org.sonar.batch.protocol.input.BatchInput.ServerIssue.newBuilder().setKey("xyz")
- .setModuleKey("sample")
- .setPath("src/sample.xoo")
- .setRuleRepository("xoo")
- .setRuleKey("OneIssuePerLine")
- .setLine(1)
- .setSeverity(Severity.MAJOR)
- .setCreationDate(date("14/03/2004"))
- .setChecksum(DigestUtils.md5Hex("Samplecontent"))
- .setStatus("OPEN")
- .build())
- // Remote open issue that no more exists => will be closed
- .mockServerIssue(org.sonar.batch.protocol.input.BatchInput.ServerIssue.newBuilder().setKey("resolved")
- .setModuleKey("sample")
- .setPath("src/sample.xoo")
- .setRuleRepository("xoo")
- .setRuleKey("OneIssuePerFile")
- .setMsg("An issue that is no more detected")
- .setLine(2)
- .setSeverity(Severity.MAJOR)
- .setCreationDate(date("14/03/2004"))
- .setChecksum(DigestUtils.md5Hex("oldcode"))
- .setStatus("OPEN")
- .build())
- // Manual issue
- .mockServerIssue(org.sonar.batch.protocol.input.BatchInput.ServerIssue.newBuilder().setKey("manual")
- .setModuleKey("sample")
- .setPath("src/sample.xoo")
- .setRuleRepository("manual")
- .setRuleKey("MyManualIssue")
- .setLine(4)
- .setSeverity(Severity.MAJOR)
- .setCreationDate(date("14/03/2004"))
- .setChecksum(DigestUtils.md5Hex("lines"))
- .setStatus("OPEN")
- .build())
- .build();
-
- @Before
- public void prepare() {
- tester.start();
- }
-
- @After
- public void stop() {
- tester.stop();
- }
-
- @Test
- public void testIssueTrackingIncrementalMode() throws Exception {
- File baseDir = temp.newFolder();
- File srcDir = new File(baseDir, "src");
- srcDir.mkdir();
-
- File xooFile = new File(srcDir, "sample.xoo");
- FileUtils.write(xooFile, SAMPLE_CONTENT + "\nmodification");
-
- TaskResult result = tester.newTask()
- .properties(ImmutableMap.<String, String>builder()
- .put("sonar.task", "scan")
- .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
- .put("sonar.projectKey", "sample")
- .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.trackedIssues()).extracting("ruleKey", "line", "message", "status", "resolution", "new").containsOnly(
- tuple(RuleKey.of("xoo", "OneIssuePerLine"), 1, "This issue is generated on each line", "OPEN", null, false),
- tuple(RuleKey.of("xoo", "OneIssuePerLine"), 2, "This issue is generated on each line", "OPEN", null, true),
- tuple(RuleKey.of("xoo", "OneIssuePerLine"), 3, "This issue is generated on each line", "OPEN", null, true),
- tuple(RuleKey.of("xoo", "OneIssuePerLine"), 4, "This issue is generated on each line", "OPEN", null, true),
- tuple(RuleKey.of("xoo", "OneIssuePerLine"), 5, "This issue is generated on each line", "OPEN", null, true),
- tuple(RuleKey.of("manual", "MyManualIssue"), 4, null, "OPEN", null, false),
- tuple(RuleKey.of("xoo", "OneIssuePerFile"), null, "An issue that is no more detected", "CLOSED", "REMOVED", false));
- }
-
-}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectAnalysisModeTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectAnalysisModeTest.java
index 75a705a95d3..c7a04640777 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectAnalysisModeTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ProjectAnalysisModeTest.java
@@ -39,12 +39,10 @@ public class ProjectAnalysisModeTest {
ProjectAnalysisMode mode = createMode(null);
assertThat(mode.isPreview()).isFalse();
- assertThat(mode.isIncremental()).isFalse();
mode = createMode(CoreProperties.ANALYSIS_MODE, "pouet");
assertThat(mode.isPreview()).isFalse();
- assertThat(mode.isIncremental()).isFalse();
}
@Test(expected = IllegalStateException.class)
@@ -57,7 +55,6 @@ public class ProjectAnalysisModeTest {
ProjectAnalysisMode mode = createMode(CoreProperties.ANALYSIS_MODE_ANALYSIS);
assertThat(mode.isPreview()).isFalse();
- assertThat(mode.isIncremental()).isFalse();
}
@Test
@@ -65,7 +62,6 @@ public class ProjectAnalysisModeTest {
ProjectAnalysisMode mode = createMode(CoreProperties.ANALYSIS_MODE_PREVIEW);
assertThat(mode.isPreview()).isTrue();
- assertThat(mode.isIncremental()).isFalse();
}
@Test
@@ -73,19 +69,10 @@ public class ProjectAnalysisModeTest {
ProjectAnalysisMode mode = createMode(CoreProperties.ANALYSIS_MODE_QUICK);
assertThat(mode.isPreview()).isTrue();
- assertThat(mode.isIncremental()).isFalse();
assertThat(mode.isQuick()).isTrue();
}
@Test
- public void support_incremental_mode() {
- ProjectAnalysisMode mode = createMode(CoreProperties.ANALYSIS_MODE_INCREMENTAL);
-
- assertThat(mode.isPreview()).isTrue();
- assertThat(mode.isIncremental()).isTrue();
- }
-
- @Test
public void support_deprecated_dryrun_property() {
Map<String, String> bootstrapMap = new HashMap<>();
Map<String, String> analysisMap = new HashMap<>();
@@ -96,7 +83,6 @@ public class ProjectAnalysisModeTest {
ProjectAnalysisMode mode = new ProjectAnalysisMode(new BootstrapProperties(bootstrapMap), new AnalysisProperties(analysisMap));
assertThat(mode.isPreview()).isTrue();
- assertThat(mode.isIncremental()).isFalse();
}
private static ProjectAnalysisMode createMode(@Nullable String mode) {
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java
index 2f5141d676e..1c60bacd9d5 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderFactoryTest.java
@@ -19,8 +19,6 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.batch.scan.ProjectAnalysisMode;
-
import org.junit.Test;
import org.mockito.Mockito;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
@@ -37,10 +35,9 @@ public class InputFileBuilderFactoryTest {
LanguageDetectionFactory langDetectionFactory = mock(LanguageDetectionFactory.class, Mockito.RETURNS_MOCKS);
StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS);
DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class);
- ProjectAnalysisMode analysisMode = mock(ProjectAnalysisMode.class);
InputFileBuilderFactory factory = new InputFileBuilderFactory(ProjectDefinition.create().setKey("struts"), pathResolver, langDetectionFactory,
- statusDetectionFactory, analysisMode, new Settings(), new FileMetadata());
+ statusDetectionFactory, new Settings(), new FileMetadata());
InputFileBuilder builder = factory.create(fs);
assertThat(builder.langDetection()).isNotNull();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderTest.java
index 5b14b2bc9be..c6fa8ec6822 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/InputFileBuilderTest.java
@@ -19,8 +19,6 @@
*/
package org.sonar.batch.scan.filesystem;
-import org.sonar.batch.scan.ProjectAnalysisMode;
-
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
@@ -48,7 +46,6 @@ public class InputFileBuilderTest {
LanguageDetection langDetection = mock(LanguageDetection.class);
StatusDetection statusDetection = mock(StatusDetection.class);
DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class);
- ProjectAnalysisMode analysisMode = mock(ProjectAnalysisMode.class);
@Test
public void complete_input_file() throws Exception {
@@ -68,7 +65,7 @@ public class InputFileBuilderTest {
.thenReturn(InputFile.Status.ADDED);
InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
- langDetection, statusDetection, fs, analysisMode, new Settings(), new FileMetadata());
+ langDetection, statusDetection, fs, new Settings(), new FileMetadata());
DefaultInputFile inputFile = builder.create(srcFile);
builder.completeAndComputeMetadata(inputFile, InputFile.Type.MAIN);
@@ -91,7 +88,7 @@ public class InputFileBuilderTest {
when(fs.baseDir()).thenReturn(basedir);
InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
- langDetection, statusDetection, fs, analysisMode, new Settings(), new FileMetadata());
+ langDetection, statusDetection, fs, new Settings(), new FileMetadata());
DefaultInputFile inputFile = builder.create(srcFile);
assertThat(inputFile).isNull();
@@ -111,7 +108,7 @@ public class InputFileBuilderTest {
when(langDetection.language(any(InputFile.class))).thenReturn(null);
InputFileBuilder builder = new InputFileBuilder("struts", new PathResolver(),
- langDetection, statusDetection, fs, analysisMode, new Settings(), new FileMetadata());
+ langDetection, statusDetection, fs, new Settings(), new FileMetadata());
DefaultInputFile inputFile = builder.create(srcFile);
inputFile = builder.completeAndComputeMetadata(inputFile, InputFile.Type.MAIN);