use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class PerfTestCase method newScanner.
/**
* New batch analysis with most features disabled by default (empty QP, no CPD, no SCM, ...)
*/
public static SonarScanner newScanner(String sonarRunnerOpts, String... props) {
SonarScanner scanner = SonarScanner.create().setProperties("sonar.scm.disabled", "true", "sonar.cpd.exclusions", "**").setProperties(props);
scanner.setEnvironmentVariable("SONAR_RUNNER_OPTS", sonarRunnerOpts).setProjectDir(FileLocation.of("projects/xoo-sample").getFile());
return scanner;
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class FavoriteTest method project_as_favorite_when_authenticated_and_first_analysis_and_a_project_creator_permission.
@Test
public void project_as_favorite_when_authenticated_and_first_analysis_and_a_project_creator_permission() {
SonarScanner sampleProject = createScannerWithUserCredentials();
addProjectCreatorPermission();
orchestrator.executeBuild(sampleProject);
Favorites.SearchResponse response = adminWsClient.favorites().search(new SearchRequest());
assertThat(response.getFavoritesList()).extracting(Favorite::getKey).contains(PROJECT_KEY);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class FavoriteTest method no_project_as_favorite_when_no_project_creator_permission.
@Test
public void no_project_as_favorite_when_no_project_creator_permission() {
SonarScanner sampleProject = createScannerWithUserCredentials();
orchestrator.executeBuild(sampleProject);
Favorites.SearchResponse response = adminWsClient.favorites().search(new SearchRequest());
assertThat(response.getFavoritesList()).extracting(Favorite::getKey).doesNotContain(PROJECT_KEY);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class FavoriteTest method no_project_as_favorite_when_second_analysis.
@Test
public void no_project_as_favorite_when_second_analysis() {
SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample"));
orchestrator.executeBuild(sampleProject);
sampleProject = createScannerWithUserCredentials();
addProjectCreatorPermission();
orchestrator.executeBuild(sampleProject);
Favorites.SearchResponse response = adminWsClient.favorites().search(new SearchRequest());
assertThat(response.getFavoritesList()).extracting(Favorite::getKey).doesNotContain(PROJECT_KEY);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssueJsonReportTest method test_json_report_no_server_analysis.
@Test
public void test_json_report_no_server_analysis() throws Exception {
orchestrator.getServer().restoreProfile(getResource("one-issue-per-line.xml"));
orchestrator.getServer().provisionProject("sample", "tracking");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
File projectDir = ItUtils.projectDir("analysis/tracking/v1");
SonarScanner issuesModeScan = SonarScanner.create(projectDir).setProperty("sonar.analysis.mode", "issues").setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()).setProperty("sonar.report.export.path", "sonar-report.json").setProperty("sonar.projectDate", "2013-05-02");
orchestrator.executeBuild(issuesModeScan);
File report = new File(projectDir, ".sonar/sonar-report.json");
assertThat(report).isFile().exists();
String json = sanitize(FileUtils.readFileToString(report));
String expectedJson = expected("no-server-analysis.json");
JSONAssert.assertEquals(expectedJson, json, false);
}
Aggregations