Package org.jacoco.core.runtime

Examples of org.jacoco.core.runtime.RemoteControlReader


    // Open a socket to the coverage agent:
    final Socket socket = new Socket(InetAddress.getByName(ADDRESS), PORT);
    final RemoteControlWriter writer = new RemoteControlWriter(socket
        .getOutputStream());
    final RemoteControlReader reader = new RemoteControlReader(socket
        .getInputStream());
    reader.setSessionInfoVisitor(localWriter);
    reader.setExecutionDataVisitor(localWriter);

    // Send a dump command and read the response:
    writer.visitDumpCommand(true, false);
    reader.read();

    socket.close();
    localFile.close();
  }
View Full Code Here


      final Socket socket = new Socket(InetAddress.getByName(address),
          port);
      final RemoteControlWriter remoteWriter = new RemoteControlWriter(
          socket.getOutputStream());
      final RemoteControlReader remoteReader = new RemoteControlReader(
          socket.getInputStream());
      final ExecutionDataWriter outputWriter = new ExecutionDataWriter(
          output);
      remoteReader.setSessionInfoVisitor(outputWriter);
      remoteReader.setExecutionDataVisitor(outputWriter);

      remoteWriter.visitDumpCommand(dump, reset);
      // Read session and/or execution data
      remoteReader.read();

      socket.close();
    } catch (final IOException e) {
      throw new BuildException("Unable to dump coverage data", e);
    } finally {
View Full Code Here

    assertEquals(0, mockConnection.getSocketB().getInputStream()
        .available());
  }

  private void readAndAssertData() throws IOException {
    final RemoteControlReader remoteReader = new RemoteControlReader(
        mockConnection.getSocketB().getInputStream());

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    assertTrue(remoteReader.read());

    final List<SessionInfo> infos = infoStore.getInfos();
    assertEquals(1, infos.size());
    assertEquals("stubid", infos.get(0).getId());
View Full Code Here

    assertBlocks(f);

    remoteWriter.visitDumpCommand(false, true);

    final RemoteControlReader remoteReader = new RemoteControlReader(
        mockConnection.getSocketB().getInputStream());

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    assertTrue(remoteReader.read());
    assertTrue(infoStore.getInfos().isEmpty());
    assertTrue(execStore.getContents().isEmpty());
    runtime.assertNoProbes();

    con.close();
View Full Code Here

        return con.getSocketA();
      }
    };
    runtime = new StubRuntime();
    controller.startup(new AgentOptions(), runtime);
    remoteReader = new RemoteControlReader(remoteSocket.getInputStream());
  }
View Full Code Here

  @Test
  public void testWriteExecutionData() throws Exception {
    final Socket socket = serverSocket.connect();
    final RemoteControlWriter remoteWriter = new RemoteControlWriter(
        socket.getOutputStream());
    final RemoteControlReader remoteReader = new RemoteControlReader(
        socket.getInputStream());

    // First process a NOP command to ensure the connection is initialized:
    remoteWriter.visitDumpCommand(false, false);
    remoteReader.read();

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

      final Socket socket = new Socket(InetAddress.getByName(address),
          port);
      log(format("Connecting to %s", socket.getRemoteSocketAddress()));
      final RemoteControlWriter remoteWriter = new RemoteControlWriter(
          socket.getOutputStream());
      final RemoteControlReader remoteReader = new RemoteControlReader(
          socket.getInputStream());

      // 2. Open file output
      output = openOutputStream();
      final ExecutionDataWriter outputWriter = new ExecutionDataWriter(
          output);
      remoteReader.setSessionInfoVisitor(outputWriter);
      remoteReader.setExecutionDataVisitor(outputWriter);

      // 3. Request dump
      remoteWriter.visitDumpCommand(dump, reset);
      remoteReader.read();

      socket.close();

    } catch (final IOException e) {
      throw new BuildException("Unable to dump coverage data", e,
View Full Code Here

  @Test
  public void testWriteExecutionData() throws Exception {
    final Socket socket = serverSocket.connect();
    final RemoteControlWriter remoteWriter = new RemoteControlWriter(
        socket.getOutputStream());
    final RemoteControlReader remoteReader = new RemoteControlReader(
        socket.getInputStream());

    // First process a NOP command to ensure the connection is initialized:
    remoteWriter.visitDumpCommand(false, false);
    remoteReader.read();

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

    assertEquals(0, mockConnection.getSocketB().getInputStream()
        .available());
  }

  private void readAndAssertData() throws IOException {
    final RemoteControlReader remoteReader = new RemoteControlReader(
        mockConnection.getSocketB().getInputStream());

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    assertTrue(remoteReader.read());

    final List<SessionInfo> infos = infoStore.getInfos();
    assertEquals(1, infos.size());
    assertEquals("stubid", infos.get(0).getId());
View Full Code Here

    assertBlocks(f);

    remoteWriter.visitDumpCommand(false, true);

    final RemoteControlReader remoteReader = new RemoteControlReader(
        mockConnection.getSocketB().getInputStream());

    final ExecutionDataStore execStore = new ExecutionDataStore();
    remoteReader.setExecutionDataVisitor(execStore);
    final SessionInfoStore infoStore = new SessionInfoStore();
    remoteReader.setSessionInfoVisitor(infoStore);

    assertTrue(remoteReader.read());
    assertTrue(infoStore.getInfos().isEmpty());
    assertTrue(execStore.getContents().isEmpty());
    runtime.assertNoProbes();

    con.close();
View Full Code Here

TOP

Related Classes of org.jacoco.core.runtime.RemoteControlReader

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.