Package org.jacoco.report

Examples of org.jacoco.report.IReportVisitor


  }

  @Test
  public void testSetEncoding() throws Exception {
    formatter.setOutputEncoding("UTF-16");
    final IReportVisitor visitor = formatter.createVisitor(output);
    visitor.visitInfo(infos, data);
    driver.sendBundle(visitor);
    final BufferedReader reader = new BufferedReader(new InputStreamReader(
        output.getContentsAsStream(), "UTF-16"));
    final String line = reader.readLine();
    assertTrue(line,
View Full Code Here


      throws IOException {
    final ReportOutputFolder root = new ReportOutputFolder(output);
    resources = new Resources(root);
    resources.copyResources();
    index = new ElementIndex(root);
    return new IReportVisitor() {

      private List<SessionInfo> sessionInfos;
      private Collection<ExecutionData> executionData;

      private HTMLGroupVisitor groupHandler;
View Full Code Here

   * @return visitor to emit the report data to
   */
  public IReportVisitor createVisitor(final IViolationsOutput output) {
    final BundleChecker bundleChecker = new BundleChecker(rules,
        languageNames, output);
    return new IReportVisitor() {

      public IReportGroupVisitor visitGroup(final String name)
          throws IOException {
        return this;
      }
View Full Code Here

  @Override
  public void execute() throws BuildException {
    loadExecutionData();
    try {
      final IReportVisitor visitor = createVisitor();
      visitor.visitInfo(sessionInfoStore.getInfos(),
          executionDataStore.getContents());
      createReport(visitor, structure);
      visitor.visitEnd();
      for (final FormatterElement f : formatters) {
        f.finish();
      }
    } catch (final IOException e) {
      throw new BuildException("Error while creating report", e,
View Full Code Here

    for (final RuleConfiguration r : rules) {
      checkerrules.add(r.rule);
    }
    checker.setRules(checkerrules);

    final IReportVisitor visitor = checker.createVisitor(this);
    try {
      visitor.visitBundle(bundle, null);
    } catch (final IOException e) {
      throw new MojoExecutionException(
          "Error while checking code coverage: " + e.getMessage(), e);
    }
    if (violations) {
View Full Code Here

  @Override
  protected void executeReport(final Locale locale)
      throws MavenReportException {
    loadExecutionData();
    try {
      final IReportVisitor visitor = createVisitor(locale);
      visitor.visitInfo(sessionInfoStore.getInfos(),
          executionDataStore.getContents());
      createReport(visitor);
      visitor.visitEnd();
    } catch (final IOException e) {
      throw new MavenReportException("Error while creating report: "
          + e.getMessage(), e);
    }
  }
View Full Code Here

      throws IOException {

    // Create a concrete report visitor based on some supplied
    // configuration. In this case we use the defaults
    final HTMLFormatter htmlFormatter = new HTMLFormatter();
    final IReportVisitor visitor = htmlFormatter
        .createVisitor(new FileMultiReportOutput(reportDirectory));

    // Initialize the report with all of the execution and session
    // information. At this point the report doesn't know about the
    // structure of the report being created
    visitor.visitInfo(execFileLoader.getSessionInfoStore().getInfos(),
        execFileLoader.getExecutionDataStore().getContents());

    // Populate the report structure with the bundle coverage information.
    // Call visitGroup if you need groups in your report.
    visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(
        sourceDirectory, "utf-8", 4));

    // Signal end of structure information to allow report to write all
    // information out
    visitor.visitEnd();

  }
View Full Code Here

        NLS.bind(CoreMessages.ExportingSession_task, session.getDescription()),
        work * 2);
    final SessionAnalyzer analyzer = new SessionAnalyzer();
    final IJavaModelCoverage modelCoverage = analyzer.processSession(session,
        new SubProgressMonitor(monitor, work));
    final IReportVisitor formatter = createFormatter();
    formatter
        .visitInfo(analyzer.getSessionInfos(), analyzer.getExecutionData());
    final IReportGroupVisitor modelgroup = formatter.visitGroup(session
        .getDescription());
    for (IJavaProject project : modelCoverage.getProjects()) {
      final IReportGroupVisitor projectgroup = modelgroup.visitGroup(project
          .getElementName());
      for (IPackageFragmentRoot root : project.getPackageFragmentRoots()) {
        final IBundleCoverage coverage = (IBundleCoverage) modelCoverage
            .getCoverageFor(root);
        if (coverage != null) {
          projectgroup.visitBundle(coverage, createSourceFileLocator(root));
          monitor.worked(1);
        }
      }
    }
    formatter.visitEnd();
    monitor.done();
  }
View Full Code Here

TOP

Related Classes of org.jacoco.report.IReportVisitor

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.