Search in sources :

Example 11 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class ReportGenerator method loadExecutionData.

private void loadExecutionData() throws IOException {
    execFileLoader = new ExecFileLoader();
    execFileLoader.load(executionDataFile);
}
Also used : ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Example 12 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class DumpMojo method executeMojo.

@Override
public void executeMojo() throws MojoExecutionException {
    final ExecDumpClient client = new ExecDumpClient() {

        @Override
        protected void onConnecting(final InetAddress address, final int port) {
            getLog().info(format("Connecting to %s:%s", address, Integer.valueOf(port)));
        }

        @Override
        protected void onConnectionFailure(final IOException exception) {
            getLog().info(exception.getMessage());
        }
    };
    client.setDump(dump);
    client.setReset(reset);
    client.setRetryCount(retryCount);
    try {
        final ExecFileLoader loader = client.dump(address, port);
        if (dump) {
            getLog().info(format("Dumping execution data to %s", destFile.getAbsolutePath()));
            loader.save(destFile, append);
        }
    } catch (final IOException e) {
        throw new MojoExecutionException("Unable to dump coverage data", e);
    }
}
Also used : ExecDumpClient(org.jacoco.core.tools.ExecDumpClient) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) IOException(java.io.IOException) InetAddress(java.net.InetAddress) ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Example 13 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class MergeMojo method executeMerge.

private void executeMerge() throws MojoExecutionException {
    final ExecFileLoader loader = new ExecFileLoader();
    load(loader);
    save(loader);
}
Also used : ExecFileLoader(org.jacoco.core.tools.ExecFileLoader)

Example 14 with ExecFileLoader

use of org.jacoco.core.tools.ExecFileLoader in project jacoco by jacoco.

the class AgentTest method getExecutionData_should_return_probes_and_session_id.

@Test
public void getExecutionData_should_return_probes_and_session_id() throws IOException {
    Agent agent = createAgent();
    agent.startup();
    agent.getData().getExecutionData(Long.valueOf(0x12345678), "Foo", 1).getProbes()[0] = true;
    byte[] data = agent.getExecutionData(true);
    ExecFileLoader loader = new ExecFileLoader();
    loader.load(new ByteArrayInputStream(data));
    assertEquals("Foo", loader.getExecutionDataStore().get(0x12345678).getName());
    assertEquals("test", loader.getSessionInfoStore().getInfos().get(0).getId());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ExecFileLoader(org.jacoco.core.tools.ExecFileLoader) Test(org.junit.Test)

Aggregations

ExecFileLoader (org.jacoco.core.tools.ExecFileLoader)14 IOException (java.io.IOException)4 InetAddress (java.net.InetAddress)3 BuildException (org.apache.tools.ant.BuildException)3 ExecDumpClient (org.jacoco.core.tools.ExecDumpClient)3 File (java.io.File)2 IBundleCoverage (org.jacoco.core.analysis.IBundleCoverage)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 Resource (org.apache.tools.ant.types.Resource)1 FileResource (org.apache.tools.ant.types.resources.FileResource)1 ExecutionData (org.jacoco.core.data.ExecutionData)1 Test (org.junit.Test)1