Package org.jacoco.core.data

Examples of org.jacoco.core.data.ExecutionDataReader


  private static void dumpContent(final String file) throws IOException {
    System.out.printf("exec file: %s%n", file);
    System.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) {
        System.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) {
        System.out.printf("%016x  %3d of %3d   %s%n",
            Long.valueOf(data.getId()),
            Integer.valueOf(getHitCount(data.getData())),
            Integer.valueOf(data.getData().length), data.getName());
      }
    });
    reader.read();
    in.close();
    System.out.println();
  }
View Full Code Here


          Project.MSG_DEBUG);

      InputStream resourceStream = null;
      try {
        resourceStream = resource.getInputStream();
        final ExecutionDataReader reader = new ExecutionDataReader(
            resourceStream);
        reader.setExecutionDataVisitor(dataStore);
        reader.read();

        numFilesMerged++;
      } catch (final IOException e) {
        throw new BuildException(String.format("Unable to read %s",
            resource.getName()), e);
View Full Code Here

    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

    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

    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

          Project.MSG_DEBUG);

      InputStream resourceStream = null;
      try {
        resourceStream = resource.getInputStream();
        final ExecutionDataReader reader = new ExecutionDataReader(
            resourceStream);
        reader.setSessionInfoVisitor(infoStore);
        reader.setExecutionDataVisitor(dataStore);
        reader.read();

        numFilesMerged++;
      } catch (final IOException e) {
        throw new BuildException(String.format("Unable to read %s",
            resource.getName()), e);
View Full Code Here

        final CoverageSessionInput csi = (CoverageSessionInput) input;
        csi.getSession().readExecutionData(executionData, sessionData,
            new NullProgressMonitor());
      } else {
        final InputStream stream = openStream(input);
        final ExecutionDataReader reader = new ExecutionDataReader(stream);
        reader.setExecutionDataVisitor(executionData);
        reader.setSessionInfoVisitor(sessionData);
        while (reader.read()) {
          // Do nothing
        }
      }
    } catch (CoreException e) {
      EclEmmaUIPlugin.log(e);
View Full Code Here

  private static void dumpContent(final String file) throws IOException {
    System.out.printf("exec file: %s%n", file);
    System.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) {
        System.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) {
        System.out
            .printf("%016x  %3d of %3d   %s%n", Long.valueOf(data
                .getId()), Integer.valueOf(getHitCount(data
                .getData())), Integer
                .valueOf(data.getData().length), data.getName());
      }
    });
    reader.read();
    in.close();
    System.out.println();
  }
View Full Code Here

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

    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

TOP

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

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.