use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class ScannerTest method should_display_explicit_message_when_no_plugin_language_available.
/**
* SONAR-3125
*/
@Test
public void should_display_explicit_message_when_no_plugin_language_available() {
orchestrator.getServer().provisionProject("sample", "xoo-sample");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
BuildResult buildResult = scanQuietly("shared/xoo-sample", "sonar.language", "foo", "sonar.profile", "");
assertThat(buildResult.getLastStatus()).isEqualTo(1);
assertThat(buildResult.getLogs()).contains("You must install a plugin that supports the language 'foo'");
}
use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class ScannerTest method display_MessageException_without_stacktrace.
/**
* SONAR-4547
*/
@Test
public void display_MessageException_without_stacktrace() throws Exception {
orchestrator.getServer().provisionProject("sample", "xoo-sample");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
BuildResult result = scanQuietly("shared/xoo-sample", "raiseMessageException", "true");
assertThat(result.getLastStatus()).isNotEqualTo(0);
assertThat(result.getLogs()).contains("Error message from plugin").doesNotContain("at com.sonarsource.RaiseMessageException");
}
use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class ScannerTest method should_honor_sonarUserHome.
@Test
public void should_honor_sonarUserHome() {
File userHome = temp.getRoot();
orchestrator.getServer().provisionProject("sample", "xoo-sample");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
SonarScanner scanner = configureScanner("shared/xoo-sample", "sonar.verbose", "true");
scanner.setEnvironmentVariable("SONAR_USER_HOME", "/dev/null");
BuildResult buildResult = orchestrator.executeBuildQuietly(scanner);
assertThat(buildResult.getLastStatus()).isEqualTo(1);
buildResult = scan("shared/xoo-sample", "sonar.verbose", "true", "sonar.userHome", userHome.getAbsolutePath());
assertThat(buildResult.isSuccess()).isTrue();
}
use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class ScannerTest method should_display_explicit_message_when_invalid_project_key_or_branch.
/**
* SONAR-4188, SONAR-5178, SONAR-5915
*/
@Test
public void should_display_explicit_message_when_invalid_project_key_or_branch() {
orchestrator.getServer().provisionProject("sample", "xoo-sample");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
BuildResult buildResult = scanQuietly("shared/xoo-sample", "sonar.projectKey", "ar g$l:");
assertThat(buildResult.getLastStatus()).isEqualTo(1);
assertThat(buildResult.getLogs()).contains("\"ar g$l:\" is not a valid project or module key").contains("Allowed characters");
// SONAR-4629
buildResult = scanQuietly("shared/xoo-sample", "sonar.projectKey", "12345");
assertThat(buildResult.getLastStatus()).isEqualTo(1);
assertThat(buildResult.getLogs()).contains("\"12345\" is not a valid project or module key").contains("Allowed characters");
buildResult = scanQuietly("shared/xoo-sample", "sonar.branch", "ar g$l:");
assertThat(buildResult.getLastStatus()).isEqualTo(1);
assertThat(buildResult.getLogs()).contains("\"ar g$l:\" is not a valid branch").contains("Allowed characters");
}
use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class ScannerTest method batch_should_cache_plugin_jars.
/**
* SONAR-2291
*/
@Test
public void batch_should_cache_plugin_jars() throws IOException {
File userHome = temp.newFolder();
BuildResult result = scan("shared/xoo-sample", "sonar.userHome", userHome.getAbsolutePath());
File cache = new File(userHome, "cache");
assertThat(cache).exists().isDirectory();
int cachedFiles = FileUtils.listFiles(cache, new String[] { "jar" }, true).size();
assertThat(cachedFiles).isGreaterThan(5);
assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath());
assertThat(result.getLogs()).contains("Download sonar-xoo-plugin-");
result = scan("shared/xoo-sample", "sonar.userHome", userHome.getAbsolutePath());
assertThat(cachedFiles).isEqualTo(cachedFiles);
assertThat(result.getLogs()).contains("User cache: " + cache.getAbsolutePath());
assertThat(result.getLogs()).doesNotContain("Download sonar-xoo-plugin-");
}
Aggregations