Package org.jacoco.core.runtime

Examples of org.jacoco.core.runtime.AgentOptions


  private StubRuntime runtime;

  @Before
  public void setup() {
    recorder = new ExceptionRecorder();
    options = new AgentOptions();
    classLoader = getClass().getClassLoader();
    runtime = new StubRuntime();
  }
View Full Code Here


   *             in case initialization fails
   */
  public static void premain(final String options, final Instrumentation inst)
      throws Exception {

    final AgentOptions agentOptions = new AgentOptions(options);

    final Agent agent = Agent.getInstance(agentOptions);

    final IRuntime runtime = createRuntime(inst);
    runtime.startup(agent.getData());
View Full Code Here

  public TemporaryFolder folder = new TemporaryFolder();

  @Test
  public void testCreateDestFileOnStartup() throws Exception {
    File destFile = folder.newFile("jacoco.exec");
    AgentOptions options = new AgentOptions();
    options.setDestfile(destFile.getAbsolutePath());

    FileOutput controller = new FileOutput();
    controller.startup(options, new RuntimeData());

    assertTrue("Execution data file should be created", destFile.exists());
View Full Code Here

  }

  @Test
  public void testWriteData() throws Exception {
    File destFile = folder.newFile("jacoco.exec");
    AgentOptions options = new AgentOptions();
    options.setDestfile(destFile.getAbsolutePath());

    FileOutput controller = new FileOutput();
    controller.startup(options, new RuntimeData());
    controller.writeExecutionData(false);
    controller.shutdown();
View Full Code Here

        destFile.length() > 0);
  }

  @Test(expected = IOException.class)
  public void testInvalidDestFile() throws Exception {
    AgentOptions options = new AgentOptions();
    options.setDestfile(folder.newFolder("folder").getAbsolutePath());
    FileOutput controller = new FileOutput();

    // Startup should fail as the file can not be created:
    controller.startup(options, new RuntimeData());
  }
View Full Code Here

  /**
   * Create default agent options
   */
  protected AbstractCoverageTask() {
    super();
    agentOptions = new AgentOptions();
    enabled = true;
  }
View Full Code Here

        .get(AGENT_ARTIFACT_NAME);
    return jacocoAgentArtifact.getFile();
  }

  AgentOptions createAgentOptions() {
    final AgentOptions agentOptions = new AgentOptions();
    agentOptions.setDestfile(getDestFile().getAbsolutePath());
    if (append != null) {
      agentOptions.setAppend(append.booleanValue());
    }
    if (getIncludes() != null && !getIncludes().isEmpty()) {
      final String agentIncludes = StringUtils.join(getIncludes()
          .iterator(), ":");
      agentOptions.setIncludes(agentIncludes);
    }
    if (getExcludes() != null && !getExcludes().isEmpty()) {
      final String agentExcludes = StringUtils.join(getExcludes()
          .iterator(), ":");
      agentOptions.setExcludes(agentExcludes);
    }
    if (exclClassLoaders != null) {
      agentOptions.setExclClassloader(exclClassLoaders);
    }
    if (inclBootstrapClasses != null) {
      agentOptions.setInclBootstrapClasses(inclBootstrapClasses
          .booleanValue());
    }
    if (sessionId != null) {
      agentOptions.setSessionId(sessionId);
    }
    if (dumpOnExit != null) {
      agentOptions.setDumpOnExit(dumpOnExit.booleanValue());
    }
    if (output != null) {
      agentOptions.setOutput(output);
    }
    if (address != null) {
      agentOptions.setAddress(address);
    }
    if (port != null) {
      agentOptions.setPort(port.intValue());
    }
    if (classDumpDir != null) {
      agentOptions.setClassDumpDir(classDumpDir.getAbsolutePath());
    }
    if (jmx != null) {
      agentOptions.setJmx(jmx.booleanValue());
    }
    return agentOptions;
  }
View Full Code Here

          throws IOException {
        return con.getSocketA();
      }
    };
    data = new RuntimeData();
    controller.startup(new AgentOptions(), data);
    remoteReader = new RemoteControlReader(remoteSocket.getInputStream());
  }
View Full Code Here

  private RuntimeData data;

  @Before
  public void setup() throws Exception {
    options = new AgentOptions();
    logger = new ExceptionRecorder();
    serverSocket = new MockServerSocket();
    controller = new TcpServerOutput(logger) {
      @Override
      protected ServerSocket createServerSocket(AgentOptions options)
View Full Code Here

      ILaunchConfiguration config) throws CoreException {
    return new AdjustedLaunchConfiguration(getArgument(serverPort), config);
  }

  protected String getArgument(int serverPort) throws CoreException {
    final AgentOptions options = new AgentOptions();
    options.setIncludes(preferences.getAgentIncludes());
    options.setExcludes(preferences.getAgentExcludes());
    options.setExclClassloader(preferences.getAgentExclClassloader());
    options.setOutput(AgentOptions.OutputMode.tcpclient);
    options.setPort(serverPort);
    return quote(options.getVMArgument(getAgentFile()));
  }
View Full Code Here

TOP

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

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.