use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssuesModeTest method shoud_support_sonar_profile_prop.
// SONAR-8518
@Test
public void shoud_support_sonar_profile_prop() throws IOException {
restoreProfile("one-issue-per-line.xml");
restoreProfile("empty.xml");
orchestrator.getServer().provisionProject("sample", "xoo-sample");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "empty");
SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true", "sonar.analysis.mode", "issues", "sonar.profile", "one-issue-per-line");
BuildResult result = orchestrator.executeBuild(runner);
ItUtils.assertIssuesInJsonReport(result, 17, 0, 0);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssuesModeTest method should_fail_if_plugin_access_secured_properties.
@Test
public void should_fail_if_plugin_access_secured_properties() throws IOException {
// Test access from task (ie BatchSettings)
SonarScanner runner = configureRunnerIssues("shared/xoo-sample", null, "accessSecuredFromTask", "true");
BuildResult result = orchestrator.executeBuildQuietly(runner);
assertThat(result.getLogs()).contains("Access to the secured property 'foo.bar.secured' is not possible in issues mode. " + "The SonarQube plugin which requires this property must be deactivated in issues mode.");
// Test access from sensor (ie ModuleSettings)
runner = configureRunnerIssues("shared/xoo-sample", null, "accessSecuredFromSensor", "true");
result = orchestrator.executeBuildQuietly(runner);
assertThat(result.getLogs()).contains("Access to the secured property 'foo.bar.secured' is not possible in issues mode. " + "The SonarQube plugin which requires this property must be deactivated in issues mode.");
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class TempFolderTest method should_not_use_system_tmp_dir.
// SONAR-4748
@Test
public void should_not_use_system_tmp_dir() throws Exception {
String oldTmp = System.getProperty("java.io.tmpdir");
try {
File tmp = temp.newFolder();
assertThat(tmp.list()).isEmpty();
SonarScanner runner = configureScanner().setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Djava.io.tmpdir=" + tmp.getAbsolutePath());
orchestrator.executeBuild(runner);
// TODO There is one remaining file waiting for SONARPLUGINS-3185
assertThat(tmp.list()).hasSize(1);
assertThat(tmp.list()[0]).matches("sonar-runner-batch(.*).jar");
} finally {
System.setProperty("java.io.tmpdir", oldTmp);
}
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class FileExclusionsTest method scan.
private void scan(String... properties) {
SonarScanner build = SonarScanner.create(ItUtils.projectDir("exclusions/exclusions")).setProperties(properties);
orchestrator.executeBuild(build);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssueExclusionsTest method scan.
protected BuildResult scan(String... properties) {
orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/exclusions/IssueExclusionsTest/with-many-rules.xml"));
orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-exclusions", "Sonar :: Integration Tests :: Multi-modules With Exclusions");
orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-exclusions", "xoo", "with-many-rules");
SonarScanner scan = SonarScanner.create(ItUtils.projectDir(PROJECT_DIR)).setProperty("sonar.cpd.exclusions", "**/*").setProperties(properties).setProperty("sonar.verbose", "true");
return orchestrator.executeBuildQuietly(scan);
}
Aggregations