/** * New instance to combine session infos and execution data from multiple * files. */ public ExecFileLoader() { sessionInfos = new SessionInfoStore(); executionData = new ExecutionDataStore(); }
public MemoryExecutionDataSource() { sessionInfoStore = new SessionInfoStore(); executionDataStore = new ExecutionDataStore(); }
private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath(), e)); } finally { Closeables.closeQuietly(outputStream); } }
private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new SonarException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } finally { Closeables.closeQuietly(outputStream); } }
private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new SonarException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } finally { Closeables.closeQuietly(outputStream); } }
private void loadExecutionData() throws IOException { executionDataStore = new ExecutionDataStore(); sessionInfoStore = new SessionInfoStore(); for (FilePath filePath : execFiles) { File executionDataFile = new File(filePath.getRemote()); try { try (final InputStream inputStream = new BufferedInputStream( new FileInputStream(executionDataFile))) { final ExecutionDataReader reader = new ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataStore); reader.read(); } } catch (final IOException e) { throw new IOException("While reading execution data-file: " + executionDataFile, e); } } } private IBundleCoverage analyzeStructure() throws IOException {
/** * Merge all reports in reportOverall. * @param reportOverall destination file of merge. * @param reports files to be merged. */ public static void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); boolean isCurrentVersionFormat = loadSourceFiles(infoStore, dataStore, reports); try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall))) { Object visitor; if (isCurrentVersionFormat) { visitor = new ExecutionDataWriter(outputStream); } else { visitor = new org.jacoco.previous.core.data.ExecutionDataWriter(outputStream); } infoStore.accept((ISessionInfoVisitor) visitor); dataStore.accept((IExecutionDataVisitor) visitor); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } }
private void loadExecutionData() throws IOException { File executionDataFile = new File(execFile.getRemote()); final FileInputStream fis = new FileInputStream(executionDataFile); final ExecutionDataReader executionDataReader = new ExecutionDataReader( fis); executionDataStore = new ExecutionDataStore(); sessionInfoStore = new SessionInfoStore(); executionDataReader.setExecutionDataVisitor(executionDataStore); executionDataReader.setSessionInfoVisitor(sessionInfoStore); while (executionDataReader.read()) { } fis.close(); } private IBundleCoverage analyzeStructure() throws IOException {
public void storeCoverageData(@Observes CoverageDataCommand coverageDataCommandEvent) { try { ExecutionDataStore dataStore = new ExecutionDataStore(); SessionInfoStore sessionStore = new SessionInfoStore(); read(new ByteArrayInputStream(coverageDataCommandEvent.getCoverageDate()), dataStore, sessionStore); copyToAgentExecutionStore(dataStore); coverageDataCommandEvent.setResult("SUCCESS"); } catch (Exception e) { coverageDataCommandEvent.setResult("FAILURE"); e.printStackTrace(); } }
public void storeCoverageData(@Observes CoverageDataCommand coverageDataCommandEvent) { try { ExecutionDataStore dataStore = new ExecutionDataStore(); SessionInfoStore sessionStore = new SessionInfoStore(); read(new ByteArrayInputStream(coverageDataCommandEvent.getCoverageDate()), dataStore, sessionStore); copyToAgentExecutionStore(dataStore); coverageDataCommandEvent.setResult("SUCCESS"); } catch (Exception e) { coverageDataCommandEvent.setResult("FAILURE"); e.printStackTrace(); } }
final RuntimeData data = new RuntimeData(); final ExecutionDataStore executionData = new ExecutionDataStore(); final SessionInfoStore sessionInfos = new SessionInfoStore(); URLClassLoader classLoader; try {
final RuntimeData data = new RuntimeData(); final ExecutionDataStore executionData = new ExecutionDataStore(); final SessionInfoStore sessionInfos = new SessionInfoStore(); URLClassLoader classLoader; try {
@Override public void executionStarted(TestIdentifier testIdentifier) { if (testIdentifier.isTest()) { this.internalCoverage.setExecutionData(new ExecutionDataStore()); this.internalCoverage.setSessionInfos(new SessionInfoStore()); this.internalCoverage.getData().setSessionId(this.toString.apply(testIdentifier)); this.internalCoverage.getData().collect( this.internalCoverage.getExecutionData(), this.internalCoverage.getSessionInfos(), true ); this.getRunningTests().add(this.toString.apply(testIdentifier)); } }
public IJavaModelCoverage processSession(ICoverageSession session, IProgressMonitor monitor) throws CoreException { PERFORMANCE.startTimer(); PERFORMANCE.startMemoryUsage(); modelcoverage = new JavaModelCoverage(); final Collection<IPackageFragmentRoot> roots = session.getScope(); monitor.beginTask( NLS.bind(CoreMessages.AnalyzingCoverageSession_task, session.getDescription()), 1 + roots.size()); executiondatastore = new ExecutionDataStore(); sessioninfostore = new SessionInfoStore(); session.accept(executiondatastore, sessioninfostore); monitor.worked(1); final PackageFragementRootAnalyzer analyzer = new PackageFragementRootAnalyzer( executiondatastore); for (final IPackageFragmentRoot root : roots) { if (monitor.isCanceled()) { break; } processPackageFragmentRoot(root, analyzer, new SubProgressMonitor( monitor, 1)); } monitor.done(); PERFORMANCE.stopTimer("loading " + session.getDescription()); //$NON-NLS-1$ PERFORMANCE.stopMemoryUsage("loading " + session.getDescription()); //$NON-NLS-1$ return modelcoverage; }
data.collect(executionData, new SessionInfoStore(), false); runtime.shutdown();
@Override public void testStarted(Description description) throws Exception { this.internalCoverage.setExecutionData(new ExecutionDataStore()); this.internalCoverage.setSessionInfos(new SessionInfoStore()); this.internalCoverage.getData().setSessionId(description.getMethodName()); this.internalCoverage.getData().collect( this.internalCoverage.getExecutionData(), this.internalCoverage.getSessionInfos(), true ); }