@Test
 public void invalid_test_report() throws Exception {
   BuildResult result = orchestrator.executeBuildQuietly(createBuild("invalid_report.xml"));
   assertThat(result.isSuccess()).isFalse();
   assertThat(result.getLogs()).contains("Cannot feed the data into sonar");
   assertProjectMeasures(PROJECT, nullMeasures());
 }
 @Test
 public void invalid_binaries_dir_should_fail_analysis() {
   SonarScanner scanner = ditProjectSonarScanner();
   scanner.setProperty("sonar.java.binaries", "target/dummy__Dir");
   BuildResult buildResult = ORCHESTRATOR.executeBuildQuietly(scanner);
   assertThat(buildResult.getStatus()).isNotEqualTo(0);
   assertThat(buildResult.getLogs())
       .contains("No files nor directories matching 'target/dummy__Dir'");
 }
Esempio n. 3
0
  @Test
  public void should_fail_if_plugin_access_secured_properties() throws IOException {
    // Test access from task (ie BatchSettings)
    SonarRunner runner =
        configureRunnerIssues("shared/xoo-sample", "accessSecuredFromTask", "true");
    BuildResult result = orchestrator.executeBuildQuietly(runner);

    assertThat(result.getLogs())
        .contains(
            "Access to the secured property 'foo.bar.secured' is not possible in issues mode. "
                + "The SonarQube plugin which requires this property must be deactivated in issues mode.");

    // Test access from sensor (ie ModuleSettings)
    runner = configureRunnerIssues("shared/xoo-sample", "accessSecuredFromSensor", "true");
    result = orchestrator.executeBuildQuietly(runner);

    assertThat(result.getLogs())
        .contains(
            "Access to the secured property 'foo.bar.secured' is not possible in issues mode. "
                + "The SonarQube plugin which requires this property must be deactivated in issues mode.");
  }
  @Test
  public void should_support_the_old_binaries_and_libraries_properties() {
    SonarScanner scanner = ditProjectSonarScanner();
    scanner.setProperty("sonar.binaries", "target/classes");
    scanner.setProperty("sonar.libraries", guavaJarPath);
    BuildResult buildResult = ORCHESTRATOR.executeBuildQuietly(scanner);

    assertThat(buildResult.getLogs())
        .contains(
            "sonar.binaries and sonar.libraries are not supported since version 4.0 of sonar-java-plugin,"
                + " please use sonar.java.binaries and sonar.java.libraries instead");
    assertThat(buildResult.isSuccess()).isFalse();
  }