Search in sources :

Example 6 with BuildResult

use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.

the class PermissionTest method scanner_can_authenticate_with_login_password.

/**
   * SONAR-4211 Test Sonar Runner when server requires authentication
   */
@Test
public void scanner_can_authenticate_with_login_password() {
    createUserWithProvisioningAndScanPermissions();
    orchestrator.getServer().provisionProject("sample", "xoo-sample");
    BuildResult buildResult = scanQuietly("shared/xoo-sample", "sonar.login", "", "sonar.password", "");
    assertThat(buildResult.getLastStatus()).isEqualTo(1);
    assertThat(buildResult.getLogs()).contains("Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password.");
    // SONAR-4048
    buildResult = scanQuietly("shared/xoo-sample", "sonar.login", "wrong_login", "sonar.password", "wrong_password");
    assertThat(buildResult.getLastStatus()).isEqualTo(1);
    assertThat(buildResult.getLogs()).contains("Not authorized. Please check the properties sonar.login and sonar.password.");
    buildResult = scan("shared/xoo-sample", "sonar.login", A_LOGIN, "sonar.password", A_PASSWORD);
    assertThat(buildResult.getLastStatus()).isEqualTo(0);
}
Also used : BuildResult(com.sonar.orchestrator.build.BuildResult) Test(org.junit.Test)

Example 7 with BuildResult

use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.

the class PermissionTest method run_scanner_with_user_having_scan_permission_only_on_project.

@Test
public void run_scanner_with_user_having_scan_permission_only_on_project() throws Exception {
    userRule.createUser(A_LOGIN, A_PASSWORD);
    orchestrator.getServer().provisionProject("sample", "sample");
    addUserPermission(A_LOGIN, "scan", "sample");
    BuildResult buildResult = scanQuietly("shared/xoo-sample", "sonar.login", A_LOGIN, "sonar.password", A_PASSWORD);
    assertThat(buildResult.isSuccess()).isTrue();
}
Also used : BuildResult(com.sonar.orchestrator.build.BuildResult) Test(org.junit.Test)

Example 8 with BuildResult

use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.

the class PluginsTest method preview_analysis_of_project_with_all_supported_languages.

@Test
public void preview_analysis_of_project_with_all_supported_languages() {
    SonarScanner analysis = newAnalysis();
    analysis.setProperty("sonar.analysis.mode", "issues");
    BuildResult result = ORCHESTRATOR.executeBuildQuietly(analysis);
    if (result.getLastStatus() != 0) {
        fail(result.getLogs());
    }
}
Also used : BuildResult(com.sonar.orchestrator.build.BuildResult) SonarScanner(com.sonar.orchestrator.build.SonarScanner) Test(org.junit.Test)

Example 9 with BuildResult

use of com.sonar.orchestrator.build.BuildResult 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));
    }
}
Also used : Validation(it.plugins.checks.Validation) BuildResult(com.sonar.orchestrator.build.BuildResult) PliCheck(it.plugins.checks.PliCheck) PhpCheck(it.plugins.checks.PhpCheck) Check(it.plugins.checks.Check) JavaCheck(it.plugins.checks.JavaCheck) AbapCheck(it.plugins.checks.AbapCheck) GroovyCheck(it.plugins.checks.GroovyCheck) PythonCheck(it.plugins.checks.PythonCheck) VbCheck(it.plugins.checks.VbCheck) SwiftCheck(it.plugins.checks.SwiftCheck) CCheck(it.plugins.checks.CCheck) RpgCheck(it.plugins.checks.RpgCheck) JavascriptCheck(it.plugins.checks.JavascriptCheck) WebCheck(it.plugins.checks.WebCheck) FlexCheck(it.plugins.checks.FlexCheck) CobolCheck(it.plugins.checks.CobolCheck) CppCheck(it.plugins.checks.CppCheck) SonarScanner(com.sonar.orchestrator.build.SonarScanner) Test(org.junit.Test)

Example 10 with BuildResult

use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.

the class CeWsTest method inspectProject.

@Before
public void inspectProject() {
    orchestrator.resetData();
    BuildResult buildResult = orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")));
    this.taskUuid = ItUtils.extractCeTaskId(buildResult);
    this.wsClient = ItUtils.newAdminWsClient(orchestrator);
}
Also used : BuildResult(com.sonar.orchestrator.build.BuildResult) Before(org.junit.Before)

Aggregations

BuildResult (com.sonar.orchestrator.build.BuildResult)53 Test (org.junit.Test)49 SonarScanner (com.sonar.orchestrator.build.SonarScanner)38 File (java.io.File)12 QualityGate (org.sonar.wsclient.qualitygate.QualityGate)7 JSONArray (org.json.simple.JSONArray)4 JSONObject (org.json.simple.JSONObject)4 Issue (org.sonar.wsclient.issue.Issue)3 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 BuildFailureException (com.sonar.orchestrator.build.BuildFailureException)1 SonarScannerInstaller (com.sonar.orchestrator.build.SonarScannerInstaller)1 FileSystem (com.sonar.orchestrator.config.FileSystem)1 AbapCheck (it.plugins.checks.AbapCheck)1 CCheck (it.plugins.checks.CCheck)1 Check (it.plugins.checks.Check)1 CobolCheck (it.plugins.checks.CobolCheck)1 CppCheck (it.plugins.checks.CppCheck)1 FlexCheck (it.plugins.checks.FlexCheck)1 GroovyCheck (it.plugins.checks.GroovyCheck)1