Package org.jacoco.core.runtime

Examples of org.jacoco.core.runtime.RuntimeData


   /**
    *
    */
   private ArquillianRuntime()
   {
        runtimeData = new RuntimeData();
        runtimeData.setSessionId(UUID.randomUUID().toString());
   }
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

  private ClassReader reader;
  private Target target;

  @Before
  public void setup() throws Exception {
    data = new RuntimeData();
    runtime = new SystemPropertiesRuntime();
    runtime.startup(data);
  }
View Full Code Here

   *            logger used by this agent
   */
  Agent(final AgentOptions options, final IExceptionLogger logger) {
    this.options = options;
    this.logger = logger;
    this.data = new RuntimeData();
  }
View Full Code Here

  @Before
  public void setup() throws Exception {
    runtime = new SystemPropertiesRuntime();
    instrumenter = new Instrumenter(runtime);
    runtime.startup(new RuntimeData());
  }
View Full Code Here

    File destFile = folder.newFile("jacoco.exec");
    AgentOptions options = new AgentOptions();
    options.setDestfile(destFile.getAbsolutePath());

    FileOutput controller = new FileOutput();
    controller.startup(options, new RuntimeData());

    assertTrue("Execution data file should be created", destFile.exists());
    assertEquals("Execution data file should be empty", 0,
        destFile.length());
  }
View Full Code Here

    File destFile = folder.newFile("jacoco.exec");
    AgentOptions options = new AgentOptions();
    options.setDestfile(destFile.getAbsolutePath());

    FileOutput controller = new FileOutput();
    controller.startup(options, new RuntimeData());
    controller.writeExecutionData(false);
    controller.shutdown();

    assertTrue("Execution data file should be created", destFile.exists());
    assertTrue("Execution data file should have contents",
View Full Code Here

    AgentOptions options = new AgentOptions();
    options.setDestfile(folder.newFolder("folder").getAbsolutePath());
    FileOutput controller = new FileOutput();

    // Startup should fail as the file can not be created:
    controller.startup(options, new RuntimeData());
  }
View Full Code Here

    source = Source.getSourceFor(target);
  }

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

    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();
View Full Code Here

TOP

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

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.