Package org.jacoco.core.data

Examples of org.jacoco.core.data.ExecutionDataReader


  }

  private void loadExecutionData() throws IOException {
    final FileInputStream fis = new FileInputStream(executionDataFile);
    final ExecutionDataReader executionDataReader = new ExecutionDataReader(
        fis);
    executionDataStore = new ExecutionDataStore();
    sessionInfoStore = new SessionInfoStore();

    executionDataReader.setExecutionDataVisitor(executionDataStore);
    executionDataReader.setSessionInfoVisitor(sessionInfoStore);

    while (executionDataReader.read()) {
    }

    fis.close();
  }
View Full Code Here


      log(format("Loading execution data file %s", resource));

      InputStream resourceStream = null;
      try {
        resourceStream = resource.getInputStream();
        final ExecutionDataReader reader = new ExecutionDataReader(
            resourceStream);
        reader.setSessionInfoVisitor(infoStore);
        reader.setExecutionDataVisitor(dataStore);
        reader.read();
      } catch (final IOException e) {
        throw new BuildException(format("Unable to read %s", resource),
            e, getLocation());
      } finally {
        FileUtils.close(resourceStream);
View Full Code Here

    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

    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

    monitor.beginTask(CoreMessages.ReadingExecutionDataFile_task,
        IProgressMonitor.UNKNOWN);
    try {
      final File f = executiondatafile.toFile();
      final InputStream in = new BufferedInputStream(new FileInputStream(f));
      final ExecutionDataReader reader = new ExecutionDataReader(in);
      reader.setExecutionDataVisitor(executionDataVisitor);
      reader.setSessionInfoVisitor(sessionInfoVisitor);
      while (!monitor.isCanceled() && reader.read()) {
        // nothing here
      }
      in.close();
    } catch (IOException e) {
      throw new CoreException(EclEmmaStatus.EXEC_FILE_READ_ERROR.getStatus(
View Full Code Here

  }

  private void verifyExecContent(IPath path, String... classnames)
      throws Exception {
    final FileInputStream in = new FileInputStream(path.toFile());
    final ExecutionDataReader reader = new ExecutionDataReader(in);
    reader.setSessionInfoVisitor(new SessionInfoStore());
    final ExecutionDataStore store = new ExecutionDataStore();
    reader.setExecutionDataVisitor(store);
    while (reader.read()) {
    }
    in.close();
    final Set<String> actual = new HashSet<String>();
    for (ExecutionData data : store.getContents()) {
      actual.add(data.getName());
View Full Code Here

  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

    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

  @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

  }

  private void loadExecutionData() throws IOException {
    final FileInputStream fis = new FileInputStream(executionDataFile);
    final ExecutionDataReader executionDataReader = new ExecutionDataReader(
        fis);
    executionDataStore = new ExecutionDataStore();
    sessionInfoStore = new SessionInfoStore();

    executionDataReader.setExecutionDataVisitor(executionDataStore);
    executionDataReader.setSessionInfoVisitor(sessionInfoStore);

    while (executionDataReader.read()) {
    }

    fis.close();
  }
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.