Package org.sonar.batch.mediumtest.BatchMediumTester

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult


  @Test
  public void testIssueExclusion() throws Exception {
    File projectDir = new File(IssuesMediumTest.class.getResource("/mediumtest/xoo/sample").toURI());

    TaskResult result = tester
      .newScanTask(new File(projectDir, "sonar-project.properties"))
      .property("sonar.issue.ignore.allfile", "1")
      .property("sonar.issue.ignore.allfile.1.fileRegexp", "object")
      .start();

    assertThat(result.issues()).hasSize(20);
  }
View Full Code Here


    srcDir.mkdir();

    File xooFile = new File(srcDir, "sample.xoo");
    FileUtils.write(xooFile, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10");

    TaskResult result = tester.newTask()
      .properties(ImmutableMap.<String, String>builder()
        .put("sonar.task", "scan")
        .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
        .put("sonar.projectKey", "com.foo.project")
        .put("sonar.projectName", "Foo Project")
        .put("sonar.projectVersion", "1.0-SNAPSHOT")
        .put("sonar.projectDescription", "Description of Foo Project")
        .put("sonar.sources", "src")
        .build())
      .start();

    assertThat(result.issues()).hasSize(10);

    boolean foundIssueAtLine1 = false;
    for (Issue issue : result.issues()) {
      if (issue.line() == 1) {
        foundIssueAtLine1 = true;
        assertThat(issue.inputPath()).isEqualTo(new DefaultInputFile("com.foo.project", "src/sample.xoo"));
        assertThat(issue.message()).isEqualTo("This issue is generated on each line");
        assertThat(issue.effortToFix()).isNull();
View Full Code Here

    FileUtils.write(xooFile1, "Sample1 xoo\ncontent");

    File xooFile2 = new File(srcDir, "sample2.xoo");
    FileUtils.write(xooFile2, "Sample2 xoo\ncontent");

    TaskResult result = tester.newTask()
      .properties(ImmutableMap.<String, String>builder()
        .put("sonar.task", "scan")
        .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
        .put("sonar.projectKey", "com.foo.project")
        .put("sonar.projectName", "Foo Project")
        .put("sonar.projectVersion", "1.0-SNAPSHOT")
        .put("sonar.projectDescription", "Description of Foo Project")
        .put("sonar.sources", "src")
        .build())
      .start();

    assertThat(result.issues()).hasSize(2);
    assertThat(result.issues().iterator().next().inputPath()).isEqualTo(new DefaultInputDir("com.foo.project", "src"));

  }
View Full Code Here

TOP

Related Classes of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.