Package org.jacoco.core.data

Examples of org.jacoco.core.data.SessionInfoStore


    // Now the actual test starts:
    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());

    logger.assertEmpty();
    controller.shutdown();
View Full Code Here


          getLocation());
    }
  }

  private void loadExecutionData() {
    sessionInfoStore = new SessionInfoStore();
    executionDataStore = new ExecutionDataStore();
    for (final Iterator<?> i = executiondataElement.iterator(); i.hasNext();) {
      final Resource resource = (Resource) i.next();
      log(format("Loading execution data file %s", resource));
      InputStream in = null;
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()) {
View Full Code Here

    if (destfile == null) {
      throw new BuildException("Destination file must be supplied",
          getLocation());
    }

    final SessionInfoStore infoStore = new SessionInfoStore();
    final ExecutionDataStore dataStore = new ExecutionDataStore();

    loadSourceFiles(infoStore, dataStore);

    OutputStream outputStream = null;
    try {
      FileUtils.getFileUtils().createNewFile(destfile, true);

      outputStream = new BufferedOutputStream(new FileOutputStream(
          destfile));
      final ExecutionDataWriter dataWriter = new ExecutionDataWriter(
          outputStream);
      infoStore.accept(dataWriter);
      dataStore.accept(dataWriter);
    } catch (final IOException e) {
      throw new BuildException(format("Unable to write merged file %s",
          destfile.getAbsolutePath()), e, getLocation());
    } finally {
View Full Code Here

    final Collection<IPackageFragmentRoot> roots = session.getScope();
    monitor.beginTask(
        NLS.bind(CoreMessages.AnalyzingCoverageSession_task,
            session.getDescription()), 1 + roots.size());
    executiondatastore = new ExecutionDataStore();
    sessioninfostore = new SessionInfoStore();
    session.accept(executiondatastore, sessioninfostore);
    monitor.worked(1);

    final PackageFragementRootAnalyzer analyzer = new PackageFragementRootAnalyzer(
        executiondatastore);
View Full Code Here

    SessionInfo info = new SessionInfo("id1", 1, 2);
    source.visitSessionInfo(info);
    source.visitClassExecution(new ExecutionData(123, "MyClass", new boolean[] {
        true, false }));

    SessionInfoStore sessionStore = new SessionInfoStore();
    ExecutionDataStore execStore = new ExecutionDataStore();
    source.accept(execStore, sessionStore);

    assertEquals(Collections.singletonList(info), sessionStore.getInfos());
    assertEquals("MyClass", execStore.get(123).getName());
  }
View Full Code Here

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

    SessionInfoStore sessionStore = new SessionInfoStore();
    ExecutionDataStore execStore = new ExecutionDataStore();
    source.accept(execStore, sessionStore);

    assertEquals(1, sessionStore.getInfos().size());
    assertEquals("MyClass", execStore.get(123).getName());
  }
View Full Code Here

    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

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

    this.files = files;
    this.dataReceived = false;
  }

  public IPath dump() throws IOException, CoreException {
    final SessionInfoStore sessionInfos = new SessionInfoStore();
    final ExecutionDataStore executionData = new ExecutionDataStore();
    reader.setSessionInfoVisitor(sessionInfos);
    reader.setExecutionDataVisitor(executionData);
    reader.read();
    if (sessionInfos.isEmpty()) {
      return null;
    }
    dataReceived = true;
    return createDataFile(sessionInfos, executionData);
  }
View Full Code Here

TOP

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

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.