Package org.jacoco.core.data

Examples of org.jacoco.core.data.ExecutionDataStore


  /**
   * Creates a new runtime.
   */
  protected AbstractRuntime() {
    store = new ExecutionDataStore();
    access = new ExecutionDataAccess(store);
    sessionId = createRandomId();
  }
View Full Code Here


    final Collection<SessionInfo> infos = sessionData.getInfos();
    return infos.toArray(new SessionInfo[infos.size()]);
  }

  private void clear() {
    executionData = new ExecutionDataStore();
    sessionData = new SessionInfoStore();
  }
View Full Code Here

    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();
    runtime.collect(executionData, null, false);
    runtime.shutdown();

    // Together with the original class definition we can calculate coverage
    // information:
View Full Code Here

    target = (Target) loader.getTargetClass().newInstance();
  }

  private ICounter analyze() {
    final CoverageBuilder builder = new CoverageBuilder();
    final ExecutionDataStore store = new ExecutionDataStore();
    runtime.collect(store, null, false);
    final Analyzer analyzer = new Analyzer(store, builder);
    analyzer.analyzeClass(reader);
    final Collection<IClassCoverage> classes = builder.getClasses();
    assertEquals(1, classes.size(), 0.0);
View Full Code Here

  private void readAndAssertData() throws IOException {
    final RemoteControlReader remoteReader = new RemoteControlReader(
        mockConnection.getSocketB().getInputStream());

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    assertTrue(remoteReader.read());

    final List<SessionInfo> infos = infoStore.getInfos();
    assertEquals(1, infos.size());
    assertEquals("stubid", infos.get(0).getId());

    assertEquals("Foo", execStore.get(0x12345678).getName());
  }
View Full Code Here

    remoteWriter.visitDumpCommand(false, true);

    final RemoteControlReader remoteReader = new RemoteControlReader(
        mockConnection.getSocketB().getInputStream());

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    assertTrue(remoteReader.read());
    assertTrue(infoStore.getInfos().isEmpty());
    assertTrue(execStore.getContents().isEmpty());
    runtime.assertNoProbes();

    con.close();
    f.get();
  }
View Full Code Here

  public void testDump() throws Exception {
    final byte[] dump = controller.dump(false);
    final ByteArrayInputStream input = new ByteArrayInputStream(dump);

    final ExecutionDataReader reader = new ExecutionDataReader(input);
    final ExecutionDataStore execStore = new ExecutionDataStore();
    reader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    reader.setSessionInfoVisitor(infoStore);
    reader.read();

    assertEquals("Foo", execStore.get(0x12345678).getName());

    final List<SessionInfo> infos = infoStore.getInfos();
    assertEquals(1, infos.size());
    assertEquals("stubid", infos.get(0).getId());
View Full Code Here

  private Object access;

  @Before
  public void setup() {
    store = new ExecutionDataStore();
    access = new ExecutionDataAccess(store);
  }
View Full Code Here

    }
  }

  private void loadExecutionData() {
    sessionInfoStore = new SessionInfoStore();
    executionDataStore = new ExecutionDataStore();
    for (final Iterator<?> i = executiondataElement.iterator(); i.hasNext();) {
      final Resource resource = (Resource) i.next();
      InputStream in = null;
      try {
        in = new BufferedInputStream(resource.getInputStream());
View Full Code Here

  @Test
  public void testWriteExecutionData() throws Exception {
    controller.writeExecutionData();

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    remoteReader.read();

    assertEquals("Foo", execStore.get(0x12345678).getName());

    final List<SessionInfo> infos = infoStore.getInfos();
    assertEquals(1, infos.size());
    assertEquals("stubid", infos.get(0).getId());
View Full Code Here

TOP

Related Classes of org.jacoco.core.data.ExecutionDataStore

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.