• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IReportVisitor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jacoco.report.IReportVisitor的典型用法代码示例。如果您正苦于以下问题:Java IReportVisitor类的具体用法?Java IReportVisitor怎么用?Java IReportVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IReportVisitor类属于org.jacoco.report包,在下文中一共展示了IReportVisitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createReport(final IBundleCoverage bundleCoverage)
            throws IOException {

        final IReportVisitor visitor = createVisitor(Locale.getDefault());

        // Initialize the report with all of the execution and session
        // information.
        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, OUTPUT_ENCODING, 4));
//        visitor.visitGroup("AS");

        // Signal end of structure information to allow report to write all
        // information out
        visitor.visitEnd();
    }
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:20,代码来源:ReportGenerator.java


示例2: createVisitor

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private IReportVisitor createVisitor(final Locale locale) throws IOException {
    final List<IReportVisitor> visitors = new ArrayList<IReportVisitor>();

    outputDirectory.mkdirs();

    final XMLFormatter xmlFormatter = new XMLFormatter();
    xmlFormatter.setOutputEncoding(outputEncoding);
    visitors.add(xmlFormatter.createVisitor(new FileOutputStream(new File(outputDirectory, "jacoco.xml"))));

    final CSVFormatter csvFormatter = new CSVFormatter();
    csvFormatter.setOutputEncoding(outputEncoding);
    visitors.add(csvFormatter.createVisitor(new FileOutputStream(new File(outputDirectory, "jacoco.csv"))));

    final HTMLFormatter htmlFormatter = new HTMLFormatter();
    htmlFormatter.setOutputEncoding(outputEncoding);
    htmlFormatter.setLocale(locale);
    visitors.add(htmlFormatter.createVisitor(new FileMultiReportOutput(outputDirectory)));

    return new MultiReportVisitor(visitors);
}
 
开发者ID:timezra,项目名称:jacoco-scala-maven-plugin,代码行数:21,代码来源:ReportMojo.java


示例3: createReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createReport(IProgressMonitor monitor) throws CoreException,
    IOException {
  final int work = session.getScope().size();
  monitor.beginTask(
      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();
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:30,代码来源:SessionExporter.java


示例4: createHtmlReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createHtmlReport(final IBundleCoverage bundleCoverage)
        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(sessionInfoStore.getInfos(),
            executionDataStore.getContents());

    // Populate the report structure with the bundle coverage information.
    // Call visitGroup if you need groups in your report.
    MultiSourceFileLocator msf = new MultiSourceFileLocator(4);
    for (File file : sourceDirectories) {
        msf.add(new DirectorySourceFileLocator(
                file, "utf-8", 4));
    }

    visitor.visitBundle(bundleCoverage, msf);

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

}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:30,代码来源:ReportGenerator.java


示例5: createXmlReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createXmlReport(final IBundleCoverage bundleCoverage)
        throws IOException {

    OutputStream fos = new FileOutputStream(xmlOutput);
    try {
        // Create a concrete report visitor based on some supplied
        // configuration. In this case we use the defaults
        final XMLFormatter htmlFormatter = new XMLFormatter();
        final IReportVisitor visitor = htmlFormatter.createVisitor(fos);

        // 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(sessionInfoStore.getInfos(),
                executionDataStore.getContents());

        // Populate the report structure with the bundle coverage information.
        // Call visitGroup if you need groups in your report.
        visitor.visitBundle(bundleCoverage, null);


        // Signal end of structure information to allow report to write all
        // information out
        visitor.visitEnd();
    } finally {
        if (fos != null) {
            fos.close();
        }
    }

}
 
开发者ID:GITNE,项目名称:icedtea-web,代码行数:32,代码来源:ReportGenerator.java


示例6: createReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createReport(final IBundleCoverage bundleCoverage)
		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();

}
 
开发者ID:spideruci,项目名称:tacoco,代码行数:28,代码来源:ReportGenerator.java


示例7: createVisitor

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
IReportVisitor createVisitor(final Locale locale) throws IOException {
    final List<IReportVisitor> visitors = new ArrayList<IReportVisitor>();

    if (getOutputDirectoryFile().exists()) {
        //delete coverage directory if it already exists. To avoid report generation
        // conflicts when two carbon servers are shutting down
        FileUtils.deleteDirectory(new File(getOutputDirectoryFile().getAbsolutePath()));
    }

    if (!getOutputDirectoryFile().mkdirs()) {
        throw new IOException("Failed to create coverage report directory - " + getOutputDirectoryFile());
    }

    final HTMLFormatter htmlFormatter = new HTMLFormatter();
    htmlFormatter.setOutputEncoding(OUTPUT_ENCODING);
    htmlFormatter.setLocale(locale);
    visitors.add(htmlFormatter.createVisitor(new FileMultiReportOutput(getOutputDirectoryFile())));

    final XMLFormatter xmlFormatter = new XMLFormatter();
    xmlFormatter.setOutputEncoding(OUTPUT_ENCODING);
    visitors.add(xmlFormatter.createVisitor(new FileOutputStream(new File(getOutputDirectoryFile(), "jacoco.xml"))));

    final CSVFormatter csvFormatter = new CSVFormatter();
    csvFormatter.setOutputEncoding(OUTPUT_ENCODING);
    visitors.add(csvFormatter.createVisitor(new FileOutputStream(new File(getOutputDirectoryFile(), "jacoco.csv"))));

    return new MultiReportVisitor(visitors);
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:29,代码来源:ReportGenerator.java


示例8: createReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createReport(final IBundleCoverage bundleCoverage)
        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.

    MultiSourceFileLocator locator = new MultiSourceFileLocator(4);
    for (File sourceDirectory : sourceData.getSourceDirectories()) {
        locator.add(new DirectorySourceFileLocator(sourceDirectory, "utf-8", 4));
    }

    visitor.visitBundle(bundleCoverage, locator);

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

}
 
