From e63c0019f9b905232433d5d8dac330899d59760b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 4 Jul 2016 13:49:28 +0200 Subject: [PATCH] Fix deprecated calls to SonarRunner in tests --- .../src/test/java/it/analysis/BatchTest.java | 18 +++++----- .../java/it/analysis/IssueJsonReportTest.java | 24 +++++++------- .../test/java/it/analysis/IssuesModeTest.java | 33 +++++++++---------- .../src/test/java/it/analysis/LinksTest.java | 4 +-- .../java/it/analysis/MultiLanguageTest.java | 4 +-- .../it/analysis/ProjectProvisioningTest.java | 6 ++-- .../test/java/it/analysis/ReportDumpTest.java | 4 +-- .../it/analysis/SettingsEncryptionTest.java | 8 ++--- .../test/java/it/analysis/TempFolderTest.java | 10 +++--- .../analysisExclusion/FileExclusionsTest.java | 4 +-- .../IssueExclusionsTest.java | 4 +-- .../it/authorisation/IssuePermissionTest.java | 6 ++-- .../authorisation/PermissionSearchTest.java | 4 +-- it/it-tests/src/test/java/it/ce/CeWsTest.java | 4 +-- .../java/it/component/ComponentsWsTest.java | 4 +-- .../java/it/component/ProjectSearchTest.java | 12 +++---- .../it/componentSearch/AllProjectsTest.java | 4 +-- .../it/customMeasure/CustomMeasuresTest.java | 4 +-- .../CrossModuleDuplicationsTest.java | 8 ++--- .../src/test/java/it/i18n/I18nTest.java | 4 +-- .../java/it/issue/NewIssuesMeasureTest.java | 20 +++++------ .../test/java/it/measure/MeasuresWsTest.java | 4 +-- .../java/it/measure/ProjectOverviewTest.java | 4 +-- .../java/it/measure/ProjectWidgetsTest.java | 4 +-- .../it/measureFilter/MeasureFiltersTest.java | 4 +-- .../java/it/measureHistory/HistoryUiTest.java | 4 +-- .../SincePreviousVersionHistoryTest.java | 4 +-- .../it/measureHistory/TimeMachineTest.java | 4 +-- .../BackgroundTasksTest.java | 4 +-- .../BulkDeletionTest.java | 4 +-- .../ProjectPermissionsTest.java | 4 +-- .../ProjectComparisonTest.java | 4 +-- .../QualityGateNotificationTest.java | 4 +-- .../it/qualityGate/QualityGateUiTest.java | 4 +-- .../MaintainabilityRatingMeasureTest.java | 20 +++++------ .../TechnicalDebtInIssueChangelogTest.java | 10 +++--- .../it/qualityModel/TechnicalDebtTest.java | 8 ++--- .../qualityModel/TechnicalDebtWidgetTest.java | 4 +-- .../it/serverSystem/ServerSystemTest.java | 4 +-- .../SettingsTestRestartingOrchestrator.java | 6 ++-- .../java/it/settings/SubCategoriesTest.java | 4 +-- .../src/test/java/it/test/CoverageTest.java | 18 +++++----- .../java/it/test/CoverageTrackingTest.java | 4 +-- .../test/java/it/test/NewCoverageTest.java | 6 ++-- .../test/java/it/test/TestExecutionTest.java | 4 +-- .../src/test/java/it/user/FavouriteTest.java | 4 +-- .../java/it/user/LocalAuthenticationTest.java | 6 ++-- 47 files changed, 169 insertions(+), 170 deletions(-) diff --git a/it/it-tests/src/test/java/it/analysis/BatchTest.java b/it/it-tests/src/test/java/it/analysis/BatchTest.java index 57d5084f8a9..006fdca305b 100644 --- a/it/it-tests/src/test/java/it/analysis/BatchTest.java +++ b/it/it-tests/src/test/java/it/analysis/BatchTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category3Suite; import java.io.File; @@ -199,7 +199,7 @@ public class BatchTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", + SonarScanner runner = configureScanner("shared/xoo-sample", "sonar.verbose", "true"); runner.setEnvironmentVariable("SONAR_USER_HOME", "/dev/null"); BuildResult buildResult = orchestrator.executeBuildQuietly(runner); @@ -443,7 +443,7 @@ public class BatchTest { long before = new Date().getTime() - 2000l; orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(ItUtils.projectDir("shared/xoo-sample"))); long after = new Date().getTime() + 2000l; Resource xooSample = orchestrator.getServer().getWsClient().find(new ResourceQuery().setResourceKeyOrId("sample")); assertThat(xooSample.getCreationDate().getTime()).isGreaterThan(before).isLessThan(after); @@ -457,7 +457,7 @@ public class BatchTest { public void fail_if_project_date_is_older_than_latest_snapshot() { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner analysis = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")); + SonarScanner analysis = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")); analysis.setProperty("sonar.projectDate", "2014-01-01"); orchestrator.executeBuild(analysis); @@ -475,19 +475,19 @@ public class BatchTest { } private BuildResult scan(String projectPath, String... props) { - SonarRunner runner = configureRunner(projectPath, props); + SonarScanner runner = configureScanner(projectPath, props); return orchestrator.executeBuild(runner); } private BuildResult scanQuietly(String projectPath, String... props) { - SonarRunner runner = configureRunner(projectPath, props); + SonarScanner runner = configureScanner(projectPath, props); return orchestrator.executeBuildQuietly(runner); } - private SonarRunner configureRunner(String projectPath, String... props) { - SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectPath)) + private SonarScanner configureScanner(String projectPath, String... props) { + SonarScanner scanner = SonarScanner.create(ItUtils.projectDir(projectPath)) .setProperties(props); - return runner; + return scanner; } } diff --git a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java index fe0f657ac3b..cca24d3ab0e 100644 --- a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java +++ b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.locator.ResourceLocation; import it.Category3Suite; @@ -67,7 +67,7 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); File projectDir = ItUtils.projectDir("shared/xoo-sample"); - SonarRunner runner = SonarRunner.create(projectDir, + SonarScanner runner = SonarScanner.create(projectDir, "sonar.analysis.mode", "issues", "sonar.verbose", "true", "sonar.report.export.path", "sonar-report.json"); @@ -101,7 +101,7 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("sample-multiline", "xoo", "multiline"); File projectDir = ItUtils.projectDir("shared/xoo-precise-issues"); - SonarRunner runner = SonarRunner.create(projectDir, + SonarScanner runner = SonarScanner.create(projectDir, "sonar.analysis.mode", "issues", "sonar.verbose", "true", "sonar.report.export.path", "sonar-report.json"); @@ -135,7 +135,7 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); File projectDir = ItUtils.projectDir("analysis/tracking/v1"); - SonarRunner issuesModeScan = SonarRunner.create(projectDir) + SonarScanner issuesModeScan = SonarScanner.create(projectDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") @@ -156,13 +156,13 @@ public class IssueJsonReportTest { orchestrator.getServer().provisionProject("sample", "tracking"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner scan = SonarRunner.create(ItUtils.projectDir("analysis/tracking/v1")) + SonarScanner scan = SonarScanner.create(ItUtils.projectDir("analysis/tracking/v1")) .setProperty("sonar.projectDate", "2013-05-01"); orchestrator.executeBuild(scan); // Issues mode scan -> 2 new issues and 13 existing issues File projectDir = ItUtils.projectDir("analysis/tracking/v2"); - SonarRunner issuesModeScan = SonarRunner.create(projectDir) + SonarScanner issuesModeScan = SonarScanner.create(projectDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") @@ -183,14 +183,14 @@ public class IssueJsonReportTest { orchestrator.getServer().provisionProject("sample:mybranch", "Sample"); orchestrator.getServer().associateProjectToQualityProfile("sample:mybranch", "xoo", "one-issue-per-line"); - SonarRunner scan = SonarRunner.create(ItUtils.projectDir("analysis/tracking/v1")) + SonarScanner scan = SonarScanner.create(ItUtils.projectDir("analysis/tracking/v1")) .setProperty("sonar.projectDate", "2013-05-01") .setProperty("sonar.branch", "mybranch"); orchestrator.executeBuild(scan); // issues mode scan -> 2 new issues and 13 existing issues File projectDir = ItUtils.projectDir("analysis/tracking/v2"); - SonarRunner issuesModeScan = SonarRunner.create(projectDir) + SonarScanner issuesModeScan = SonarScanner.create(projectDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") @@ -218,13 +218,13 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line"); File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample"); - SonarRunner scan = SonarRunner.create(rootDir) + SonarScanner scan = SonarScanner.create(rootDir) .setProperty("sonar.projectDate", "2013-05-01"); orchestrator.executeBuild(scan); // Issues mode scan on a module -> no new issues File moduleDir = ItUtils.projectDir("shared/xoo-multi-modules-sample/module_a/module_a1"); - SonarRunner issuesModeScan = SonarRunner.create(moduleDir) + SonarScanner issuesModeScan = SonarScanner.create(moduleDir) .setProperty("sonar.projectKey", "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1") .setProperty("sonar.projectVersion", "1.0-SNAPSHOT") .setProperty("sonar.projectName", "ModuleA1") @@ -255,12 +255,12 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line"); File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample"); - SonarRunner scan = SonarRunner.create(rootDir) + SonarScanner scan = SonarScanner.create(rootDir) .setProperty("sonar.projectDate", "2013-05-01"); orchestrator.executeBuild(scan); // issues mode scan -> no new issues - SonarRunner issuesModeScan = SonarRunner.create(rootDir) + SonarScanner issuesModeScan = SonarScanner.create(rootDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") diff --git a/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java b/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java index 5817eed3030..8b1e7bd799b 100644 --- a/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java +++ b/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.Maps; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildFailureException; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.build.SonarScannerInstaller; import com.sonar.orchestrator.config.FileSystem; @@ -86,7 +85,7 @@ public class IssuesModeTest { restoreProfile("one-issue-per-line.xml"); orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunnerIssues("shared/xoo-sample", null, "sonar.verbose", "true"); + SonarScanner runner = configureRunnerIssues("shared/xoo-sample", null, "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17); } @@ -96,7 +95,7 @@ public class IssuesModeTest { restoreProfile("one-issue-per-line.xml"); orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); runner.setProperty("sonar.analysis.mode", "incremental"); thrown.expect(BuildFailureException.class); @@ -110,7 +109,7 @@ public class IssuesModeTest { restoreProfile("one-issue-per-line.xml"); setDefaultQualityProfile("xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); runner.setProjectKey("sample/project"); runner.setProperty("sonar.analysis.mode", "issues"); BuildResult result = orchestrator.executeBuild(runner); @@ -124,7 +123,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); List serverIssues = ItUtils.getAllServerIssues(orchestrator); for (Issue i : serverIssues) { @@ -152,7 +151,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); List serverIssues = ItUtils.getAllServerIssues(orchestrator); for (Issue i : serverIssues) { @@ -181,7 +180,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); // change QP @@ -195,7 +194,7 @@ public class IssuesModeTest { FileUtils.write(srcFile, "\n", StandardCharsets.UTF_8, true); // scan again, with different QP - runner = SonarRunner.create(tmpProjectDir, + runner = SonarScanner.create(tmpProjectDir, "sonar.working.directory", temp.newFolder().getAbsolutePath(), "sonar.analysis.mode", "issues", "sonar.report.export.path", "sonar-report.json", @@ -215,7 +214,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample-with-spaces"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules"); - SonarRunner runner = configureRunner("analysis/xoo-sample-with-spaces/v2"); + SonarScanner runner = configureRunner("analysis/xoo-sample-with-spaces/v2"); BuildResult result = orchestrator.executeBuild(runner); assertThat(getResource("sample:my sources/main/xoo/sample/My Sample.xoo")).isNotNull(); @@ -235,7 +234,7 @@ public class IssuesModeTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules"); // First real scan with source - SonarRunner runner = configureRunner("shared/xoo-history-v2"); + SonarScanner runner = configureRunner("shared/xoo-history-v2"); BuildResult result = orchestrator.executeBuild(runner); assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNotNull(); @@ -256,7 +255,7 @@ public class IssuesModeTest { @Test public void should_fail_if_plugin_access_secured_properties() throws IOException { // Test access from task (ie BatchSettings) - SonarRunner runner = configureRunnerIssues("shared/xoo-sample", null, + SonarScanner runner = configureRunnerIssues("shared/xoo-sample", null, "accessSecuredFromTask", "true"); BuildResult result = orchestrator.executeBuildQuietly(runner); @@ -278,7 +277,7 @@ public class IssuesModeTest { File homeDir = runFirstAnalysisAndFlagIssueAsWontFix(); // Second issues mode using same cache dir but cache disabled by default - SonarRunner runner = configureRunnerIssues("shared/xoo-sample", homeDir); + SonarScanner runner = configureRunnerIssues("shared/xoo-sample", homeDir); BuildResult result = orchestrator.executeBuild(runner); // False positive is not returned @@ -291,7 +290,7 @@ public class IssuesModeTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); // First run (publish mode) - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); orchestrator.executeBuild(runner); // First issues mode @@ -317,7 +316,7 @@ public class IssuesModeTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); // First run (publish mode) - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); orchestrator.executeBuild(runner); SonarClient client = orchestrator.getServer().adminWsClient(); @@ -367,7 +366,7 @@ public class IssuesModeTest { // use same working dir, because lock file is in it String workDirPath = temp.newFolder().getAbsolutePath(); - SonarRunner runner = configureRunner("shared/xoo-sample", + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.working.directory", workDirPath); orchestrator.executeBuild(runner); @@ -436,8 +435,8 @@ public class IssuesModeTest { return scanner; } - private SonarRunner configureRunner(String projectDir, String... props) throws IOException { - SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectDir), + private SonarScanner configureRunner(String projectDir, String... props) throws IOException { + SonarScanner runner = SonarScanner.create(ItUtils.projectDir(projectDir), "sonar.working.directory", temp.newFolder().getAbsolutePath(), "sonar.report.export.path", "sonar-report.json", "sonar.userHome", temp.newFolder().getAbsolutePath()); diff --git a/it/it-tests/src/test/java/it/analysis/LinksTest.java b/it/it-tests/src/test/java/it/analysis/LinksTest.java index 4a84614ae48..adcd89ce550 100644 --- a/it/it-tests/src/test/java/it/analysis/LinksTest.java +++ b/it/it-tests/src/test/java/it/analysis/LinksTest.java @@ -22,7 +22,7 @@ package it.analysis; import com.google.common.collect.Lists; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.MavenBuild; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.db.Database; import it.Category3Suite; import java.util.Collection; @@ -64,7 +64,7 @@ public class LinksTest { */ @Test public void shouldUseLinkProperties() { - SonarRunner runner = SonarRunner.create(ItUtils.projectDir("analysis/links-project")) + SonarScanner runner = SonarScanner.create(ItUtils.projectDir("analysis/links-project")) .setProperty("sonar.scm.disabled", "true"); orchestrator.executeBuild(runner); diff --git a/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java b/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java index 4d2f0d34836..9442fc8ab69 100644 --- a/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java +++ b/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category3Suite; import org.junit.After; @@ -57,7 +57,7 @@ public class MultiLanguageTest { orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample", "xoo", "one-issue-per-line"); orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample","xoo2", "one-issue-per-line-xoo2"); - SonarRunner build = SonarRunner.create().setProjectDir(ItUtils.projectDir("analysis/xoo-multi-languages")); + SonarScanner build = SonarScanner.create().setProjectDir(ItUtils.projectDir("analysis/xoo-multi-languages")); BuildResult result = orchestrator.executeBuild(build); assertThat(result.getLogs()).contains("2 files indexed"); diff --git a/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java b/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java index 8fd84acf842..21fdf4e9a60 100644 --- a/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java +++ b/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category3Suite; import org.junit.AfterClass; import org.junit.Before; @@ -46,7 +46,7 @@ public class ProjectProvisioningTest { public static void init() { orchestrator.resetData(); orchestrator.executeBuild( - SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) ); } @@ -154,7 +154,7 @@ public class ProjectProvisioningTest { private static BuildResult scan(String projectPath, String... propertiesKeyValues) { return orchestrator.executeBuildQuietly( - SonarRunner.create(ItUtils.projectDir(projectPath)).setProperties(propertiesKeyValues)); + SonarScanner.create(ItUtils.projectDir(projectPath)).setProperties(propertiesKeyValues)); } private static void setProperty(String key, String value) { diff --git a/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java b/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java index b12ed30ca54..1000dc18c88 100644 --- a/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java +++ b/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java @@ -20,7 +20,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.squareup.okhttp.HttpUrl; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.Request; @@ -50,7 +50,7 @@ public class ReportDumpTest { @Test public void dump_metadata_of_uploaded_report() throws Exception { File projectDir = ItUtils.projectDir("shared/xoo-sample"); - orchestrator.executeBuild(SonarRunner.create(projectDir, "sonar.projectKey", "dump_metadata_of_uploaded_report", "sonar.projectName", "dump_metadata_of_uploaded_report")); + orchestrator.executeBuild(SonarScanner.create(projectDir, "sonar.projectKey", "dump_metadata_of_uploaded_report", "sonar.projectName", "dump_metadata_of_uploaded_report")); File metadata = new File(projectDir, ".sonar/report-task.txt"); assertThat(metadata).exists().isFile(); diff --git a/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java b/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java index 48a594e5d89..f994212ec7e 100644 --- a/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java +++ b/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java @@ -22,7 +22,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildFailureException; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category3Suite; import java.io.File; import java.net.URL; @@ -46,7 +46,7 @@ public class SettingsEncryptionTest { */ @Test public void testEncryptedProperty() throws Exception { - SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + SonarScanner build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("sonar.secretKeyPath", pathToValidSecretKey()) .setProperty("sonar.login", "admin") // wrong password @@ -57,7 +57,7 @@ public class SettingsEncryptionTest { assertThat(result.getStatus()).isNotEqualTo(0); assertThat(result.getLogs()).contains("Fail to decrypt the property sonar.password. Please check your secret key"); - build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("sonar.secretKeyPath", pathToValidSecretKey()) // "admin" encrypted with the above secret key .setProperty("sonar.login", "{aes}evRHXHsEyPr5RjEuxUJcHA==") @@ -74,7 +74,7 @@ public class SettingsEncryptionTest { @Test(expected = BuildFailureException.class) public void failIfEncryptedPropertyButNoSecretKey() throws Exception { // path to secret key is missing - SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + SonarScanner build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY="); orchestrator.executeBuild(build); } diff --git a/it/it-tests/src/test/java/it/analysis/TempFolderTest.java b/it/it-tests/src/test/java/it/analysis/TempFolderTest.java index 8d58c1ff4e3..52289594b05 100644 --- a/it/it-tests/src/test/java/it/analysis/TempFolderTest.java +++ b/it/it-tests/src/test/java/it/analysis/TempFolderTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category3Suite; import java.io.File; @@ -83,7 +83,7 @@ public class TempFolderTest { File tmp = temp.newFolder(); assertThat(tmp.list()).isEmpty(); - SonarRunner runner = configureRunner() + SonarScanner runner = configureScanner() .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Djava.io.tmpdir=" + tmp.getAbsolutePath()); orchestrator.executeBuild(runner); @@ -96,12 +96,12 @@ public class TempFolderTest { } private BuildResult scan(String... props) { - SonarRunner runner = configureRunner(props); + SonarScanner runner = configureScanner(props); return orchestrator.executeBuild(runner); } - private SonarRunner configureRunner(String... props) { - return SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + private SonarScanner configureScanner(String... props) { + return SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperties(props); } diff --git a/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java b/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java index 8b77aa168a9..4612bad12a2 100644 --- a/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java +++ b/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java @@ -20,7 +20,7 @@ package it.analysisExclusion; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import java.util.List; import org.junit.Before; @@ -134,7 +134,7 @@ public class FileExclusionsTest { } private void scan(String... properties) { - SonarRunner build = SonarRunner + SonarScanner build = SonarScanner .create(ItUtils.projectDir("exclusions/exclusions")) .setProperties(properties); orchestrator.executeBuild(build); diff --git a/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java b/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java index 7cb51d18b6a..408ad2a2d18 100644 --- a/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java +++ b/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java @@ -21,7 +21,7 @@ package it.analysisExclusion; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category4Suite; import org.junit.Before; @@ -238,7 +238,7 @@ public class IssueExclusionsTest { "Sonar :: Integration Tests :: Multi-modules With Exclusions"); orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-exclusions", "xoo", "with-many-rules"); - SonarRunner scan = SonarRunner.create(ItUtils.projectDir(PROJECT_DIR)) + SonarScanner scan = SonarScanner.create(ItUtils.projectDir(PROJECT_DIR)) .setProperties("sonar.cpd.skip", "true") .setProperties(properties) .setProperties("sonar.verbose", "true"); diff --git a/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java b/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java index 2c1a857c594..87b1631a657 100644 --- a/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java +++ b/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java @@ -20,7 +20,7 @@ package it.authorisation; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category1Suite; import org.junit.Before; @@ -59,12 +59,12 @@ public class IssuePermissionTest { orchestrator.getServer().provisionProject("sample", "Sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); orchestrator.executeBuild(sampleProject); orchestrator.getServer().provisionProject("sample2", "Sample2"); orchestrator.getServer().associateProjectToQualityProfile("sample2", "xoo", "one-issue-per-line"); - SonarRunner sampleProject2 = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner sampleProject2 = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperty("sonar.projectKey", "sample2") .setProperty("sonar.projectName", "Sample2"); orchestrator.executeBuild(sampleProject2); diff --git a/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java b/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java index 0d7508a3ee1..bf9c454777b 100644 --- a/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java +++ b/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java @@ -20,7 +20,7 @@ package it.authorisation; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category1Suite; import org.junit.AfterClass; @@ -72,7 +72,7 @@ public class PermissionSearchTest { orchestrator.getServer().provisionProject(PROJECT_KEY, "Sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); orchestrator.executeBuild(sampleProject); adminWsClient = newAdminWsClient(orchestrator); diff --git a/it/it-tests/src/test/java/it/ce/CeWsTest.java b/it/it-tests/src/test/java/it/ce/CeWsTest.java index 98fd04a1a38..717d0f2b725 100644 --- a/it/it-tests/src/test/java/it/ce/CeWsTest.java +++ b/it/it-tests/src/test/java/it/ce/CeWsTest.java @@ -21,7 +21,7 @@ package it.ce; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import org.junit.Before; import org.junit.ClassRule; @@ -46,7 +46,7 @@ public class CeWsTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); wsClient = ItUtils.newAdminWsClient(orchestrator); } diff --git a/it/it-tests/src/test/java/it/component/ComponentsWsTest.java b/it/it-tests/src/test/java/it/component/ComponentsWsTest.java index a4cac2e039a..4f8593d2646 100644 --- a/it/it-tests/src/test/java/it/component/ComponentsWsTest.java +++ b/it/it-tests/src/test/java/it/component/ComponentsWsTest.java @@ -20,7 +20,7 @@ package it.component; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import org.junit.Before; import org.junit.ClassRule; @@ -44,7 +44,7 @@ public class ComponentsWsTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); wsClient = ItUtils.newAdminWsClient(orchestrator); } diff --git a/it/it-tests/src/test/java/it/component/ProjectSearchTest.java b/it/it-tests/src/test/java/it/component/ProjectSearchTest.java index 01827629ba1..204952655d0 100644 --- a/it/it-tests/src/test/java/it/component/ProjectSearchTest.java +++ b/it/it-tests/src/test/java/it/component/ProjectSearchTest.java @@ -19,11 +19,8 @@ */ package it.component; -import static org.assertj.core.api.Assertions.assertThat; -import static util.ItUtils.projectDir; - import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import java.io.IOException; import org.apache.commons.io.IOUtils; @@ -38,6 +35,9 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import util.QaOnly; +import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.projectDir; + @Category(QaOnly.class) public class ProjectSearchTest { @@ -47,7 +47,7 @@ public class ProjectSearchTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); } /** @@ -55,7 +55,7 @@ public class ProjectSearchTest { */ @Test public void projects_web_service() throws IOException { - SonarRunner build = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner build = SonarScanner.create(projectDir("shared/xoo-sample")); orchestrator.executeBuild(build); String url = orchestrator.getServer().getUrl() + "/api/projects/index?key=sample&versions=true"; diff --git a/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java b/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java index b9038e12626..0eed7d04647 100644 --- a/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java +++ b/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java @@ -20,7 +20,7 @@ package it.componentSearch; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import org.junit.BeforeClass; @@ -41,7 +41,7 @@ public class AllProjectsTest { @BeforeClass public static void inspectProject() { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey("all-project-test-project") .setProjectName("AllProjectsTest Project") ); diff --git a/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java b/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java index 275cf495ad9..907290ce25d 100644 --- a/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java +++ b/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java @@ -20,7 +20,7 @@ package it.customMeasure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category1Suite; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -88,7 +88,7 @@ public class CustomMeasuresTest { } private void analyzeProject() { - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); } private void setTeamSize(int i) { diff --git a/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java b/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java index c96b3333ca9..30ecf4ee641 100644 --- a/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java +++ b/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java @@ -21,7 +21,7 @@ package it.duplication; import com.google.common.collect.ImmutableMap; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category4Suite; import org.apache.commons.io.FileUtils; @@ -121,19 +121,19 @@ public class CrossModuleDuplicationsTest { verifyDuplicationMeasures(PROJECT_KEY + ":module2", 0, 0, 0, 0); } - private static SonarRunner analyzeProject(File projectDir, String projectKey, boolean create, String... additionalProperties) { + private static SonarScanner analyzeProject(File projectDir, String projectKey, boolean create, String... additionalProperties) { if (create) { orchestrator.getServer().provisionProject(projectKey, projectKey); orchestrator.getServer().associateProjectToQualityProfile(projectKey, "xoo", "xoo-duplication-profile"); } - SonarRunner sonarRunner = SonarRunner.create(projectDir); + SonarScanner sonarRunner = SonarScanner.create(projectDir); ImmutableMap.Builder builder = ImmutableMap.builder(); for (int i = 0; i < additionalProperties.length; i += 2) { builder.put(additionalProperties[i], additionalProperties[i + 1]); } - SonarRunner scan = sonarRunner.setDebugLogs(true).setProperties(builder.build()); + SonarScanner scan = sonarRunner.setDebugLogs(true).setProperties(builder.build()); orchestrator.executeBuild(scan); return scan; } diff --git a/it/it-tests/src/test/java/it/i18n/I18nTest.java b/it/it-tests/src/test/java/it/i18n/I18nTest.java index 793d78069dd..837968b443f 100644 --- a/it/it-tests/src/test/java/it/i18n/I18nTest.java +++ b/it/it-tests/src/test/java/it/i18n/I18nTest.java @@ -20,7 +20,7 @@ package it.i18n; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.Before; @@ -52,7 +52,7 @@ public class I18nTest { @Test @Ignore public void test_localization() { - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("ui-i18n", "/i18n/default-locale-is-english.html", diff --git a/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java b/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java index 6798fd27f42..39c4985a940 100644 --- a/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java +++ b/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java @@ -19,7 +19,7 @@ */ package it.issue; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import java.util.List; import org.junit.AfterClass; @@ -64,12 +64,12 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { // Execute an analysis in the past with no issue to have a past snapshot ORCHESTRATOR.getServer().associateProjectToQualityProfile("sample", "xoo", "empty"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")).setProperty("sonar.projectDate", "2013-01-01")); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperty("sonar.projectDate", "2013-01-01")); // Execute a analysis now with some issues ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/one-issue-per-line-profile.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line-profile"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty(); Resource newIssues = ORCHESTRATOR.getServer().getWsClient() @@ -79,7 +79,7 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { assertThat(measures.get(0).getVariation2().intValue()).isEqualTo(17); // second analysis, with exactly the same profile -> no new issues - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty(); newIssues = ORCHESTRATOR.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_violations").setIncludeTrends(true)); @@ -93,10 +93,10 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/one-issue-per-line-profile.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line-profile"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) // Analyse a project in the past, with a date older than 30 last days (second period) .setProperty("sonar.projectDate", "2013-01-01")); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // new issues measures should be to 0 on project on 2 periods as new issues has been created Resource file = ORCHESTRATOR.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample", "new_violations").setIncludeTrends(true)); @@ -117,10 +117,10 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { // Execute an analysis in the past to have a past snapshot // version 1 - ORCHESTRATOR.executeBuilds(SonarRunner.create(projectDir("shared/xoo-history-v1"))); + ORCHESTRATOR.executeBuilds(SonarScanner.create(projectDir("shared/xoo-history-v1"))); // version 2 with 2 new violations and 3 more ncloc - ORCHESTRATOR.executeBuilds(SonarRunner.create(projectDir("shared/xoo-history-v2"))); + ORCHESTRATOR.executeBuilds(SonarScanner.create(projectDir("shared/xoo-history-v2"))); assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty(); Resource file = ORCHESTRATOR.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample", "new_violations", "violations", "ncloc").setIncludeTrends(true)); @@ -147,13 +147,13 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { // First analysis without module b ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/NewIssuesMeasureTest/profile1.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "profile1"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProperties("sonar.modules", "module_a")); // Second analysis with module b and with a new rule activated to have new issues on module a since last analysis ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/NewIssuesMeasureTest/profile2.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "profile2"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); Resource project = ORCHESTRATOR.getServer().getWsClient() .find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:multi-modules-sample", "new_violations", "violations").setIncludeTrends(true)); diff --git a/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java b/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java index 42f513aa795..038dd0294cd 100644 --- a/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java +++ b/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java @@ -20,7 +20,7 @@ package it.measure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category1Suite; import java.util.List; import org.junit.AfterClass; @@ -63,7 +63,7 @@ public class MeasuresWsTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); wsClient = ItUtils.newAdminWsClient(orchestrator); } diff --git a/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java b/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java index c585f6afbfb..cdcf92f1e1c 100644 --- a/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java +++ b/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java @@ -20,7 +20,7 @@ package it.measure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.Before; @@ -59,7 +59,7 @@ public class ProjectOverviewTest { private void executeBuild(String projectLocation, String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir(projectLocation)) + SonarScanner.create(projectDir(projectLocation)) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java b/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java index c6fa73a8255..25406fc47ea 100644 --- a/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java +++ b/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java @@ -20,7 +20,7 @@ package it.measure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.BeforeClass; @@ -43,7 +43,7 @@ public class ProjectWidgetsTest { @BeforeClass public static void inspectProject() { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey("project-widgets-test-project") .setProjectName("ProjectWidgetsTest Project") ); diff --git a/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java b/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java index 2cb3c19215a..014b6dbd6a4 100644 --- a/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java +++ b/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java @@ -20,7 +20,7 @@ package it.measureFilter; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.AfterClass; @@ -48,7 +48,7 @@ public class MeasureFiltersTest { @BeforeClass public static void scanStruts() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); adminWsClient = newAdminWsClient(orchestrator); createUser("user-measure-filters", "User Measure Filters"); diff --git a/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java b/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java index 747e91f94a8..066028fc82b 100644 --- a/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java @@ -20,7 +20,7 @@ package it.measureHistory; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; @@ -50,7 +50,7 @@ public class HistoryUiTest { } private static void analyzeProject(String path, String date) { - orchestrator.executeBuild(SonarRunner.create(projectDir(path)) + orchestrator.executeBuild(SonarScanner.create(projectDir(path)) .setProperties("sonar.projectDate", date)); } diff --git a/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java b/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java index 05fa389d17e..5f504a1fcaf 100644 --- a/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java @@ -20,7 +20,7 @@ package it.measureHistory; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category1Suite; import java.text.SimpleDateFormat; import java.util.Date; @@ -74,7 +74,7 @@ public class SincePreviousVersionHistoryTest { } private static void analyzeProject(String version, @Nullable String exclusions, @Nullable String date) { - SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + SonarScanner build = SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProperties("sonar.projectVersion", version); if (exclusions != null) { build.setProperties("sonar.exclusions", exclusions); diff --git a/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java b/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java index 9c3585c369c..f2d803ebdcd 100644 --- a/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java @@ -21,7 +21,7 @@ package it.measureHistory; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category1Suite; import java.util.Date; @@ -73,7 +73,7 @@ public class TimeMachineTest { } private static BuildResult analyzeProject(String path, String date) { - return orchestrator.executeBuild(SonarRunner.create(projectDir(path), "sonar.projectDate", date)); + return orchestrator.executeBuild(SonarScanner.create(projectDir(path), "sonar.projectDate", date)); } @Test diff --git a/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java b/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java index 4a09fc455b1..9e895ff444a 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java @@ -20,7 +20,7 @@ package it.projectAdministration; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -47,7 +47,7 @@ public class BackgroundTasksTest { private void executeBuild(String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java b/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java index c23d74f5882..cbc06eccdfa 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java @@ -20,7 +20,7 @@ package it.projectAdministration; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.Before; @@ -61,7 +61,7 @@ public class BulkDeletionTest { private void executeBuild(String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java b/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java index fc6fecc4470..accb2962162 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java @@ -20,7 +20,7 @@ package it.projectAdministration; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -50,7 +50,7 @@ public class ProjectPermissionsTest { private void executeBuild(String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java b/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java index 4a459dcd071..ac0987a94d4 100644 --- a/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java +++ b/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java @@ -20,7 +20,7 @@ package it.projectComparison; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import org.junit.BeforeClass; @@ -42,7 +42,7 @@ public class ProjectComparisonTest { @BeforeClass public static void inspectProject() { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey("project-comparison-test-project") .setProjectName("ProjectComparisonTest Project") ); diff --git a/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java b/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java index 55a4b0551fb..e8e91e7e9ad 100644 --- a/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java +++ b/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java @@ -20,7 +20,7 @@ package it.qualityGate; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import java.util.Iterator; @@ -102,7 +102,7 @@ public class QualityGateNotificationTest { qgClient().setDefault(simple.id()); qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").period(1).operator("EQ").warningThreshold("0")); - SonarRunner analysis = SonarRunner.create(projectDir("qualitygate/xoo-sample")); + SonarScanner analysis = SonarScanner.create(projectDir("qualitygate/xoo-sample")); orchestrator.executeBuild(analysis); assertThat(fetchGateStatus().getData()).isEqualTo("OK"); diff --git a/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java b/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java index d81c6d2ee3c..8bf30e4e9e3 100644 --- a/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java +++ b/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java @@ -20,7 +20,7 @@ package it.qualityGate; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import javax.annotation.Nullable; @@ -137,7 +137,7 @@ public class QualityGateUiTest { } private void scanSample(@Nullable String date, @Nullable String profile) { - SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperties("sonar.cpd.skip", "true"); if (date != null) { scan.setProperty("sonar.projectDate", date); diff --git a/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java b/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java index 89e861b1941..aed422800cc 100644 --- a/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category2Suite; import javax.annotation.CheckForNull; @@ -66,7 +66,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "with-many-rules"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); assertThat(getMeasure(PROJECT, "sqale_rating").getIntValue()).isEqualTo(3); assertThat(getMeasure(PROJECT, "sqale_rating").getData()).isEqualTo("C"); @@ -90,7 +90,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "with-many-rules"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); assertThat(getMeasure(PROJECT, "sqale_debt_ratio").getValue()).isEqualTo(29.1d); assertThat(getMeasure(MODULE, "sqale_debt_ratio").getValue()).isEqualTo(28.5d); @@ -105,14 +105,14 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject("sample", "sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Measure rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(1); assertThat(rating.getData()).isEqualTo("A"); debtConfiguration.updateDevelopmentCost(2); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(4); @@ -125,7 +125,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); Measure rating = getMeasure(PROJECT, "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(1); @@ -133,7 +133,7 @@ public class MaintainabilityRatingMeasureTest { debtConfiguration.updateLanguageDevelopmentCost("xoo", 1); orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProfile("one-issue-per-line")); rating = getMeasure(PROJECT, "sqale_rating"); @@ -147,14 +147,14 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject("sample", "sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Measure rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(1); assertThat(rating.getData()).isEqualTo("A"); debtConfiguration.updateRatingGrid(0.001d, 0.005d, 0.01d, 0.015d); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(5); @@ -167,7 +167,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "with-many-rules"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); assertThat(getMeasure(PROJECT, "sqale_rating").getData()).isEqualTo("C"); assertThat(getMeasure(PROJECT, "effort_to_reach_maintainability_rating_a").getIntValue()).isEqualTo(292); diff --git a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java index a1584523c31..ef92d86270f 100644 --- a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category2Suite; import java.util.List; @@ -66,10 +66,10 @@ public class TechnicalDebtInIssueChangelogTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-file"); // Execute a first analysis to have a past snapshot - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // Second analysis, existing issues on OneIssuePerFile will have their technical debt updated with the effort to fix - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) .setProperties("sonar.oneIssuePerFile.effortToFix", "10")); IssueClient issueClient = orchestrator.getServer().wsClient().issueClient(); @@ -93,12 +93,12 @@ public class TechnicalDebtInIssueChangelogTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-file"); // Execute a first analysis to have a past snapshot - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // One day -> 10 hours debtConfiguration.updateHoursInDay(10); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) // As OneIssuePerFile has a debt of 10 minutes, we multiply it by 72 to have 1 day and 2 hours of technical debtn .setProperties("sonar.oneIssuePerFile.effortToFix", "72") ); diff --git a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java index 0acb73e58b2..f4ba792a436 100644 --- a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category2Suite; import java.util.List; @@ -61,7 +61,7 @@ public class TechnicalDebtTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); // Generate some issues - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // All the issues should have a technical debt List issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list(); @@ -80,7 +80,7 @@ public class TechnicalDebtTest { // One day -> 10 hours debtConfiguration.updateHoursInDay(10); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) // As OneIssuePerFile has a debt of 10 minutes, we multiply it by 72 to have 1 day and 2 hours of technical debt .setProperties("sonar.oneIssuePerFile.effortToFix", "72") ); @@ -100,7 +100,7 @@ public class TechnicalDebtTest { // One day -> 10 hours : debt will be stored as 360.000 seconds (1 day * 10 hours per day * 60 * 60) debtConfiguration.updateHoursInDay(10); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // Issue debt was 1 day during analysis but will be displayed as 1 day and 2 hours (hours in day property was set // to 10 during analysis but is now 8) diff --git a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java index 7350325bff8..00dc2354bf2 100644 --- a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.selenium.Selenese; import it.Category2Suite; @@ -64,7 +64,7 @@ public class TechnicalDebtWidgetTest { } private static void scanProject(String date, String excludes) { - SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProperties("sonar.projectDate", date, "sonar.exclusions", excludes); orchestrator.executeBuild(scan); } diff --git a/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java b/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java index 8981379e179..24fd65151a6 100644 --- a/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java +++ b/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java @@ -20,7 +20,7 @@ package it.serverSystem; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import java.io.File; @@ -176,7 +176,7 @@ public class ServerSystemTest { // TODO should be moved elsewhere @Test public void not_fail_with_url_ending_by_jsp() { - orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("sonar.projectKey", "myproject.jsp")); // Access dashboard Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("url_ending_by_jsp", diff --git a/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java b/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java index f0ebfe4816d..4472da3a92a 100644 --- a/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java +++ b/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java @@ -20,7 +20,7 @@ package it.settings; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import java.net.URL; import org.junit.After; @@ -97,9 +97,9 @@ public class SettingsTestRestartingOrchestrator { .build(); orchestrator.start(); - SonarRunner withDeprecatedKey = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner withDeprecatedKey = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperty("sonar.deprecatedKey", "true"); - SonarRunner withNewKey = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner withNewKey = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperty("sonar.newKey", "true"); // should not fail orchestrator.executeBuilds(withDeprecatedKey, withNewKey); diff --git a/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java b/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java index 3c87d7c97f2..73378604579 100644 --- a/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java +++ b/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java @@ -20,7 +20,7 @@ package it.settings; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -58,7 +58,7 @@ public class SubCategoriesTest { */ @Test public void should_support_project_subcategories() { - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories", "/settings/subcategories/project-subcategories.html", diff --git a/it/it-tests/src/test/java/it/test/CoverageTest.java b/it/it-tests/src/test/java/it/test/CoverageTest.java index a76ba175497..106cd9ffbce 100644 --- a/it/it-tests/src/test/java/it/test/CoverageTest.java +++ b/it/it-tests/src/test/java/it/test/CoverageTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import java.io.File; import org.apache.commons.io.FileUtils; @@ -56,7 +56,7 @@ public class CoverageTest { @Test public void unit_test_coverage() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-ut-coverage"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0); @@ -87,7 +87,7 @@ public class CoverageTest { @Test public void unit_test_coverage_no_condition() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0); @@ -112,7 +112,7 @@ public class CoverageTest { @Test public void it_coverage() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-it-coverage"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-it-coverage"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-it-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("coverage")).isNull(); @@ -136,7 +136,7 @@ public class CoverageTest { @Test public void ut_and_it_coverage() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-overall-coverage"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-overall-coverage"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-overall-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0); @@ -175,7 +175,7 @@ public class CoverageTest { */ @Test public void should_compute_coverage_on_project() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0); @@ -188,7 +188,7 @@ public class CoverageTest { */ @Test public void should_ignore_coverage_on_full_path() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered")) .setProperty("sonar.coverage.exclusions", "src/main/xoo/org/sonar/tests/halfcovered/UnCovered.xoo")); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); @@ -202,7 +202,7 @@ public class CoverageTest { */ @Test public void should_ignore_coverage_on_pattern() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered")) .setProperty("sonar.coverage.exclusions", "**/UnCovered*")); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); @@ -216,7 +216,7 @@ public class CoverageTest { */ @Test public void should_not_have_coverage_at_all() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered")) .setProperty("sonar.coverage.exclusions", "**/*")); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); diff --git a/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java b/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java index 656f8de6a00..c6ebc56b30b 100644 --- a/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java +++ b/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,7 +47,7 @@ public class CoverageTrackingTest { @Test public void test_coverage_per_test() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-coverage-per-test"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-with-coverage-per-test"))); String tests = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo"); JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTrackingTest/tests-expected.json"), "UTF-8"), tests, false); diff --git a/it/it-tests/src/test/java/it/test/NewCoverageTest.java b/it/it-tests/src/test/java/it/test/NewCoverageTest.java index 07cbdb082e6..9d14a1f05c3 100644 --- a/it/it-tests/src/test/java/it/test/NewCoverageTest.java +++ b/it/it-tests/src/test/java/it/test/NewCoverageTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import org.assertj.core.data.Offset; import org.junit.BeforeClass; @@ -51,11 +51,11 @@ public class NewCoverageTest { public static void analyze_project() { orchestrator.resetData(); - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v1")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-new-coverage-v1")) .setProperty("sonar.projectDate", "2015-02-01") .setProperty("sonar.scm.disabled", "false") ); - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v2")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-new-coverage-v2")) .setProperty("sonar.scm.disabled", "false")); } diff --git a/it/it-tests/src/test/java/it/test/TestExecutionTest.java b/it/it-tests/src/test/java/it/test/TestExecutionTest.java index dc0ec63afca..f0d11de0533 100644 --- a/it/it-tests/src/test/java/it/test/TestExecutionTest.java +++ b/it/it-tests/src/test/java/it/test/TestExecutionTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import org.apache.commons.io.IOUtils; import org.junit.Before; @@ -45,7 +45,7 @@ public class TestExecutionTest { @Test public void test_execution() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-tests-execution"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-with-tests-execution"))); Resource project = orchestrator.getServer().getWsClient() .find(ResourceQuery.createForMetrics("sample-with-tests", "test_success_density", "test_failures", "test_errors", "tests", "skipped_tests", "test_execution_time")); diff --git a/it/it-tests/src/test/java/it/user/FavouriteTest.java b/it/it-tests/src/test/java/it/user/FavouriteTest.java index 46e18f07e3a..a97d6aad437 100644 --- a/it/it-tests/src/test/java/it/user/FavouriteTest.java +++ b/it/it-tests/src/test/java/it/user/FavouriteTest.java @@ -22,7 +22,7 @@ package it.user; import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import java.util.List; import org.junit.Before; @@ -52,7 +52,7 @@ public class FavouriteTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); } @Test diff --git a/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java b/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java index 07a6ec4830a..83019aecd2f 100644 --- a/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java @@ -21,7 +21,7 @@ package it.user; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; @@ -147,7 +147,7 @@ public class LocalAuthenticationTest { WsUserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest() .setLogin(LOGIN) .setName(tokenName)); - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); sampleProject.setProperties( "sonar.login", generateWsResponse.getToken(), "sonar.password", ""); @@ -160,7 +160,7 @@ public class LocalAuthenticationTest { @Test public void run_analysis_with_incorrect_token() { - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); sampleProject.setProperties( "sonar.login", "unknown-token", "sonar.password", ""); -- 2.39.5