use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class SettingsEncryptionTest method failIfEncryptedPropertyButNoSecretKey.
/**
* SONAR-2084
*/
@Test(expected = BuildFailureException.class)
public void failIfEncryptedPropertyButNoSecretKey() throws Exception {
// path to secret key is missing
SonarScanner build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")).setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
orchestrator.executeBuild(build);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class SettingsEncryptionTest method testEncryptedProperty.
/**
* SONAR-2084
* SONAR-4061
*/
@Test
public void testEncryptedProperty() throws Exception {
SonarScanner build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")).setProperty("sonar.secretKeyPath", pathToValidSecretKey()).setProperty("sonar.login", "admin").setProperty("sonar.password", // wrong password
"{aes}wrongencryption==").setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
BuildResult result = orchestrator.executeBuildQuietly(build);
assertThat(result.getStatus()).isNotEqualTo(0);
assertThat(result.getLogs()).contains("Fail to decrypt the property sonar.password. Please check your secret key");
build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")).setProperty("sonar.secretKeyPath", pathToValidSecretKey()).setProperty("sonar.login", "{aes}evRHXHsEyPr5RjEuxUJcHA==").setProperty("sonar.password", "{aes}evRHXHsEyPr5RjEuxUJcHA==").setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY=");
// no error
orchestrator.executeBuild(build);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssuesModeTest method concurrent_issue_mode_on_existing_project.
@Test
public void concurrent_issue_mode_on_existing_project() throws Exception {
restoreProfile("one-issue-per-line.xml");
orchestrator.getServer().provisionProject("sample", "xoo-sample");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
// use same working dir, because lock file is in it
String workDirPath = temp.newFolder().getAbsolutePath();
SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.working.directory", workDirPath);
orchestrator.executeBuild(runner);
runConcurrentIssues(workDirPath);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class LinksTest method shouldUseLinkProperties.
/**
* SONAR-3676
*/
@Test
public void shouldUseLinkProperties() {
SonarScanner runner = SonarScanner.create(ItUtils.projectDir("analysis/links-project")).setProperty("sonar.scm.disabled", "true");
orchestrator.executeBuild(runner);
verifyLinks();
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class MultiLanguageTest method test_sonar_runner_inspection.
/**
* SONAR-926
* SONAR-5069
*/
@Test
public void test_sonar_runner_inspection() {
orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/analysis/MultiLanguageTest/one-issue-per-line.xml"));
orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/analysis/MultiLanguageTest/one-issue-per-line-xoo2.xml"));
orchestrator.getServer().provisionProject("multi-language-sample", "multi-language-sample");
orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample", "xoo", "one-issue-per-line");
orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample", "xoo2", "one-issue-per-line-xoo2");
SonarScanner build = SonarScanner.create().setProjectDir(ItUtils.projectDir("analysis/xoo-multi-languages"));
BuildResult result = orchestrator.executeBuild(build);
// 4 files: 1 .xoo, 1.xoo2, 2 .measures
assertThat(result.getLogs()).contains("4 files indexed");
assertThat(result.getLogs()).contains("Quality profile for xoo: one-issue-per-line");
assertThat(result.getLogs()).contains("Quality profile for xoo2: one-issue-per-line-xoo2");
// modules
Map<String, Double> measures = getMeasuresAsDoubleByMetricKey(orchestrator, "multi-language-sample", "files", "violations");
assertThat(measures.get("files")).isEqualTo(2);
assertThat(measures.get("violations")).isEqualTo(26);
assertThat(getMeasureAsDouble(orchestrator, "multi-language-sample:src/sample/Sample.xoo", "violations")).isEqualTo(13);
assertThat(getMeasureAsDouble(orchestrator, "multi-language-sample:src/sample/Sample.xoo2", "violations")).isEqualTo(13);
}
Aggregations