use of com.sonar.orchestrator.build.SonarScanner in project sonar-web by SonarSource.
the class WebRulingTest method ruling.
@Test
public void ruling() throws Exception {
File litsDifferencesFile = FileLocation.of("target/differences").getFile();
String projectKey = "project";
orchestrator.getServer().provisionProject(projectKey, projectKey);
orchestrator.getServer().associateProjectToQualityProfile(projectKey, "web", "rules");
SonarScanner build = SonarScanner.create().setProjectDir(FileLocation.of("../sources").getFile()).setProjectKey(projectKey).setProjectName(projectKey).setProjectVersion("1").setSourceDirs(".").setSourceEncoding("UTF-8").setProperty("sonar.web.file.suffixes", "xhtml,jspf,jsp,html,php,erb").setProperty("sonar.analysis.mode", "preview").setProperty("sonar.issuesReport.html.enable", "true").setProperty("dump.old", FileLocation.of("src/test/resources/expected").getFile().getAbsolutePath()).setProperty("dump.new", FileLocation.of("target/actual").getFile().getAbsolutePath()).setProperty("lits.differences", litsDifferencesFile.getAbsolutePath()).setProperty("sonar.cpd.skip", "true").setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Xmx1024m");
orchestrator.executeBuild(build);
assertThat(Files.toString(litsDifferencesFile, StandardCharsets.UTF_8)).isEmpty();
}
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