Package org.jacoco.core.runtime

Examples of org.jacoco.core.runtime.RemoteControlWriter


    f.get();
  }

  @Test
  public void testLocalDump() throws Exception {
    new RemoteControlWriter(mockConnection.getSocketB().getOutputStream());

    final TcpConnection con = new TcpConnection(
        mockConnection.getSocketA(), runtime);
    con.init();
View Full Code Here


  @Test
  public void testRemoteReset() throws Exception {
    runtime.fillProbes();

    final RemoteControlWriter remoteWriter = new RemoteControlWriter(
        mockConnection.getSocketB().getOutputStream());

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

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.run();
        return null;
      }
    });

    assertBlocks(f);

    remoteWriter.visitDumpCommand(false, true);

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

    final ExecutionDataStore execStore = new ExecutionDataStore();
View Full Code Here

  @Before
  public void setup() throws Exception {
    logger = new ExceptionRecorder();
    final MockSocketConnection con = new MockSocketConnection();
    remoteSocket = con.getSocketB();
    remoteWriter = new RemoteControlWriter(remoteSocket.getOutputStream());
    controller = new TcpClientController(logger) {
      @Override
      protected Socket createSocket(AgentOptions options)
          throws IOException {
        return con.getSocketA();
View Full Code Here

    this.runtime = runtime;
    this.initialized = false;
  }

  public void init() throws IOException {
    this.writer = new RemoteControlWriter(socket.getOutputStream());
    this.reader = new RemoteControlReader(socket.getInputStream());
    this.reader.setRemoteCommandVisitor(this);
    this.initialized = true;
  }
View Full Code Here

    this.runtime = runtime;
    this.initialized = false;
  }

  public void init() throws IOException {
    this.writer = new RemoteControlWriter(socket.getOutputStream());
    this.reader = new RemoteControlReader(socket.getInputStream());
    this.reader.setRemoteCommandVisitor(this);
    this.initialized = true;
  }
View Full Code Here

  public ExecFileLoader dump(final InetAddress address, final int port)
      throws IOException {
    final ExecFileLoader loader = new ExecFileLoader();
    final Socket socket = tryConnect(address, port);
    try {
      final RemoteControlWriter remoteWriter = new RemoteControlWriter(
          socket.getOutputStream());
      final RemoteControlReader remoteReader = new RemoteControlReader(
          socket.getInputStream());
      remoteReader.setSessionInfoVisitor(loader.getSessionInfoStore());
      remoteReader
          .setExecutionDataVisitor(loader.getExecutionDataStore());

      remoteWriter.visitDumpCommand(dump, reset);
      remoteReader.read();

    } finally {
      socket.close();
    }
View Full Code Here

    this.data = data;
    this.initialized = false;
  }

  public void init() throws IOException {
    this.writer = new RemoteControlWriter(socket.getOutputStream());
    this.reader = new RemoteControlReader(socket.getInputStream());
    this.reader.setRemoteCommandVisitor(this);
    this.initialized = true;
  }
View Full Code Here

    }).start();
    return server.getLocalPort();
  }

  private void handleConnection(Socket socket) throws IOException {
    final RemoteControlWriter writer = new RemoteControlWriter(
        socket.getOutputStream());
    final RemoteControlReader reader = new RemoteControlReader(
        socket.getInputStream());
    reader.setRemoteCommandVisitor(new IRemoteCommandVisitor() {
      public void visitDumpCommand(boolean dump, boolean reset)
          throws IOException {
        dumpRequested = dump;
        resetRequested = reset;
        if (dump) {
          writer.visitSessionInfo(new SessionInfo("TestId", 100, 200));
        }
        writer.sendCmdOk();
      }
    });
    reader.read();
  }
View Full Code Here

        throws IOException {
      this.socket = socket;
      this.fileWriter = fileWriter;

      // Just send a valid header:
      new RemoteControlWriter(socket.getOutputStream());

      reader = new RemoteControlReader(socket.getInputStream());
      reader.setSessionInfoVisitor(this);
      reader.setExecutionDataVisitor(this);
    }
View Full Code Here

  @Test
  public void testRemoteDump() throws Exception {
    data.getExecutionData(Long.valueOf(0x12345678), "Foo", 42);
    data.setSessionId("stubid");

    final RemoteControlWriter remoteWriter = new RemoteControlWriter(
        mockConnection.getSocketB().getOutputStream());

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

    final Future<Void> f = executor.submit(new Callable<Void>() {
      public Void call() throws Exception {
        con.run();
        return null;
      }
    });

    assertBlocks(f);

    remoteWriter.visitDumpCommand(true, false);
    readAndAssertData();

    con.close();
    f.get();
  }
View Full Code Here

TOP

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

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.