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;
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);
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);
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);
}
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;
}
}
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;
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");
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");
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")
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")
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")
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")
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")
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;
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);
}
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);
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);
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<Issue> serverIssues = ItUtils.getAllServerIssues(orchestrator);
for (Issue i : serverIssues) {
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<Issue> serverIssues = ItUtils.getAllServerIssues(orchestrator);
for (Issue i : serverIssues) {
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
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",
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();
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();
@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);
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
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
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();
// 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);
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());
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;
*/
@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);
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;
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");
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;
public static void init() {
orchestrator.resetData();
orchestrator.executeBuild(
- SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))
+ SonarScanner.create(ItUtils.projectDir("shared/xoo-sample"))
);
}
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) {
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;
@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();
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;
*/
@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
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==")
@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);
}
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;
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);
}
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);
}
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;
}
private void scan(String... properties) {
- SonarRunner build = SonarRunner
+ SonarScanner build = SonarScanner
.create(ItUtils.projectDir("exclusions/exclusions"))
.setProperties(properties);
orchestrator.executeBuild(build);
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;
"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");
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;
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);
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;
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);
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;
@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);
}
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;
@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);
}
*/
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;
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 {
@Before
public void inspectProject() {
orchestrator.resetData();
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+ orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")));
}
/**
*/
@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";
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;
@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")
);
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;
}
private void analyzeProject() {
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+ orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")));
}
private void setTeamSize(int i) {
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;
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<String, String> 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;
}
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;
@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",
*/
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;
// 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()
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));
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));
// 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));
// 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));
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;
@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);
}
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;
private void executeBuild(String projectLocation, String projectKey, String projectName) {
orchestrator.executeBuild(
- SonarRunner.create(projectDir(projectLocation))
+ SonarScanner.create(projectDir(projectLocation))
.setProjectKey(projectKey)
.setProjectName(projectName)
);
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;
@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")
);
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;
@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");
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;
}
private static void analyzeProject(String path, String date) {
- orchestrator.executeBuild(SonarRunner.create(projectDir(path))
+ orchestrator.executeBuild(SonarScanner.create(projectDir(path))
.setProperties("sonar.projectDate", date));
}
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;
}
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);
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;
}
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
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;
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)
);
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;
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)
);
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;
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)
);
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;
@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")
);
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;
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");
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;
}
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);
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;
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");
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);
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);
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);
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");
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);
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);
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;
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();
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")
);
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;
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<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list();
// 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")
);
// 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)
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;
}
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);
}
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;
// 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",
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;
.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);
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;
*/
@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",
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;
@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);
@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);
@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();
@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);
*/
@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);
*/
@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));
*/
@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));
*/
@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));
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;
@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);
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;
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"));
}
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;
@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"));
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;
@Before
public void inspectProject() {
orchestrator.resetData();
- orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")));
+ orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")));
}
@Test
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;
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", "");
@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", "");