use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class SessionsPage method executionDataTable.
private void executionDataTable(final HTMLElement body) throws IOException {
final HTMLElement table = body.table(Styles.COVERAGETABLE);
{
final HTMLElement tr = table.thead().tr();
tr.td().text("Class");
tr.td().text("Id");
}
final HTMLElement tbody = table.tbody();
final ILanguageNames names = context.getLanguageNames();
for (final ExecutionData e : executionData) {
final HTMLElement tr = tbody.tr();
final String link = index.getLinkToClass(e.getId());
final String qualifiedName = names.getQualifiedClassName(e.getName());
if (link == null) {
tr.td().span(Styles.EL_CLASS).text(qualifiedName);
} else {
tr.td().a(link, Styles.EL_CLASS).text(qualifiedName);
}
final String id = String.format("%016x", Long.valueOf(e.getId()));
tr.td().code().text(id);
}
}
use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class ValidationTestBase method analyze.
private void analyze(final ExecutionDataStore store) throws IOException {
final CoverageBuilder builder = new CoverageBuilder();
final Analyzer analyzer = new Analyzer(store, builder);
for (ExecutionData data : store.getContents()) {
analyze(analyzer, data);
}
String srcName = target.getName().replace('.', '/') + ".java";
for (ISourceFileCoverage file : builder.getSourceFiles()) {
if (srcName.equals(file.getPackageName() + "/" + file.getName())) {
sourceCoverage = file;
return;
}
}
fail("No source node found for " + srcName);
}
use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class ExecFileLoaderTest method createFile.
private File createFile(String id) throws IOException {
final File file = new File(sourceFolder.getRoot(), id + ".exec");
final FileOutputStream out = new FileOutputStream(file);
final ExecutionDataWriter writer = new ExecutionDataWriter(out);
final int value = id.length();
writer.visitClassExecution(new ExecutionData(value, id, new boolean[] { true }));
writer.visitSessionInfo(new SessionInfo(id, value, value));
out.close();
return file;
}
use of org.jacoco.core.data.ExecutionData in project sonar-java by SonarSource.
the class UnitTestAnalyzer method classFilesOfStore.
private Collection<File> classFilesOfStore(ExecutionDataStore executionDataStore) {
Collection<File> result = Lists.newArrayList();
for (ExecutionData data : executionDataStore.getContents()) {
String vmClassName = data.getName();
File classFile = classFilesCache.get(vmClassName);
if (classFile != null) {
result.add(classFile);
}
}
return result;
}
use of org.jacoco.core.data.ExecutionData in project jacoco by jacoco.
the class CreateExecFiles method main.
public static void main(String[] args) throws IOException {
OutputStream out;
out = new FileOutputStream(BASE_LOCATION + "sample1.exec");
new ExecutionDataWriter(out);
out.close();
out = new FileOutputStream(BASE_LOCATION + "sample2.exec");
new ExecutionDataWriter(out);
out.close();
out = new FileOutputStream(BASE_LOCATION + "nomatch.exec");
ExecutionDataWriter writer = new ExecutionDataWriter(out);
writer.visitClassExecution(new ExecutionData(0, "org/jacoco/ant/TestTarget", new boolean[0]));
out.close();
}
Aggregations