Package org.jacoco.core.instr

Examples of org.jacoco.core.instr.Analyzer


  protected abstract void run(final Class<?> targetClass) throws Exception;

  private void analyze(final ClassReader reader,
      final ExecutionDataStore store) {
    final CoverageBuilder builder = new CoverageBuilder(store);
    final Analyzer analyzer = new Analyzer(builder);
    analyzer.analyzeClass(reader);
    final Collection<ClassCoverage> classes = builder.getClasses();
    assertEquals(1, classes.size(), 0.0);
    classCoverage = classes.iterator().next();
    final Collection<SourceFileCoverage> files = builder.getSourceFiles();
    assertEquals(1, files.size(), 0.0);
View Full Code Here


    if (group.children.size() > 0) {
      return new CoverageNodeImpl(ElementType.GROUP, group.name, false);
    } else {
      final CoverageBuilder builder = new CoverageBuilder(
          executionDataStore);
      final Analyzer analyzer = new Analyzer(builder);
      for (final Iterator<?> i = group.classfiles.iterator(); i.hasNext();) {
        final Resource resource = (Resource) i.next();
        if (resource.isDirectory() && resource instanceof FileResource) {
          analyzer.analyzeAll(((FileResource) resource).getFile());
        } else {
          final InputStream in = resource.getInputStream();
          analyzer.analyzeAll(in);
          in.close();
        }
      }
      return builder.getBundle(group.name);
    }
View Full Code Here

    // Together with the original class definition we can calculate coverage
    // information:
    final CoverageBuilder coverageBuilder = new CoverageBuilder(
        executionData);
    final Analyzer analyzer = new Analyzer(coverageBuilder);
    analyzer.analyzeClass(getTargetClass(targetName));

    // Let's dump some metrics and line coverage information:
    for (final ClassCoverage cc : coverageBuilder.getClasses()) {
      System.out.printf("Coverage of class %s%n", cc.getName());
View Full Code Here

  protected abstract void run(final Class<?> targetClass) throws Exception;

  private void analyze(final ClassReader reader,
      final ExecutionDataStore store) {
    final CoverageBuilder builder = new CoverageBuilder(store);
    final Analyzer analyzer = new Analyzer(builder);
    analyzer.analyzeClass(reader);
    final Collection<ClassCoverage> classes = builder.getClasses();
    assertEquals(1, classes.size(), 0.0);
    classCoverage = classes.iterator().next();
    final Collection<SourceFileCoverage> files = builder.getSourceFiles();
    assertEquals(1, files.size(), 0.0);
View Full Code Here

  protected abstract void run(final Class<?> targetClass) throws Exception;

  private void analyze(final ClassReader reader,
      final ExecutionDataStore store) {
    final CoverageBuilder builder = new CoverageBuilder(store);
    final Analyzer analyzer = new Analyzer(builder);
    analyzer.analyzeClass(reader);
    final Collection<ClassCoverage> classes = builder.getClasses();
    assertEquals(1, classes.size(), 0.0);
    classCoverage = classes.iterator().next();
    final Collection<SourceFileCoverage> files = builder.getSourceFiles();
    assertEquals(1, files.size(), 0.0);
View Full Code Here

    if (group.children.size() > 0) {
      return new CoverageNodeImpl(ElementType.GROUP, group.name, false);
    } else {
      final CoverageBuilder builder = new CoverageBuilder(
          executionDataStore);
      final Analyzer analyzer = new Analyzer(builder);
      for (final Iterator<?> i = group.classfiles.iterator(); i.hasNext();) {
        final Resource resource = (Resource) i.next();
        if (resource.isDirectory() && resource instanceof FileResource) {
          analyzer.analyzeAll(((FileResource) resource).getFile());
        } else {
          final InputStream in = resource.getInputStream();
          analyzer.analyzeAll(in);
          in.close();
        }
      }
      return builder.getBundle(group.name);
    }
View Full Code Here

    return store;
  }

  private void analyze(ClassReader reader, ExecutionDataStore store) {
    final CoverageBuilder builder = new CoverageBuilder(store);
    final Analyzer analyzer = new Analyzer(builder);
    analyzer.analyze(reader);
    final Collection<ClassCoverage> classes = builder.getClasses();
    assertEquals(1, classes.size(), 0.0);
    classCoverage = classes.iterator().next();
    final Collection<SourceFileCoverage> files = builder.getSourceFiles();
    assertEquals(1, files.size(), 0.0);
View Full Code Here

    return store;
  }

  private void analyze(ClassReader reader, ExecutionDataStore store) {
    final CoverageBuilder builder = new CoverageBuilder(store);
    final Analyzer analyzer = new Analyzer(builder);
    analyzer.analyze(reader);
    final Collection<ClassCoverage> classes = builder.getClasses();
    assertEquals(1, classes.size(), 0.0);
    classCoverage = classes.iterator().next();
    final Collection<SourceFileCoverage> files = builder.getSourceFiles();
    assertEquals(1, files.size(), 0.0);
View Full Code Here

    // Together with the original class definition we can calculate coverage
    // information:
    final CoverageBuilder coverageBuilder = new CoverageBuilder(
        executionData);
    final Analyzer analyzer = new Analyzer(coverageBuilder);
    analyzer.analyzeClass(getTargetClass(targetName));

    // Let's dump some metrics and line coverage information:
    for (final ClassCoverage cc : coverageBuilder.getClasses()) {
      System.out.printf("Coverage of class %s%n", cc.getName());
View Full Code Here

      InstantiationException, IllegalAccessException {

    ClassReader reader = new ClassReader(TargetLoader.getClassData(clazz));

    final ClassDataRecorder rec = new ClassDataRecorder();
    final Analyzer analyzer = new Analyzer(rec);
    analyzer.analyze(reader);

    final Instrumenter instr = new Instrumenter(runtime);
    final byte[] instrumentedBuffer = instr.instrument(reader);
    final TargetLoader loader = new TargetLoader(clazz, instrumentedBuffer);
View Full Code Here

TOP

Related Classes of org.jacoco.core.instr.Analyzer

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.