Package org.jacoco.core.runtime

Examples of org.jacoco.core.runtime.LoggerRuntime


  private IRuntime runtime;

  @Before
  public void setup() {
    runtime = new LoggerRuntime();
    runtime.startup();
  }
View Full Code Here


  private ClassInstrumenter instrumenter;

  @Before
  public void setup() {
    runtime = new LoggerRuntime();
    instrumenter = new ClassInstrumenter(123, runtime, new EmptyVisitor());
  }
View Full Code Here

    int c;
    while ((c = in.read()) != -1) {
      out.write(c);
    }
    final byte[] buffer = out.toByteArray();
    final IRuntime runtime = new LoggerRuntime();
    return new Runnable() {

      public void run() {
        for (int i = 0; i < count; i++) {
          ClassReader reader = new ClassReader(buffer);
View Full Code Here

  public InstrumentationSizeSzenario(Class<?> target) {
    this.target = target;
  }

  public void run(IPerfOutput output) throws Exception {
    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

   * Creates the specific coverage runtime implementation.
   *
   * @return coverage runtime instance
   */
  protected IRuntime createRuntime() {
    return new LoggerRuntime();
  }
View Full Code Here

  }

  @Override
  protected Callable<Void> getInstrumentedCallable() throws Exception {
    final byte[] bytes = TargetLoader.getClassDataAsBytes(target);
    final Instrumenter instr = new Instrumenter(new LoggerRuntime());
    return new Callable<Void>() {
      public Void call() throws Exception {
        for (int i = 0; i < count; i++) {
          instr.instrument(bytes, "TestTarget");
        }
View Full Code Here

  public InstrumentationSizeSzenario(Class<?> target) {
    this.target = target;
  }

  public void run(IPerfOutput output) throws Exception {
    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

  @Override
  @SuppressWarnings("unchecked")
  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)
View Full Code Here

  public void execute() throws Exception {
    final String targetName = TestTarget.class.getName();

    // For instrumentation and runtime we need a IRuntime instance
    // to collect execution data:
    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();
    runtime.startup(data);

    // In this tutorial we use a special class loader to directly load the
    // instrumented class definition from a byte[] instances.
    final MemoryClassLoader memoryClassLoader = new MemoryClassLoader();
    memoryClassLoader.addDefinition(targetName, instrumented);
    final Class<?> targetClass = memoryClassLoader.loadClass(targetName);

    // Here we execute our test target class through its Runnable interface:
    final Runnable targetInstance = (Runnable) targetClass.newInstance();
    targetInstance.run();

    // At the end of test execution we collect execution data and shutdown
    // the runtime:
    final ExecutionDataStore executionData = new ExecutionDataStore();
    final SessionInfoStore sessionInfos = new SessionInfoStore();
    data.collect(executionData, sessionInfos, false);
    runtime.shutdown();

    // Together with the original class definition we can calculate coverage
    // information:
    final CoverageBuilder coverageBuilder = new CoverageBuilder();
    final Analyzer analyzer = new Analyzer(executionData, coverageBuilder);
View Full Code Here

TOP

Related Classes of org.jacoco.core.runtime.LoggerRuntime

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.