Search in sources :

Example 1 with ReportPublisher

use of org.sonar.scanner.report.ReportPublisher in project sonarqube by SonarSource.

the class TaskResult method scanTaskCompleted.

@Override
public void scanTaskCompleted(ProjectScanContainer container) {
    LOG.info("Store analysis results in memory for later assertions in medium test");
    for (TrackedIssue issue : container.getComponentByType(IssueCache.class).all()) {
        issues.add(issue);
    }
    ReportPublisher reportPublisher = container.getComponentByType(ReportPublisher.class);
    reader = new ScannerReportReader(reportPublisher.getReportDir());
    if (!container.getComponentByType(AnalysisMode.class).isIssues()) {
        Metadata readMetadata = getReportReader().readMetadata();
        int rootComponentRef = readMetadata.getRootComponentRef();
        storeReportComponents(rootComponentRef, null, readMetadata.getBranch());
    }
    storeFs(container);
}
Also used : TrackedIssue(org.sonar.scanner.issue.tracking.TrackedIssue) ReportPublisher(org.sonar.scanner.report.ReportPublisher) ScannerReportReader(org.sonar.scanner.protocol.output.ScannerReportReader) Metadata(org.sonar.scanner.protocol.output.ScannerReport.Metadata) IssueCache(org.sonar.scanner.issue.IssueCache)

Example 2 with ReportPublisher

use of org.sonar.scanner.report.ReportPublisher in project sonarqube by SonarSource.

the class DefaultSensorStorageTest method prepare.

@Before
public void prepare() throws Exception {
    MetricFinder metricFinder = mock(MetricFinder.class);
    when(metricFinder.<Integer>findByKey(CoreMetrics.NCLOC_KEY)).thenReturn(CoreMetrics.NCLOC);
    when(metricFinder.<String>findByKey(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION_KEY)).thenReturn(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION);
    settings = new MapSettings();
    moduleIssues = mock(ModuleIssues.class);
    measureCache = mock(MeasureCache.class);
    CoverageExclusions coverageExclusions = mock(CoverageExclusions.class);
    when(coverageExclusions.isExcluded(any(InputFile.class))).thenReturn(false);
    ReportPublisher reportPublisher = mock(ReportPublisher.class);
    when(reportPublisher.getWriter()).thenReturn(new ScannerReportWriter(temp.newFolder()));
    underTest = new DefaultSensorStorage(metricFinder, moduleIssues, settings, coverageExclusions, reportPublisher, measureCache, mock(SonarCpdBlockIndex.class), contextPropertiesCache, new ScannerMetrics());
}
Also used : ReportPublisher(org.sonar.scanner.report.ReportPublisher) MapSettings(org.sonar.api.config.MapSettings) MeasureCache(org.sonar.scanner.scan.measure.MeasureCache) ModuleIssues(org.sonar.scanner.issue.ModuleIssues) MetricFinder(org.sonar.api.batch.measure.MetricFinder) ScannerMetrics(org.sonar.core.metric.ScannerMetrics) CoverageExclusions(org.sonar.scanner.sensor.coverage.CoverageExclusions) ScannerReportWriter(org.sonar.scanner.protocol.output.ScannerReportWriter) InputFile(org.sonar.api.batch.fs.InputFile) Before(org.junit.Before)

Aggregations

ReportPublisher (org.sonar.scanner.report.ReportPublisher)2 Before (org.junit.Before)1 InputFile (org.sonar.api.batch.fs.InputFile)1 MetricFinder (org.sonar.api.batch.measure.MetricFinder)1 MapSettings (org.sonar.api.config.MapSettings)1 ScannerMetrics (org.sonar.core.metric.ScannerMetrics)1 IssueCache (org.sonar.scanner.issue.IssueCache)1 ModuleIssues (org.sonar.scanner.issue.ModuleIssues)1 TrackedIssue (org.sonar.scanner.issue.tracking.TrackedIssue)1 Metadata (org.sonar.scanner.protocol.output.ScannerReport.Metadata)1 ScannerReportReader (org.sonar.scanner.protocol.output.ScannerReportReader)1 ScannerReportWriter (org.sonar.scanner.protocol.output.ScannerReportWriter)1 MeasureCache (org.sonar.scanner.scan.measure.MeasureCache)1 CoverageExclusions (org.sonar.scanner.sensor.coverage.CoverageExclusions)1