Package org.jacoco.core.instr

Examples of org.jacoco.core.instr.Instrumenter.instrument()


    final IRuntime runtime = new LoggerRuntime();
    ClassReader reader = new ClassReader(TargetLoader.getClassData(target));
    final Instrumenter instr = new Instrumenter(runtime);
    instr.instrument(reader);
    output.writeByteResult("instrumented class",
        instr.instrument(reader).length, reader.b.length);
  }

}
View Full Code Here


  protected Callable<Void> getInstrumentedCallable() throws Exception {
    ClassReader reader = new ClassReader(TargetLoader.getClassData(target));
    IRuntime runtime = new LoggerRuntime();
    runtime.startup(new RuntimeData());
    final Instrumenter instr = new Instrumenter(runtime);
    final byte[] instrumentedBuffer = instr.instrument(reader);
    final TargetLoader loader = new TargetLoader();

    return (Callable<Void>) loader.add(target, instrumentedBuffer)
        .newInstance();
  }
View Full Code Here

  private void testFrames(byte[] source) throws IOException {
    IRuntime runtime = new SystemPropertiesRuntime();
    Instrumenter instrumenter = new Instrumenter(runtime);
    source = calculateFrames(source);
    byte[] actual = instrumenter.instrument(source, "TestTarget");
    byte[] expected = calculateFrames(actual);

    assertEquals(dump(expected), dump(actual));
  }
View Full Code Here

    final IRuntime runtime = new LoggerRuntime();

    // The Instrumenter creates a modified version of our test target class
    // that contains additional probes for execution data recording:
    final Instrumenter instr = new Instrumenter(runtime);
    final byte[] instrumented = instr.instrument(
        getTargetClass(targetName), targetName);

    // Now we're ready to run our instrumented class and need to startup the
    // runtime first:
    final RuntimeData data = new RuntimeData();
View Full Code Here

        OutputStream output = null;
        try {
          FileUtils.copyFile(source, backup);
          input = new FileInputStream(backup);
          output = new FileOutputStream(source);
          instrumenter.instrument(input, output, source.getPath());
        } catch (final IOException e2) {
          throw new MojoExecutionException(
              "Unable to instrument file.", e2);
        } finally {
          IOUtil.close(input);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.