Package org.jacoco.core.data

Examples of org.jacoco.core.data.ExecutionDataWriter


  }

  private String createExecFile() throws IOException {
    File f = File.createTempFile("jacoco", ".exec");
    final FileOutputStream out = new FileOutputStream(f);
    final ExecutionDataWriter writer = new ExecutionDataWriter(out);
    writer.visitSessionInfo(new SessionInfo("testid", 1, 2));
    writer.visitClassExecution(new ExecutionData(0x1234, "foo/MyClass",
        new boolean[] { false, true, true }));
    writer.flush();
    out.close();
    return f.getPath();
  }
View Full Code Here


   *            stream to save content to
   * @throws IOException
   *             in case of problems while writing to the stream
   */
  public void save(final OutputStream stream) throws IOException {
    final ExecutionDataWriter dataWriter = new ExecutionDataWriter(stream);
    sessionInfos.accept(dataWriter);
    executionData.accept(dataWriter);
  }
View Full Code Here

  }

  public byte[] getExecutionData(final boolean reset) {
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    try {
      final ExecutionDataWriter writer = new ExecutionDataWriter(buffer);
      data.collect(writer, writer, reset);
    } catch (final IOException e) {
      // Must not happen with ByteArrayOutputStream
      throw new AssertionError(e);
    }
View Full Code Here

  }

  public void writeExecutionData(final boolean reset) throws IOException {
    final OutputStream output = openFile();
    try {
      final ExecutionDataWriter writer = new ExecutionDataWriter(output);
      data.collect(writer, writer, reset);
    } finally {
      output.close();
    }
  }
View Full Code Here

   *
   * @param args
   * @throws IOException
   */
  public static void main(final String[] args) throws IOException {
    final ExecutionDataWriter fileWriter = new ExecutionDataWriter(
        new FileOutputStream(DESTFILE));
    final ServerSocket server = new ServerSocket(PORT, 0,
        InetAddress.getByName(ADDRESS));
    while (true) {
      final Handler handler = new Handler(server.accept(), fileWriter);
View Full Code Here

  @Test(expected = IOException.class)
  public void testInvalidContent() throws Exception {
    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    new ExecutionDataWriter(remoteOut);
    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();
    remoteOut.write(123);
    con.run();
View Full Code Here

   */
  @Test
  public void testRemoteClose() throws Exception {
    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    new ExecutionDataWriter(remoteOut);

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();

View Full Code Here

   */
  @Test
  public void testLocalClose() throws Exception {
    final OutputStream remoteOut = mockConnection.getSocketB()
        .getOutputStream();
    new ExecutionDataWriter(remoteOut);

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), data);
    con.init();

View Full Code Here

   * @param args
   * @throws IOException
   */
  public static void main(final String[] args) throws IOException {
    final FileOutputStream localFile = new FileOutputStream(DESTFILE);
    final ExecutionDataWriter localWriter = new ExecutionDataWriter(
        localFile);

    // Open a socket to the coverage agent:
    final Socket socket = new Socket(InetAddress.getByName(ADDRESS), PORT);
    final RemoteControlWriter writer = new RemoteControlWriter(
View Full Code Here

  }

  @Test
  public void testShutdownWithConnection() throws Exception {
    serverSocket.waitForAccept();
    new ExecutionDataWriter(serverSocket.connect().getOutputStream());
    controller.shutdown();
    logger.assertNoException();
  }
View Full Code Here

TOP

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

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.