Package org.sonar.batch.mediumtest.BatchMediumTester

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


    FileUtils.write(xooTestFile, "Sample test xoo\ncontent");

    File xooTestFile2 = new File(testDir, "sampleTest.xoo");
    FileUtils.write(xooTestFile2, "Sample test xoo 2\ncontent");

    TaskResult result = tester.newTask()
      .properties(builder
        .put("sonar.sources", "src,another.xoo")
        .put("sonar.tests", "test,sampleTest2.xoo")
        .build())
      .start();

    assertThat(result.inputFiles()).hasSize(4);
  }
View Full Code Here


      sb.append(i).append(":").append(i + 1).append(":s\n");
    }
    FileUtils.write(xoohighlightingFile, sb.toString());

    long start = System.currentTimeMillis();
    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();
    System.out.println("Duration: " + (System.currentTimeMillis() - start));

    InputFile file = result.inputFile("src/sample.xoo");
    assertThat(result.highlightingTypeFor(file, 0)).containsExactly(TypeOfText.STRING);

  }
View Full Code Here

  // SONAR-5330
  @Test
  public void scanProjectWithSourceSymlink() throws Exception {
    if (!System2.INSTANCE.isOsWindows()) {
      File projectDir = new File("src/test/resources/mediumtest/xoo/sample-with-symlink");
      TaskResult result = tester
        .newScanTask(new File(projectDir, "sonar-project.properties"))
        .start();

      assertThat(result.inputFiles()).hasSize(3);
    }
  }
View Full Code Here

    FileUtils.write(xooFile, "Sample xoo\ncontent");
    FileUtils.write(xooFile2, "Sample xoo\ncontent");
    FileUtils.write(xooFile3, "Sample xoo\ncontent");
    FileUtils.write(xooDepsFile, "src/sample2.xoo:3\nsrc/foo/sample3.xoo:6");

    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.dependencyWeight(result.inputFile("src/sample.xoo"), result.inputFile("src/sample2.xoo"))).isEqualTo(3);
    assertThat(result.dependencyWeight(result.inputFile("src/sample.xoo"), result.inputFile("src/foo/sample3.xoo"))).isEqualTo(6);
  }
View Full Code Here

    File xooFile = new File(srcDir, "sample.xoo");
    File xooSymbolFile = new File(srcDir, "sample.xoo.symbol");
    FileUtils.write(xooFile, "Sample xoo\ncontent\nanother xoo");
    FileUtils.write(xooSymbolFile, "7,10,27");

    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();

    InputFile file = result.inputFile("src/sample.xoo");
    assertThat(result.symbolReferencesFor(file, 7, 10)).containsOnly(7, 27);
  }
View Full Code Here

    File xooTestFile = new File(testDir, "sampleTest.xoo");
    File xooTestPlanFile = new File(testDir, "sampleTest.xoo.testplan");
    FileUtils.write(xooTestFile, "Sample test xoo\ncontent");
    FileUtils.write(xooTestPlanFile, "test1:UNIT:OK:::\ntest2:INTEGRATION:ERROR:Assertion failure:A very long stack:12");

    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")
        .put("sonar.tests", "test")
        .build())
      .start();

    assertThat(result.testCasesFor(new DefaultInputFile("com.foo.project", "test/sampleTest.xoo"))).hasSize(2);
  }
View Full Code Here

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

    TaskResult result = tester
      .newScanTask(new File(projectDir, "sonar-project.properties"))
      .start();

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

    FileUtils.write(xooMainFile, "Sample xoo\ncontent");
    FileUtils.write(xooTestFile, "Sample test xoo\ncontent");
    FileUtils.write(xooTestPlanFile, "test1:UNIT:OK:::3\ntest2:INTEGRATION:ERROR:Assertion failure:A very long stack:12");
    FileUtils.write(xooTestCoverageFile, "test1:src/sample.xoo:1,2,3,8,9,10\ntest2:src/sample.xoo:3,4");

    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")
        .put("sonar.tests", "test")
        .build())
      .start();

    assertThat(result.coveragePerTest(new DefaultInputFile("com.foo.project", "test/sampleTest.xoo"), "test1", new DefaultInputFile("com.foo.project", "src/sample.xoo")))
      .containsExactly(1, 2, 3, 8, 9, 10);
    assertThat(result.coveragePerTest(new DefaultInputFile("com.foo.project", "test/sampleTest.xoo"), "test2", new DefaultInputFile("com.foo.project", "src/sample.xoo")))
      .containsExactly(3, 4);
  }
View Full Code Here

  @Test
  public void findActiveRuleByInternalKey() 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.xoo.internalKey", "OneIssuePerLine.internal")
      .start();

    assertThat(result.issues()).hasSize(26 /* 26 lines */+ 3 /* 3 files */);
  }
View Full Code Here

  @Test
  public void testOverrideQProfileSeverity() 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.oneIssuePerLine.forceSeverity", "CRITICAL")
      .start();

    assertThat(result.issues().iterator().next().overridenSeverity()).isEqualTo(Severity.CRITICAL);
  }
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.