Examples of ExecutionDataReader


Examples of org.jacoco.core.data.ExecutionDataReader

    sessionInfoStore = new SessionInfoStore();
    executionDataStore = new ExecutionDataStore();
    FileInputStream in = null;
    try {
      in = new FileInputStream(dataFile);
      final ExecutionDataReader reader = new ExecutionDataReader(in);
      reader.setSessionInfoVisitor(sessionInfoStore);
      reader.setExecutionDataVisitor(executionDataStore);
      reader.read();
    } finally {
      if (in != null) {
        in.close();
      }
    }
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

    for (final Iterator<?> i = executiondataElement.iterator(); i.hasNext();) {
      final Resource resource = (Resource) i.next();
      InputStream in = null;
      try {
        in = new BufferedInputStream(resource.getInputStream());
        final ExecutionDataReader reader = new ExecutionDataReader(in);
        reader.setSessionInfoVisitor(sessionInfoStore);
        reader.setExecutionDataVisitor(executionDataStore);
        reader.read();
      } catch (final IOException e) {
        throw new BuildException("Unable to read execution data file "
            + resource.getName(), e);
      } finally {
        FileUtils.close(in);
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

  private void assertFileContents(File file, String... expected)
      throws IOException {
    final InputStream in = new FileInputStream(file);
    final ExecutionDataStore execStore = new ExecutionDataStore();
    final SessionInfoStore sessionStore = new SessionInfoStore();
    final ExecutionDataReader reader = new ExecutionDataReader(in);
    reader.setExecutionDataVisitor(execStore);
    reader.setSessionInfoVisitor(sessionStore);
    reader.read();
    assertContents(execStore, sessionStore, expected);
  }
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

    agent.startup();
    agent.setSessionId("agenttestid");
    assertEquals("agenttestid", agent.getSessionId());

    SessionInfoStore sessionStore = new SessionInfoStore();
    ExecutionDataReader reader = new ExecutionDataReader(
        new ByteArrayInputStream(agent.getExecutionData(false)));
    reader.setSessionInfoVisitor(sessionStore);
    reader.read();
    assertEquals("agenttestid", sessionStore.getInfos().get(0).getId());
  }
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

    assertFalse(probes[0]);

    ExecutionDataStore execStore = new ExecutionDataStore();
    SessionInfoStore sessionStore = new SessionInfoStore();

    ExecutionDataReader reader = new ExecutionDataReader(
        new ByteArrayInputStream(data));
    reader.setExecutionDataVisitor(execStore);
    reader.setSessionInfoVisitor(sessionStore);
    reader.read();

    assertEquals("Foo", execStore.get(0x12345678).getName());
    assertEquals(1, sessionStore.getInfos().size());
    assertEquals("agenttestid", sessionStore.getInfos().get(0).getId());
  }
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

   *            Stream to read data from
   * @throws IOException
   *             in case of problems while reading from the stream
   */
  public void load(final InputStream stream) throws IOException {
    final ExecutionDataReader reader = new ExecutionDataReader(
        new BufferedInputStream(stream));
    reader.setExecutionDataVisitor(executionData);
    reader.setSessionInfoVisitor(sessionInfos);
    reader.read();
  }
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

  private void dump(final String file) throws IOException {
    out.printf("exec file: %s%n", file);
    out.println("CLASS ID         HITS/PROBES   CLASS NAME");

    final FileInputStream in = new FileInputStream(file);
    final ExecutionDataReader reader = new ExecutionDataReader(in);
    reader.setSessionInfoVisitor(new ISessionInfoVisitor() {
      public void visitSessionInfo(final SessionInfo info) {
        out.printf("Session \"%s\": %s - %s%n", info.getId(), new Date(
            info.getStartTimeStamp()),
            new Date(info.getDumpTimeStamp()));
      }
    });
    reader.setExecutionDataVisitor(new IExecutionDataVisitor() {
      public void visitClassExecution(final ExecutionData data) {
        out.printf("%016x  %3d of %3d   %s%n",
            Long.valueOf(data.getId()),
            Integer.valueOf(getHitCount(data.getProbes())),
            Integer.valueOf(data.getProbes().length),
            data.getName());
      }
    });
    reader.read();
    in.close();
    out.println();
  }
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

    assertEquals("MyClass", execStore.get(123).getName());
  }

  @Test
  public void testReadFrom() throws Exception {
    ExecutionDataReader reader = new ExecutionDataReader(
        new ByteArrayInputStream(createSessionData()));
    source.readFrom(reader);

    SessionInfoStore sessionStore = new SessionInfoStore();
    ExecutionDataStore execStore = new ExecutionDataStore();
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

    assertEquals(1, execfiles.length);
    final File execfile = execfiles[0];
    assertTrue(execfile.exists());
    assertTrue(execfile.isFile());

    final ExecutionDataReader reader = new ExecutionDataReader(
        new FileInputStream(execfile));
    final SessionInfoStore sessionInfoStore = new SessionInfoStore();
    final ExecutionDataStore executionDataStore = new ExecutionDataStore();
    reader.setSessionInfoVisitor(sessionInfoStore);
    reader.setExecutionDataVisitor(executionDataStore);
    reader.read();

    assertEquals("id", sessionInfoStore.getInfos().get(0).getId());
    assertEquals("MyClass", executionDataStore.get(123).getName());
  }
View Full Code Here

Examples of org.jacoco.core.data.ExecutionDataReader

  public void accept(IExecutionDataVisitor executionDataVisitor,
      ISessionInfoVisitor sessionInfoVisitor) throws CoreException {
    try {
      final InputStream in = new BufferedInputStream(url.openStream());
      final ExecutionDataReader reader = new ExecutionDataReader(in);
      reader.setExecutionDataVisitor(executionDataVisitor);
      reader.setSessionInfoVisitor(sessionInfoVisitor);
      reader.read();
      in.close();
    } catch (IOException e) {
      throw new CoreException(EclEmmaStatus.EXEC_FILE_READ_ERROR.getStatus(url,
          e));
    }
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.