开发者ID:resios,项目名称:jacoco-coverage,代码行数:31,代码来源:ReportGenerator.java


示例9: createReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
@VisibleForTesting
void createReport(
    final IBundleCoverage bundleCoverage, final Map<String, BranchCoverageDetail> branchDetails)
    throws IOException {
  JacocoLCOVFormatter formatter = new JacocoLCOVFormatter(createPathsSet());
  final IReportVisitor visitor = formatter.createVisitor(reportFile, branchDetails);

  // 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.

  // Note the API requires a sourceFileLocator because the HTML and XML formatters display a page
  // of code annotated with coverage information. Having the source files is not actually needed
  // for generating the lcov report...
  visitor.visitBundle(
      bundleCoverage,
      new ISourceFileLocator() {

        @Override
        public Reader getSourceFile(String packageName, String fileName) throws IOException {
          return null;
        }

        @Override
        public int getTabWidth() {
          return 0;
        }
      });

  // Signal end of structure information to allow report to write all information out
  visitor.visitEnd();
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:38,代码来源:JacocoCoverageRunner.java


示例10: toHtmlReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
/**
 * Load a JaCoCo binary report and convert it to HTML.
 * <br/>See <a href="http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java">report generator example code</a>.
 *
 * @param jacocoexec the JaCoCo binary report.
 * @param reportdir the folder to store HTML report.
 * @param prjClassesDir the directory containing project's compiled classes.
 * @param prjSourcesDir the directory containing project's Java source files.
 * @param projectName the project's name.
 * @return the absolute path of HTML report's {@code index.html} file.
 * @throws FileNotFoundException if the JaCoCo binary report, compiled classes or Java sources files directory can't be found.
 * @throws IOException if an I/O error occurs.
 */
public static String toHtmlReport(File jacocoexec, File reportdir, File prjClassesDir, File prjSourcesDir, String projectName)
        throws FileNotFoundException,
               IOException {
    // Load the JaCoCo binary report.
    FileInputStream fis = new FileInputStream(jacocoexec);
    ExecutionDataStore executionDataStore = new ExecutionDataStore();
    SessionInfoStore sessionInfoStore = new SessionInfoStore();
    try {
        ExecutionDataReader executionDataReader = new ExecutionDataReader(fis);
        executionDataReader.setExecutionDataVisitor(executionDataStore);
        executionDataReader.setSessionInfoVisitor(sessionInfoStore);
        while (executionDataReader.read()) {
        }
    } finally {
        fis.close();
    }

    // Convert the binary report to HTML.
    CoverageBuilder coverageBuilder = new CoverageBuilder();
    Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
    analyzer.analyzeAll(prjClassesDir);
    IBundleCoverage bundleCoverage = coverageBuilder.getBundle("JaCoCoverage analysis of project \"" + projectName
            + "\" (powered by JaCoCo from EclEmma)");
    HTMLFormatter htmlformatter = new HTMLFormatter();
    IReportVisitor visitor = htmlformatter.createVisitor(new FileMultiReportOutput(reportdir));
    visitor.visitInfo(sessionInfoStore.getInfos(), executionDataStore.getContents());
    visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(prjSourcesDir, DEF_ENCODING, 4));
    visitor.visitEnd();
    return new File(reportdir, "index.html").getAbsolutePath();
}
 
开发者ID:jonathanlermitage,项目名称:tikione-jacocoverage,代码行数:44,代码来源:JaCoCoReportAnalyzer.java


示例11: toXmlReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
/**
 * Load a JaCoCo binary report and convert it to XML.
 * <br/>See <a href="http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java">report generator example code</a>.
 *
 * @param jacocoexec the JaCoCo binary report.
 * @param xmlreport the XML file to generate.
 * @param prjClassesDir the directory containing project's compiled classes.
 * @param prjSourcesDir the directory containing project's Java source files.
 * @throws FileNotFoundException if the JaCoCo binary report, compiled classes or Java sources files directory can't be found.
 * @throws IOException if an I/O error occurs.
 */
