Package org.jacoco.core.test

Examples of org.jacoco.core.test.TargetLoader


    ClassReader reader = new ClassReader(TargetLoader.getClassData(target));
    IRuntime runtime = new LoggerRuntime();
    runtime.startup();
    final Instrumenter instr = new Instrumenter(runtime);
    final byte[] instrumentedBuffer = instr.instrument(reader);
    final TargetLoader loader = new TargetLoader(target, instrumentedBuffer);

    return (Runnable) loader.newTargetInstance();
  }
View Full Code Here


    gen.visitMaxs(3, 0);
    gen.visitEnd();

    writer.visitEnd();

    final TargetLoader loader = new TargetLoader(className
        .replace('/', '.'), writer.toByteArray());
    return (ITarget) loader.newTargetInstance();
  }
View Full Code Here

    mv.visitInsn(Opcodes.ARETURN);
    mv.visitMaxs(5, 1);
    mv.visitEnd();

    writer.visitEnd();
    final TargetLoader loader = new TargetLoader("Sample", writer
        .toByteArray());
    Callable<?> callable = (Callable<?>) loader.newTargetInstance();
    final Object[] args = (Object[]) callable.call();
    assertEquals(3, args.length, 0.0);
    assertEquals(Long.valueOf(1000), args[0]);
    assertEquals("Sample", args[1]);
    assertEquals(Integer.valueOf(15), args[2]);
View Full Code Here

    writer.visitField(Opcodes.ACC_PRIVATE, "access", "Ljava/lang/Object;",
        null, null);

    writer.visitEnd();
    final TargetLoader loader = new TargetLoader("Sample", writer
        .toByteArray());
    Callable<?> callable = (Callable<?>) loader.getTargetClass()
        .getConstructor(Object.class).newInstance(access);
    assertSame(data, callable.call());
  }
View Full Code Here

  private ExecutionDataStore execute(final ClassReader reader)
      throws Exception {
    IRuntime runtime = new SystemPropertiesRuntime();
    runtime.startup();
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(target, bytes);
    run(loader.getTargetClass());
    final ExecutionDataStore store = new ExecutionDataStore();
    runtime.collect(store, null, false);
    runtime.shutdown();
    return store;
  }
View Full Code Here

    gen.visitMaxs(3, 0);
    gen.visitEnd();

    writer.visitEnd();

    final TargetLoader loader = new TargetLoader(className
        .replace('/', '.'), writer.toByteArray());
    return (ITarget) loader.newTargetInstance();
  }
View Full Code Here

  private ExecutionDataStore execute(final ClassReader reader)
      throws Exception {
    IRuntime runtime = new SystemPropertiesRuntime();
    runtime.startup();
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(target, bytes);
    run(loader.getTargetClass());
    final ExecutionDataStore store = new ExecutionDataStore();
    runtime.collect(store, false);
    runtime.shutdown();
    return store;
  }
View Full Code Here

    gen.visitMaxs(1, 0);
    gen.visitEnd();

    writer.visitEnd();

    final TargetLoader loader = new TargetLoader();
    return (ITarget) loader.add(className.replace('/', '.'),
        writer.toByteArray()).newInstance();
  }
View Full Code Here

    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 instrument(final Class<? extends Target> clazz)
      throws Exception {
    reader = new ClassReader(TargetLoader.getClassData(clazz));
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader();
    target = (Target) loader.add(clazz, bytes).newInstance();
  }
View Full Code Here

TOP

Related Classes of org.jacoco.core.test.TargetLoader

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.