use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class PluginsTest method analysis_of_project_with_all_supported_languages.
@Test
public void analysis_of_project_with_all_supported_languages() {
SonarScanner analysis = newAnalysis();
BuildResult result = ORCHESTRATOR.executeBuildQuietly(analysis);
if (result.getLastStatus() != 0) {
fail(result.getLogs());
}
for (Check check : CHECKS) {
System.out.println(check.getClass().getSimpleName() + "...");
check.validate(new Validation(ORCHESTRATOR, errorCollector));
}
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class ProjectAdministrationTest method delete_version_of_multimodule_project.
// SONAR-4203
@Test
@Ignore("refactor with wsClient")
public void delete_version_of_multimodule_project() {
GregorianCalendar today = new GregorianCalendar();
SonarScanner build = SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")).setProperty("sonar.dynamicAnalysis", "false").setProperty("sonar.projectDate", (today.get(Calendar.YEAR) - 1) + "-01-01");
orchestrator.executeBuild(build);
// The analysis must be run once again to have an history so that it is possible
// to set/delete version on old snapshot
build.setProperty("sonar.projectDate", today.get(Calendar.YEAR) + "-01-01");
orchestrator.executeBuild(build);
// There are 7 modules
assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(1);
runSelenese(orchestrator, "/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html");
assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(2);
runSelenese(orchestrator, "/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html");
assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(1);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class ProjectAdministrationTest method project_deletion.
/**
* Test updated for SONAR-3570 and SONAR-5923
*/
@Test
public void project_deletion() {
String projectAdminUser = "project-deletion-with-admin-permission-on-project";
SonarClient wsClient = orchestrator.getServer().adminWsClient();
try {
SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample"));
orchestrator.executeBuild(scan);
// Create user having admin permission on previously analysed project
wsClient.userClient().create(UserParameters.create().login(projectAdminUser).name(projectAdminUser).password("password").passwordConfirmation("password"));
wsClient.post("api/permissions/add_user", "login", projectAdminUser, "projectKey", "sample", "permission", "admin");
runSelenese(orchestrator, "/projectAdministration/ProjectAdministrationTest/project-deletion/project-deletion.html");
} finally {
wsClient.userClient().deactivate(projectAdminUser);
}
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class ProjectAdministrationTest method scanSample.
private void scanSample(@Nullable String date, @Nullable String profile) {
SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample")).setProperty("sonar.cpd.exclusions", "**/*");
if (date != null) {
scan.setProperty("sonar.projectDate", date);
}
if (profile != null) {
scan.setProfile(profile);
}
orchestrator.executeBuild(scan);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssueCreationDateTest method analysis.
private void analysis(QProfile qProfile, SourceCode sourceCode, ScannerFeature... scm) {
server.restoreProfile(FileLocation.ofClasspath(qProfile.path));
server.associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, LANGUAGE_XOO, SAMPLE_QUALITY_PROFILE_NAME);
SonarScanner scanner = SonarScanner.create(projectDir(sourceCode.path));
Arrays.stream(scm).forEach(s -> s.configure(scanner));
ORCHESTRATOR.executeBuild(scanner);
}
Aggregations