use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class QualityGateTest method test_status_ok.
@Test
public void test_status_ok() throws IOException {
QualityGate simple = qgClient().create("SimpleWithHighThreshold");
qgClient().setDefault(simple.id());
qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").operator("GT").warningThreshold("40"));
try {
SonarScanner build = SonarScanner.create(projectDir("qualitygate/xoo-sample"));
BuildResult buildResult = orchestrator.executeBuild(build);
verifyQGStatusInPostTask(buildResult, TASK_STATUS_SUCCESS, QG_STATUS_OK);
assertThat(getGateStatusMeasure().getValue()).isEqualTo("OK");
} finally {
qgClient().unsetDefault();
qgClient().destroy(simple.id());
}
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class EventTest method executeAnalysis.
private static void executeAnalysis(String... properties) {
SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")).setProperties(properties);
orchestrator.executeBuild(sampleProject);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class MyAccountPageTest method analyzeProject.
private static void analyzeProject(String projectKey) {
SonarScanner build = SonarScanner.create(projectDir("qualitygate/xoo-sample")).setProjectKey(projectKey).setProperty("sonar.projectDescription", "Description of a project").setProperty("sonar.links.homepage", "http://example.com");
orchestrator.executeBuild(build);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssueJsonReportTest method test_json_report_on_root_module.
/**
* Multi-modules project
*/
@Test
public void test_json_report_on_root_module() throws Exception {
orchestrator.getServer().restoreProfile(getResource("/one-issue-per-line.xml"));
orchestrator.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "Sonar :: Integration Tests :: Multi-modules Sample");
orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line");
File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample");
SonarScanner scan = SonarScanner.create(rootDir).setProperty("sonar.projectDate", "2013-05-01");
orchestrator.executeBuild(scan);
// issues mode scan -> no new issues
SonarScanner issuesModeScan = SonarScanner.create(rootDir).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(rootDir, ".sonar/sonar-report.json");
assertThat(report).isFile().exists();
String json = sanitize(FileUtils.readFileToString(report));
String expectedJson = expected("report-on-root-module.json");
JSONAssert.assertEquals(expectedJson, json, false);
}
use of com.sonar.orchestrator.build.SonarScanner in project sonarqube by SonarSource.
the class IssuesModeTest method issues_analysis_on_new_project.
@Test
public void issues_analysis_on_new_project() throws IOException {
restoreProfile("one-issue-per-line.xml");
orchestrator.getServer().provisionProject("sample", "xoo-sample");
orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
SonarScanner runner = configureRunnerIssues("shared/xoo-sample", null, "sonar.verbose", "true");
BuildResult result = orchestrator.executeBuild(runner);
assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17);
}
Aggregations