From c9c41f52a93f25286a9d516caa58fcca089ffbc4 Mon Sep 17 00:00:00 2001 From: Lukasz Jarocki Date: Fri, 17 Mar 2023 10:05:42 +0100 Subject: [PATCH] SONAR-18679 moved unit test to integration test in sonar-scanner-engine --- .../mediumtest/ScannerMediumTester.java | 2 +- .../mediumtest/branch/BranchMediumIT.java} | 6 +- .../branch/DeprecatedBranchMediumIT.java} | 2 +- .../coverage/CoverageMediumIT.java} | 2 +- .../coverage/GenericCoverageMediumIT.java} | 2 +- .../scanner/mediumtest/cpd/CpdMediumIT.java} | 2 +- .../mediumtest/fs/FileSystemMediumIT.java} | 2 +- .../fs/NoLanguagesPluginsMediumIT.java} | 2 +- .../fs/ProjectBuilderMediumIT.java} | 2 +- .../highlighting/HighlightingMediumIT.java} | 2 +- .../mediumtest/issues/ChecksMediumIT.java} | 4 +- .../issues/ExternalIssuesMediumIT.java} | 4 +- .../mediumtest/issues/IssuesMediumIT.java} | 2 +- .../issues/IssuesOnDirMediumIT.java} | 4 +- .../issues/IssuesOnModuleMediumIT.java} | 4 +- .../issues/MultilineIssuesMediumIT.java} | 2 +- .../mediumtest/issues/PreviewMediumIT.java} | 2 +- .../log/ExceptionHandlingMediumIT.java} | 2 +- .../mediumtest/log/LogListenerIT.java} | 8 +-- .../measures/MeasuresMediumIT.java} | 4 +- .../scanner/mediumtest/scm/ScmMediumIT.java} | 2 +- .../mediumtest/symbol/SymbolMediumIT.java} | 4 +- .../mediumtest/tasks/TasksMediumIT.java} | 2 +- .../tests/GenericTestExecutionMediumIT.java} | 2 +- .../org/sonar/scm/svn/SvnBlameCommandIT.java} | 4 +- .../java/org/sonar/scm/svn/SvnTester.java | 6 -- .../java/org/sonar/scm/svn/SvnTesterIT.java} | 2 +- .../test-repos/1.6/repo-svn-with-merge.zip | Bin .../sonar/scm/svn/test-repos/1.6/repo-svn.zip | Bin .../test-repos/1.7/repo-svn-with-merge.zip | Bin .../sonar/scm/svn/test-repos/1.7/repo-svn.zip | Bin .../test-repos/1.8/repo-svn-with-merge.zip | Bin .../sonar/scm/svn/test-repos/1.8/repo-svn.zip | Bin .../test-repos/1.9/repo-svn-with-merge.zip | Bin .../sonar/scm/svn/test-repos/1.9/repo-svn.zip | Bin .../scanner/cache/WriteCacheImplTest.java | 6 +- .../scanner/mediumtest/LogOutputRecorder.java | 59 ------------------ ...vaArchitectureInformationProviderTest.java | 4 +- .../DefaultQualityProfileLoaderTest.java | 2 - .../SingleProjectRepositoryTest.java | 2 - .../filesystem/LanguageDetectionTest.java | 1 - .../sensor/ModuleSensorContextTest.java | 41 ++++++------ .../org/sonar/scm/svn/SvnScmSupportTest.java | 8 ++- 43 files changed, 68 insertions(+), 137 deletions(-) rename sonar-scanner-engine/src/{test => it}/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java => it/java/org/sonar/scanner/mediumtest/branch/BranchMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java => it/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java => it/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java => it/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java => it/java/org/sonar/scanner/mediumtest/cpd/CpdMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java => it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java => it/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumIT.java} (97%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java => it/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java => it/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java => it/java/org/sonar/scanner/mediumtest/issues/ChecksMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumTest.java => it/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java => it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java => it/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java => it/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java => it/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java => it/java/org/sonar/scanner/mediumtest/issues/PreviewMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumTest.java => it/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java => it/java/org/sonar/scanner/mediumtest/log/LogListenerIT.java} (97%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java => it/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java => it/java/org/sonar/scanner/mediumtest/scm/ScmMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java => it/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumIT.java} (99%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java => it/java/org/sonar/scanner/mediumtest/tasks/TasksMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java => it/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumIT.java} (98%) rename sonar-scanner-engine/src/{test/java/org/sonar/scm/svn/SvnBlameCommandTest.java => it/java/org/sonar/scm/svn/SvnBlameCommandIT.java} (99%) rename sonar-scanner-engine/src/{test => it}/java/org/sonar/scm/svn/SvnTester.java (92%) rename sonar-scanner-engine/src/{test/java/org/sonar/scm/svn/SvnTesterTest.java => it/java/org/sonar/scm/svn/SvnTesterIT.java} (98%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn-with-merge.zip (100%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn.zip (100%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn-with-merge.zip (100%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn.zip (100%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn-with-merge.zip (100%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn.zip (100%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn-with-merge.zip (100%) rename sonar-scanner-engine/src/{test => it}/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn.zip (100%) delete mode 100644 sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java index 26d02e97523..a7a181a6f43 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java @@ -334,7 +334,7 @@ public class ScannerMediumTester extends ExternalResource { @Priority(1) private static class FakeRulesLoader implements RulesLoader { - private List rules = new LinkedList<>(); + private List rules = new LinkedList<>(); public FakeRulesLoader addRule(Rule rule) { rules.add(rule); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/branch/BranchMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/branch/BranchMediumIT.java index 1ec51e03d03..02f68d9e74b 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/branch/BranchMediumIT.java @@ -20,14 +20,12 @@ package org.sonar.scanner.mediumtest.branch; import com.google.common.collect.ImmutableMap; - import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; - import org.apache.commons.io.FileUtils; import org.junit.Before; import org.junit.Rule; @@ -49,7 +47,7 @@ import org.sonarqube.ws.NewCodePeriods; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -public class BranchMediumTest { +public class BranchMediumIT { private static final String PROJECT_KEY = "sample"; private static final String FILE_PATH = "HelloJava.xoo"; @@ -108,7 +106,7 @@ public class BranchMediumTest { } @Test - public void shouldSkipSensorForUnchangedFilesOnPr() throws Exception { + public void shouldSkipSensorForUnchangedFilesOnPr() { AnalysisResult result = getResult(tester .setBranchName("myBranch") .setBranchTarget("main") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumIT.java index 8dff5b1055d..a6453f2f12e 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/branch/DeprecatedBranchMediumIT.java @@ -35,7 +35,7 @@ import org.sonar.xoo.rule.XooRulesDefinition; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class DeprecatedBranchMediumTest { +public class DeprecatedBranchMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumIT.java index 145ec99b27f..08faf0f0f5e 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumIT.java @@ -38,7 +38,7 @@ import org.sonar.xoo.XooPlugin; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.AssertionsForClassTypes.tuple; -public class CoverageMediumTest { +public class CoverageMediumIT { @Rule public LogTester logTester = new LogTester(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumIT.java index 8a491458d95..1f16e7241d7 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumIT.java @@ -31,7 +31,7 @@ import org.sonar.xoo.XooPlugin; import static org.assertj.core.api.Assertions.assertThat; -public class GenericCoverageMediumTest { +public class GenericCoverageMediumIT { private final List logs = new ArrayList<>(); @Rule diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/cpd/CpdMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/cpd/CpdMediumIT.java index b507a80a51a..0975bb74a74 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/cpd/CpdMediumIT.java @@ -40,7 +40,7 @@ import org.sonar.xoo.rule.XooRulesDefinition; import static org.assertj.core.api.Assertions.assertThat; -public class CpdMediumTest { +public class CpdMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java index 4aa35bce859..9c1c55338b3 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumIT.java @@ -62,7 +62,7 @@ import static org.assertj.core.api.Assertions.tuple; import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeTrue; -public class FileSystemMediumTest { +public class FileSystemMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumIT.java similarity index 97% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumIT.java index f69b1f5f950..a32056a4cb7 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumIT.java @@ -30,7 +30,7 @@ import org.springframework.beans.factory.BeanCreationException; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class NoLanguagesPluginsMediumTest { +public class NoLanguagesPluginsMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumIT.java index cc0fd5d8f66..d7e75c25173 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumIT.java @@ -43,7 +43,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; -public class ProjectBuilderMediumTest { +public class ProjectBuilderMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumIT.java index 0d04f723a49..811c883099f 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumIT.java @@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.sonar.scanner.mediumtest.ScannerMediumTester.AnalysisBuilder; -public class HighlightingMediumTest { +public class HighlightingMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/ChecksMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/ChecksMediumIT.java index 35f9b601b7f..30db61751f4 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/ChecksMediumIT.java @@ -42,9 +42,9 @@ import static java.util.Collections.emptySet; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; -public class ChecksMediumTest { +public class ChecksMediumIT { - @org.junit.Rule + @Rule public TemporaryFolder temp = new TemporaryFolder(); @Rule diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumIT.java index 88e9c3f04c6..2f9d939f7d8 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/ExternalIssuesMediumIT.java @@ -28,8 +28,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.utils.log.LogTester; -import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.AnalysisResult; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.protocol.Constants.Severity; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.scanner.protocol.output.ScannerReport.ExternalIssue; @@ -41,7 +41,7 @@ import org.sonar.xoo.rule.OneExternalIssuePerLineSensor; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; -public class ExternalIssuesMediumTest { +public class ExternalIssuesMediumIT { @Rule public LogTester logs = new LogTester(); @Rule diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java index adf860cf17c..feaf921d141 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesMediumIT.java @@ -46,7 +46,7 @@ import static java.util.Collections.emptySet; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; -public class IssuesMediumTest { +public class IssuesMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumIT.java index 9f84a3849af..80553376649 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumIT.java @@ -26,14 +26,14 @@ import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.AnalysisResult; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; import static org.assertj.core.api.Assertions.assertThat; -public class IssuesOnDirMediumTest { +public class IssuesOnDirMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumIT.java index 4e18a60eea8..b83481d5729 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumIT.java @@ -26,14 +26,14 @@ import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.AnalysisResult; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; import static org.assertj.core.api.Assertions.assertThat; -public class IssuesOnModuleMediumTest { +public class IssuesOnModuleMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumIT.java index 3e2d06f3d47..5d69b83c7c8 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumIT.java @@ -38,7 +38,7 @@ import org.sonar.xoo.rule.XooRulesDefinition; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; -public class MultilineIssuesMediumTest { +public class MultilineIssuesMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/PreviewMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/PreviewMediumIT.java index 630233ab47d..6cd81792a93 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/PreviewMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/issues/PreviewMediumIT.java @@ -29,7 +29,7 @@ import org.sonar.scanner.mediumtest.ScannerMediumTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -public class PreviewMediumTest { +public class PreviewMediumIT { @Rule public LogTester logTester = new LogTester(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumIT.java index 011c7b5eec8..64c41253437 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/log/ExceptionHandlingMediumIT.java @@ -32,7 +32,7 @@ import org.springframework.beans.factory.UnsatisfiedDependencyException; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class ExceptionHandlingMediumTest { +public class ExceptionHandlingMediumIT { private Batch batch; private static ErrorGlobalSettingsLoader loader; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/log/LogListenerIT.java similarity index 97% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/log/LogListenerIT.java index e8f70996c1b..e2a63e2ac6c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/log/LogListenerIT.java @@ -45,7 +45,7 @@ import org.sonar.xoo.XooPlugin; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -public class LogListenerTest { +public class LogListenerIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); @@ -119,7 +119,7 @@ public class LogListenerTest { return; } - for (LogOutput.Level l : LogOutput.Level.values()) { + for (Level l : Level.values()) { assertThat(msg).doesNotContain(l.toString()); } @@ -246,9 +246,9 @@ public class LogListenerTest { private static class LogEvent { String msg; - LogOutput.Level level; + Level level; - LogEvent(String msg, LogOutput.Level level) { + LogEvent(String msg, Level level) { this.msg = msg; this.level = level; } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumIT.java index ff9c684902e..c3f4fb1768e 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumIT.java @@ -32,8 +32,8 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.AnalysisResult; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.protocol.output.ScannerReport.Measure; import org.sonar.xoo.XooPlugin; @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; import static org.junit.Assert.fail; -public class MeasuresMediumTest { +public class MeasuresMediumIT { @Rule public LogTester logTester = new LogTester(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/scm/ScmMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/scm/ScmMediumIT.java index ec81163c4c6..04451bf92f0 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/scm/ScmMediumIT.java @@ -46,7 +46,7 @@ import org.sonar.xoo.rule.XooRulesDefinition; import static org.assertj.core.api.Assertions.assertThat; -public class ScmMediumTest { +public class ScmMediumIT { private static final String MISSING_BLAME_INFORMATION_FOR_THE_FOLLOWING_FILES = "Missing blame information for the following files:"; private static final String CHANGED_CONTENT_SCM_ON_SERVER_XOO = "src/changed_content_scm_on_server.xoo"; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumIT.java index dad68996e7c..f6f535ac1d7 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumIT.java @@ -27,14 +27,14 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; -import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.AnalysisResult; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.xoo.XooPlugin; import static org.assertj.core.api.Assertions.assertThat; -public class SymbolMediumTest { +public class SymbolMediumIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/tasks/TasksMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/tasks/TasksMediumIT.java index 436507beed1..776a11575bf 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/tasks/TasksMediumIT.java @@ -30,7 +30,7 @@ import org.sonar.scanner.mediumtest.ScannerMediumTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -public class TasksMediumTest { +public class TasksMediumIT { @Rule public LogTester logTester = new LogTester(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumIT.java index d57b51934f6..86962f74824 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumIT.java @@ -33,7 +33,7 @@ import org.sonar.xoo.XooPlugin; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; -public class GenericTestExecutionMediumTest { +public class GenericTestExecutionMediumIT { private final List logs = new ArrayList<>(); @Rule diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnBlameCommandTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnBlameCommandIT.java similarity index 99% rename from sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnBlameCommandTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnBlameCommandIT.java index 36835982249..dec6960b3cb 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnBlameCommandTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnBlameCommandIT.java @@ -80,7 +80,7 @@ import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(Parameterized.class) -public class SvnBlameCommandTest { +public class SvnBlameCommandIT { /* * Note about SONARSCSVN-11: The case of a project baseDir is in a subFolder of working copy is part of method tests by default @@ -104,7 +104,7 @@ public class SvnBlameCommandTest { return Arrays.asList(new Object[][] {{"1.6", 10}, {"1.7", 29}, {"1.8", 31}, {"1.9", 31}}); } - public SvnBlameCommandTest(String serverVersion, int wcVersion) { + public SvnBlameCommandIT(String serverVersion, int wcVersion) { this.serverVersion = serverVersion; this.wcVersion = wcVersion; } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnTester.java b/sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnTester.java similarity index 92% rename from sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnTester.java rename to sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnTester.java index 5b45ab231c7..c24f592c064 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnTester.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnTester.java @@ -64,12 +64,6 @@ public class SvnTester { copyClient.doCopy(new SVNCopySource[] {source}, localRepository.appendPath("branches/" + branchName, false), false, false, true, "Create branch", null); } - public void createBranch(String branchSource, String branchName) throws IOException, SVNException { - SVNCopyClient copyClient = manager.getCopyClient(); - SVNCopySource source = new SVNCopySource(SVNRevision.HEAD, SVNRevision.HEAD, localRepository.appendPath(branchSource, false)); - copyClient.doCopy(new SVNCopySource[] {source}, localRepository.appendPath("branches/" + branchName, false), false, false, true, "Create branch", null); - } - public void checkout(Path worktree, String path) throws SVNException { SVNUpdateClient updateClient = manager.getUpdateClient(); updateClient.doCheckout(localRepository.appendPath(path, false), diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnTesterTest.java b/sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnTesterIT.java similarity index 98% rename from sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnTesterTest.java rename to sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnTesterIT.java index e5c7ad7e427..a285a63cace 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnTesterTest.java +++ b/sonar-scanner-engine/src/it/java/org/sonar/scm/svn/SvnTesterIT.java @@ -29,7 +29,7 @@ import org.tmatesoft.svn.core.SVNException; import static org.assertj.core.api.Assertions.assertThat; -public class SvnTesterTest { +public class SvnTesterIT { @Rule public TemporaryFolder temp = new TemporaryFolder(); diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn-with-merge.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn-with-merge.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn-with-merge.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn-with-merge.zip diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.6/repo-svn.zip diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn-with-merge.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn-with-merge.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn-with-merge.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn-with-merge.zip diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.7/repo-svn.zip diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn-with-merge.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn-with-merge.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn-with-merge.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn-with-merge.zip diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.8/repo-svn.zip diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn-with-merge.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn-with-merge.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn-with-merge.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn-with-merge.zip diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn.zip b/sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn.zip similarity index 100% rename from sonar-scanner-engine/src/test/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn.zip rename to sonar-scanner-engine/src/it/resources/org/sonar/scm/svn/test-repos/1.9/repo-svn.zip diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/WriteCacheImplTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/WriteCacheImplTest.java index fe86282effe..5cce16465ac 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/WriteCacheImplTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cache/WriteCacheImplTest.java @@ -56,7 +56,7 @@ public class WriteCacheImplTest { } @Test - public void write_bytes_adds_entries() throws IOException { + public void write_bytes_adds_entries() { byte[] b1 = new byte[] {1, 2, 3}; byte[] b2 = new byte[] {3, 4}; writeCache.write("key", b1); @@ -66,7 +66,7 @@ public class WriteCacheImplTest { } @Test - public void dont_write_if_its_pull_request() throws IOException { + public void dont_write_if_its_pull_request() { byte[] b1 = new byte[] {1, 2, 3}; when(branchConfiguration.isPullRequest()).thenReturn(true); writeCache.write("key1", b1); @@ -75,7 +75,7 @@ public class WriteCacheImplTest { } @Test - public void write_inputStream_adds_entries() throws IOException { + public void write_inputStream_adds_entries() { byte[] b1 = new byte[] {1, 2, 3}; byte[] b2 = new byte[] {3, 4}; writeCache.write("key", new ByteArrayInputStream(b1)); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java deleted file mode 100644 index 41ad59d8c0d..00000000000 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/LogOutputRecorder.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program 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.scanner.mediumtest; - -import com.google.common.collect.LinkedHashMultimap; -import com.google.common.collect.Multimap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; -import org.sonar.batch.bootstrapper.LogOutput; - -public class LogOutputRecorder implements LogOutput { - private final Multimap recordedByLevel = LinkedHashMultimap.create(); - private final List recorded = new LinkedList<>(); - private final StringBuffer asString = new StringBuffer(); - - @Override - public synchronized void log(String formattedMessage, Level level) { - recordedByLevel.put(level.toString(), formattedMessage); - recorded.add(formattedMessage); - asString.append(formattedMessage).append("\n"); - } - - public synchronized Collection getAll() { - return new ArrayList<>(recorded); - } - - public synchronized String getAllAsString() { - return String.join("\n", recorded); - } - - public synchronized Collection get(String level) { - return new ArrayList<>(recordedByLevel.get(level)); - } - - public synchronized String getAsString() { - return asString.toString(); - } - -} diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/JavaArchitectureInformationProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/JavaArchitectureInformationProviderTest.java index c977c7eaa9f..46b33f5d076 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/JavaArchitectureInformationProviderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/JavaArchitectureInformationProviderTest.java @@ -25,10 +25,10 @@ import static org.assertj.core.api.Assertions.assertThat; public class JavaArchitectureInformationProviderTest { - private JavaArchitectureInformationProvider javaArchitectureInformationProvider = new JavaArchitectureInformationProvider(); + private final JavaArchitectureInformationProvider javaArchitectureInformationProvider = new JavaArchitectureInformationProvider(); @Test - public void is64bitJavaVersion_returnsTrue_whenRunningWith64bitJava() { + public void is64bitJavaVersion_whenRunningWith64bitJava_shouldReturnTrue() { assertThat(javaArchitectureInformationProvider.is64bitJavaVersion()).isTrue(); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java index eab74489508..48afa8d0108 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java @@ -27,7 +27,6 @@ import org.junit.Test; import org.sonar.api.utils.MessageException; import org.sonar.scanner.WsTestUtil; import org.sonar.scanner.bootstrap.DefaultScannerWsClient; -import org.sonar.scanner.scan.ScanProperties; import org.sonarqube.ws.Qualityprofiles; import org.sonarqube.ws.Qualityprofiles.SearchWsResponse.QualityProfile; import org.sonarqube.ws.client.HttpException; @@ -38,7 +37,6 @@ import static org.mockito.Mockito.mock; public class DefaultQualityProfileLoaderTest { private final DefaultScannerWsClient wsClient = mock(DefaultScannerWsClient.class); - private final ScanProperties properties = mock(ScanProperties.class); private final DefaultQualityProfileLoader underTest = new DefaultQualityProfileLoader(wsClient); @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java index 82485945112..2ea26c6cc68 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/SingleProjectRepositoryTest.java @@ -19,7 +19,6 @@ */ package org.sonar.scanner.repository; -import java.util.Date; import org.junit.Before; import org.junit.Test; @@ -33,7 +32,6 @@ public class SingleProjectRepositoryTest { @Before public void setUp() { - Date lastAnalysisDate = new Date(); repository = new SingleProjectRepository(singletonMap("/Abc.java", new FileData("123", "456"))); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java index 30692f55434..03f1547bab2 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/LanguageDetectionTest.java @@ -41,7 +41,6 @@ public class LanguageDetectionTest { @Rule public TemporaryFolder temp = new TemporaryFolder(); - private MapSettings settings; @Before diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorContextTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorContextTest.java index 86dc4e81b17..30db816f4f3 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorContextTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/sensor/ModuleSensorContextTest.java @@ -60,39 +60,40 @@ public class ModuleSensorContextTest { private final UnchangedFilesHandler unchangedFilesHandler = mock(UnchangedFilesHandler.class); private final SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.parse("5.5"), SonarQubeSide.SCANNER, SonarEdition.COMMUNITY); private DefaultFileSystem fs; - private ModuleSensorContext adaptor; + private ModuleSensorContext underTest; @Before public void prepare() throws Exception { fs = new DefaultFileSystem(temp.newFolder().toPath()); - adaptor = new ModuleSensorContext(mock(DefaultInputProject.class), mock(InputModule.class), settings.asConfig(), settings, fs, activeRules, sensorStorage, runtime, + underTest = new ModuleSensorContext(mock(DefaultInputProject.class), mock(InputModule.class), settings.asConfig(), settings, fs, activeRules, sensorStorage, runtime, branchConfiguration, writeCache, readCache, analysisCacheEnabled, unchangedFilesHandler); } @Test - public void shouldProvideComponents() { - assertThat(adaptor.activeRules()).isEqualTo(activeRules); - assertThat(adaptor.fileSystem()).isEqualTo(fs); - assertThat(adaptor.getSonarQubeVersion()).isEqualTo(Version.parse("5.5")); - assertThat(adaptor.runtime()).isEqualTo(runtime); - assertThat(adaptor.canSkipUnchangedFiles()).isFalse(); + public void shouldProvideComponents_returnsNotNull() { + assertThat(underTest.activeRules()).isEqualTo(activeRules); + assertThat(underTest.fileSystem()).isEqualTo(fs); + assertThat(underTest.getSonarQubeVersion()).isEqualTo(Version.parse("5.5")); + assertThat(underTest.runtime()).isEqualTo(runtime); + assertThat(underTest.canSkipUnchangedFiles()).isFalse(); - assertThat(adaptor.nextCache()).isEqualTo(writeCache); - assertThat(adaptor.previousCache()).isEqualTo(readCache); + assertThat(underTest.nextCache()).isEqualTo(writeCache); + assertThat(underTest.previousCache()).isEqualTo(readCache); - assertThat(adaptor.newIssue()).isNotNull(); - assertThat(adaptor.newExternalIssue()).isNotNull(); - assertThat(adaptor.newAdHocRule()).isNotNull(); - assertThat(adaptor.newMeasure()).isNotNull(); - assertThat(adaptor.newAnalysisError()).isEqualTo(ModuleSensorContext.NO_OP_NEW_ANALYSIS_ERROR); - assertThat(adaptor.isCancelled()).isFalse(); - assertThat(adaptor.newSignificantCode()).isNotNull(); + assertThat(underTest.newIssue()).isNotNull(); + assertThat(underTest.newExternalIssue()).isNotNull(); + assertThat(underTest.newAdHocRule()).isNotNull(); + assertThat(underTest.newMeasure()).isNotNull(); + assertThat(underTest.newAnalysisError()).isEqualTo(ModuleSensorContext.NO_OP_NEW_ANALYSIS_ERROR); + assertThat(underTest.isCancelled()).isFalse(); + assertThat(underTest.newSignificantCode()).isNotNull(); } @Test public void should_delegate_to_unchanged_files_handler() { DefaultInputFile defaultInputFile = mock(DefaultInputFile.class); - adaptor.markAsUnchanged(defaultInputFile); + + underTest.markAsUnchanged(defaultInputFile); verify(unchangedFilesHandler).markAsUnchanged(defaultInputFile); } @@ -100,9 +101,9 @@ public class ModuleSensorContextTest { @Test public void pull_request_can_skip_unchanged_files() { when(branchConfiguration.isPullRequest()).thenReturn(true); - adaptor = new ModuleSensorContext(mock(DefaultInputProject.class), mock(InputModule.class), settings.asConfig(), settings, fs, activeRules, sensorStorage, runtime, + underTest = new ModuleSensorContext(mock(DefaultInputProject.class), mock(InputModule.class), settings.asConfig(), settings, fs, activeRules, sensorStorage, runtime, branchConfiguration, writeCache, readCache, analysisCacheEnabled, unchangedFilesHandler); - assertThat(adaptor.canSkipUnchangedFiles()).isTrue(); + assertThat(underTest.canSkipUnchangedFiles()).isTrue(); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnScmSupportTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnScmSupportTest.java index 38a51496f97..101c01f5427 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnScmSupportTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scm/svn/SvnScmSupportTest.java @@ -30,21 +30,23 @@ public class SvnScmSupportTest { private SvnConfiguration config = mock(SvnConfiguration.class); @Test - public void getExtensions() { + public void getObjects_shouldNotBeEmpty() { assertThat(SvnScmSupport.getObjects()).isNotEmpty(); } @Test - public void newSvnClientManager_with_auth() { + public void newSvnClientManager_whenPasswordConfigured_shouldNotReturnNull() { when(config.password()).thenReturn("password"); when(config.passPhrase()).thenReturn("passPhrase"); + assertThat(newSvnClientManager(config)).isNotNull(); } @Test - public void newSvnClientManager_without_auth() { + public void newSvnClientManager_whenPasswordNotConfigured_shouldNotReturnNull() { assertThat(config.password()).isNull(); assertThat(config.passPhrase()).isNull(); + assertThat(newSvnClientManager(config)).isNotNull(); } -- 2.39.5