本文整理汇总了Java中org.jacoco.core.analysis.IBundleCoverage类的典型用法代码示例。如果您正苦于以下问题:Java IBundleCoverage类的具体用法?Java IBundleCoverage怎么用?Java IBundleCoverage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBundleCoverage类属于org.jacoco.core.analysis包,在下文中一共展示了IBundleCoverage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
/**
* Create the report.
*
* @throws IOException
*/
public void execute() throws IOException {
// Read the jacoco.exec file. Multiple data stores could be merged
// at this point
loadExecutionData();
// Run the structure analyzer on a single class folder to build up
// the coverage model. The process would be similar if your classes
// were in a jar file. Typically you would create a bundle for each
// class folder and each jar you want in your report. If you have
// more than one bundle you will need to add a grouping node to your
// report
final IBundleCoverage bundleCoverage = analyzeStructure();
if (reportDirectory != null) {
createHtmlReport(bundleCoverage);
}
if (xmlOutput != null) {
createXmlReport(bundleCoverage);
}
}
示例2: printCoverage
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
private void printCoverage(IBundleCoverage coverage) {
ICoveragePrintable printer =
new CoverageJsonPrinter(coverage, printManager.jsonOut(),
printManager.isPrettyPrint(), printManager.format());
PrintStream out = printManager.jsonOut();
if(count == 0) {
out.print('[');
}
printer.printCoverage();
if(this.coverageTitle == null
|| this.coverageTitle.isEmpty()
|| this.coverageTitle.equals("end")) {
out.print("]");
} else {
out.println(",");
}
System.out.printf("completed printing coverage bundle for %s.%n", coverage.getName());
System.out.printf("completed printing %d coverage bundle(s).%n%n", ++count);
}
示例3: create
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
/**
* Create the report.
*
* @throws IOException
*/
public void create() throws IOException {
// Read the jacoco.exec file. Multiple data files could be merged
// at this point
loadExecutionData();
// Run the structure analyzer on a single class folder to build up
// the coverage model. The process would be similar if your classes
// were in a jar file. Typically you would create a bundle for each
// class folder and each jar you want in your report. If you have
// more than one bundle you will need to add a grouping node to your
// report
final IBundleCoverage bundleCoverage = analyzeStructure();
createReport(bundleCoverage);
}
示例4: createReport
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的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();
}
示例5: create
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
/**
* Create the report.
*
* @throws IOException
*/
public void create() throws IOException {
// Read the jacoco.exec file. Multiple data files could be merged
// at this point
loadExecutionData();
// Run the structure analyzer on a single class folder to build up
// the coverage model. The process would be similar if your classes
// were in a jar file. Typically you would create a bundle for each
// class folder and each jar you want in your report. If you have
// more than one bundle you will need to add a grouping node to your
// report
final IBundleCoverage bundleCoverage = analyzeStructure();
createReport(bundleCoverage);
}
示例6: analyzeStructure
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
@VisibleForTesting
IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
Set<String> alreadyInstrumentedClasses = new HashSet<>();
for (File classesJar : classesJars) {
if (isNewCoverageImplementation) {
analyzeUninstrumentedClassesFromJar(analyzer, classesJar, alreadyInstrumentedClasses);
} else {
analyzer.analyzeAll(classesJar);
}
}
// TODO(bazel-team): Find out where the name of the bundle can pop out in the report.
return coverageBuilder.getBundle("isthisevenused");
}
示例7: create
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
/**
* Create the report.
*
* @throws IOException
*/
public void create() throws IOException {
// Read the jacoco.exec file. Multiple data files could be merged
// at this point
loadExecutionData();
// Run the structure analyzer on a single class folder to build up
// the coverage model. The process would be similar if your classes
// were in a jar file. Typically you would create a bundle for each
// class folder and each jar you want in your report. If you have
// more than one bundle you will need to add a grouping node to your
// report
final IBundleCoverage bundleCoverage = analyzeStructure();
createReport(bundleCoverage);
}
示例8: processNBModule
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
public void processNBModule(String projectName, List<String> classDirectories, List<String> sourceDirectories) throws IOException {
CoverageBuilder coverageBuilder = new CoverageBuilder();
Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
for (String classDirectory : classDirectories) {
analyzer.analyzeAll(new File(classDirectory));
}
IBundleCoverage bundleCoverage = coverageBuilder.getBundle(projectName);
MultiSourceFileLocator sourceLocator = new MultiSourceFileLocator(4);
for (String sourceDirectory : sourceDirectories) {
sourceLocator.add(new DirectorySourceFileLocator(new File(sourceDirectory), DEF_ENCODING, 4));
}
groupVisitor.visitBundle(bundleCoverage, sourceLocator);
}
示例9: create
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
/**
* Create the report.
*
* @throws IOException
*/
public void create() throws IOException {
// Read the jacoco.exec file. Multiple data files could be merged
// at this point
loadExecutionData();
// Run the structure analyzer on a single class folder to build up
// the coverage model. The process would be similar if your classes
// were in a jar file. Typically you would create a bundle for each
// class folder and each jar you want in your report. If you have
// more than one bundle you will need to add a grouping node to your
// report
final IBundleCoverage bundleCoverage = analyzeStructure();
createReport(bundleCoverage);
}
示例10: analyzeStructure
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
private IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(execFileLoader.getExecutionDataStore(), coverageBuilder);
String[] classesDirs = classesPath.split(":");
for (String classesDir : classesDirs) {
File classesDirFile = new File(classesDir);
if (classesDirFile.exists()) {
for (File clazz : FileUtils.getFiles(classesDirFile, coverageIncludes, coverageExcludes)) {
analyzer.analyzeAll(clazz);
}
}
}
return coverageBuilder.getBundle(title);
}
示例11: createReport
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的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();
}
示例12: processPackageFragmentRoot
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
private void processPackageFragmentRoot(IPackageFragmentRoot root,
PackageFragementRootAnalyzer analyzer, IProgressMonitor monitor)
throws CoreException {
final TypeVisitor visitor = new TypeVisitor(analyzer.analyze(root));
new TypeTraverser(root).process(visitor, monitor);
final IBundleCoverage bundle = new BundleCoverageImpl(getName(root),
visitor.getClasses(), visitor.getSources());
modelcoverage.putFragmentRoot(root, bundle);
putPackages(bundle.getPackages(), root);
}
示例13: createHtmlReport
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的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();
}
示例14: createXmlReport
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的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();
}
}
}
示例15: analyzeStructure
import org.jacoco.core.analysis.IBundleCoverage; //导入依赖的package包/类
private IBundleCoverage analyzeStructure() throws IOException {
final CoverageBuilder coverageBuilder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(executionDataStore,
coverageBuilder);
for (File file : classesDirectories) {
analyzer.analyzeAll(file);
}
return coverageBuilder.getBundle(title);
}