public static void toXmlReport(File jacocoexec, File xmlreport, File prjClassesDir, File prjSourcesDir)
        throws FileNotFoundException,
               IOException {
    // Load the JaCoCo binary report.
    FileInputStream fis = new FileInputStream(jacocoexec);
    ExecutionDataStore executionDataStore = new ExecutionDataStore();
    SessionInfoStore sessionInfoStore = new SessionInfoStore();
    try {
        ExecutionDataReader executionDataReader = new ExecutionDataReader(fis);
        executionDataReader.setExecutionDataVisitor(executionDataStore);
        executionDataReader.setSessionInfoVisitor(sessionInfoStore);
        while (executionDataReader.read()) {
        }
    } finally {
        fis.close();
    }

    // Convert the binary report to XML.
    CoverageBuilder coverageBuilder = new CoverageBuilder();
    Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
    analyzer.analyzeAll(prjClassesDir);
    IBundleCoverage bundleCoverage = coverageBuilder.getBundle("JaCoCoverage analysis (powered by JaCoCo from EclEmma)");
    XMLFormatter xmlformatter = new XMLFormatter();
    xmlformatter.setOutputEncoding(DEF_ENCODING);
    IReportVisitor visitor = xmlformatter.createVisitor(new FileOutputStream(xmlreport));
    visitor.visitInfo(sessionInfoStore.getInfos(), executionDataStore.getContents());
    visitor.visitBundle(bundleCoverage, new DirectorySourceFileLocator(prjSourcesDir, DEF_ENCODING, 4));
    visitor.visitEnd();
}
 
开发者ID:jonathanlermitage,项目名称:tikione-jacocoverage,代码行数:41,代码来源:JaCoCoReportAnalyzer.java


示例12: executeReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:timezra,项目名称:jacoco-scala-maven-plugin,代码行数:13,代码来源:ReportMojo.java


示例13: createReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createReport(final IBundleCoverage bundleCoverage)
                throws IOException {

        // Create a concrete report visitor based on some supplied
        // configuration. In this case we use the defaults
        IReportVisitor visitor;
        switch (reportFormat) {
            case "csv":
                reportDirectory.mkdirs();
                CSVFormatter csvFormatter = new CSVFormatter();
                visitor = csvFormatter.createVisitor(
                    new FileOutputStream(new File(reportDirectory, "coverage.csv")));
                break;

            case "html":
                HTMLFormatter htmlFormatter = new HTMLFormatter();
                visitor = htmlFormatter.createVisitor(
                    new FileMultiReportOutput(reportDirectory));
                break;

            case "xml":
                reportDirectory.mkdirs();
                XMLFormatter xmlFormatter = new XMLFormatter();
                visitor = xmlFormatter.createVisitor(
                    new FileOutputStream(new File(reportDirectory, "coverage.xml")));
                break;

            default:
                throw new RuntimeException("Unable to parse format: " + reportFormat);
        }

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

}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:48,代码来源:ReportGenerator.java


示例14: createReport

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
private void createReport(final IBundleCoverage bundleCoverage) throws IOException {
  Set<String> unknownFormats = Sets.difference(reportFormats, KNOWN_REPORT_FORMATS);
  if (!unknownFormats.isEmpty()) {
    throw new RuntimeException(
        "Unable to parse formats: " + reportFormats.stream().collect(joining(",")));
  }

  // Create a concrete report visitors based on some supplied
  // configuration. In this case we use the defaults
  List<IReportVisitor> visitors = new ArrayList<>();
  if (reportFormats.contains("csv")) {
    reportDirectory.mkdirs();
    CSVFormatter csvFormatter = new CSVFormatter();
    visitors.add(
        csvFormatter.createVisitor(
            new FileOutputStream(new File(reportDirectory, "coverage.csv"))));
  }

  if (reportFormats.contains("html")) {
    HTMLFormatter htmlFormatter = new HTMLFormatter();
    visitors.add(htmlFormatter.createVisitor(new FileMultiReportOutput(reportDirectory)));
  }

  if (reportFormats.contains("xml")) {
    reportDirectory.mkdirs();
    XMLFormatter xmlFormatter = new XMLFormatter();
    visitors.add(
        xmlFormatter.createVisitor(
            new FileOutputStream(new File(reportDirectory, "coverage.xml"))));
  }

  IReportVisitor visitor = new MultiReportVisitor(visitors);
  // 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, createSourceFileLocator());

  // Signal end of structure information to allow report to write all
  // information out
  visitor.visitEnd();
}
 
开发者ID:facebook,项目名称:buck,代码行数:48,代码来源:ReportGenerator.java


示例15: visit

import org.jacoco.report.IReportVisitor; //导入依赖的package包/类
/**
 * Lets a visitor visit the bundle
 *
 * @param visitor
 *          Visitor to visit the bundle
 * @throws IOException
 */
protected void visit(final IReportVisitor visitor) throws IOException {
  visitor.visitInfo(loader.getSessionInfoStore().getInfos(), loader
      .getExecutionDataStore().getContents());
  visitor.visitBundle(bundle, locator);
  visitor.visitEnd();
}
 
开发者ID:quelltextlich,项目名称:jacoco-toolbox,代码行数:14,代码来源:ReportTool.java



注:本文中的org.jacoco.report.IReportVisitor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiExpressionList类代码示例发布时间:2022-05-22
下一篇:
Java TeamException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap