All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pitest.coverage.execute.SendData Maven / Gradle / Ivy

There is a newer version: 1.17.1
Show newest version
package org.pitest.coverage.execute;

import java.util.List;
import java.util.function.Consumer;
import java.util.logging.Logger;

import org.pitest.util.Log;
import org.pitest.util.SafeDataOutputStream;

final class SendData implements Consumer {
  private static final Logger   LOG = Log.getLogger();
  private final CoverageOptions arguments;
  private final List    testClasses;

  SendData(final CoverageOptions arguments, final List testClasses) {
    this.arguments = arguments;
    this.testClasses = testClasses;
  }

  @Override
  public void accept(final SafeDataOutputStream dos) {
    sendArguments(dos);
    sendTests(dos);
  }

  private void sendArguments(final SafeDataOutputStream dos) {
    dos.write(this.arguments);
    dos.flush();
  }

  private void sendTests(final SafeDataOutputStream dos) {

    // send individually to reduce memory overhead of deserializing large
    // suite
    LOG.info("Sending " + this.testClasses.size() + " test classes to minion");
    dos.writeInt(this.testClasses.size());
    for (final String tc : this.testClasses) {
      dos.writeString(tc);
    }
    dos.flush();
    LOG.info("Sent tests to minion");

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy