Search in sources :

Example 36 with DetectorEvaluationTree

use of com.synopsys.integration.detector.base.DetectorEvaluationTree in project synopsys-detect by blackducksoftware.

the class DiagnosticReportHandler method completedBomToolEvaluations.

public void completedBomToolEvaluations(DetectorToolResult detectorToolResult) {
    this.detectorToolResult = detectorToolResult;
    DetectorEvaluationTree rootEvaluation;
    if (detectorToolResult.getRootDetectorEvaluationTree().isPresent()) {
        rootEvaluation = detectorToolResult.getRootDetectorEvaluationTree().get();
    } else {
        logger.warn("Detectors completed, but no evaluation was found, unable to write detector reports.");
        return;
    }
    try {
        SearchSummaryReporter searchReporter = new SearchSummaryReporter();
        searchReporter.print(getReportWriter(ReportTypes.SEARCH), rootEvaluation);
    } catch (Exception e) {
        logger.error("Failed to write search report.", e);
    }
    try {
        DetailedSearchSummaryReporter searchReporter = new DetailedSearchSummaryReporter();
        searchReporter.print(getReportWriter(ReportTypes.SEARCH_DETAILED), rootEvaluation);
    } catch (Exception e) {
        logger.error("Failed to write detailed search report.", e);
    }
    try {
        OverviewSummaryReporter overviewSummaryReporter = new OverviewSummaryReporter();
        overviewSummaryReporter.writeReport(getReportWriter(ReportTypes.DETECTOR), rootEvaluation);
    } catch (Exception e) {
        logger.error("Failed to write detector report.", e);
    }
}
Also used : DetectorEvaluationTree(com.synopsys.integration.detector.base.DetectorEvaluationTree) DetailedSearchSummaryReporter(com.synopsys.integration.detect.workflow.report.DetailedSearchSummaryReporter) OverviewSummaryReporter(com.synopsys.integration.detect.workflow.report.OverviewSummaryReporter) SearchSummaryReporter(com.synopsys.integration.detect.workflow.report.SearchSummaryReporter) DetailedSearchSummaryReporter(com.synopsys.integration.detect.workflow.report.DetailedSearchSummaryReporter)

Example 37 with DetectorEvaluationTree

use of com.synopsys.integration.detector.base.DetectorEvaluationTree in project synopsys-detect by blackducksoftware.

the class PreparationSummaryReporter method writeSummary.

private void writeSummary(ReportWriter writer, List<DetectorEvaluationTree> detectorEvaluationTrees) {
    List<String> lines = new ArrayList<>();
    for (DetectorEvaluationTree detectorEvaluationTree : detectorEvaluationTrees) {
        List<DetectorEvaluation> applicable = DetectorEvaluationUtils.applicableChildren(detectorEvaluationTree);
        List<DetectorEvaluation> ready = applicable.stream().filter(DetectorEvaluation::isExtractable).collect(Collectors.toList());
        List<DetectorEvaluation> notExtractable = applicable.stream().filter(it -> !it.isExtractable()).collect(Collectors.toList());
        if (CollectionUtils.isNotEmpty(ready) || CollectionUtils.isNotEmpty(notExtractable)) {
            lines.add(detectorEvaluationTree.getDirectory().toString());
            if (CollectionUtils.isNotEmpty(ready)) {
                lines.add("\t    READY: " + ready.stream().map(it -> it.getDetectorRule().getDescriptiveName()).sorted().collect(Collectors.joining(", ")));
            }
        }
    }
    if (CollectionUtils.isNotEmpty(lines)) {
        ReporterUtils.printHeader(writer, "Preparation for extraction");
        lines.forEach(writer::writeLine);
        ReporterUtils.printFooter(writer);
    }
}
Also used : DetectorEvaluationTree(com.synopsys.integration.detector.base.DetectorEvaluationTree) DetectorEvaluation(com.synopsys.integration.detector.base.DetectorEvaluation) ReportWriter(com.synopsys.integration.detect.workflow.report.writer.ReportWriter) List(java.util.List) DetectorEvaluationUtils(com.synopsys.integration.detect.workflow.report.util.DetectorEvaluationUtils) ReporterUtils(com.synopsys.integration.detect.workflow.report.util.ReporterUtils) DetectorEvaluationTree(com.synopsys.integration.detector.base.DetectorEvaluationTree) Collectors(java.util.stream.Collectors) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) DetectorEvaluation(com.synopsys.integration.detector.base.DetectorEvaluation)

Aggregations

DetectorEvaluationTree (com.synopsys.integration.detector.base.DetectorEvaluationTree)37 DetectorEvaluation (com.synopsys.integration.detector.base.DetectorEvaluation)28 File (java.io.File)18 Test (org.junit.jupiter.api.Test)17 DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)11 Detectable (com.synopsys.integration.detectable.Detectable)10 DetectorRule (com.synopsys.integration.detector.rule.DetectorRule)9 DetectorResult (com.synopsys.integration.detector.result.DetectorResult)8 DetectorRuleSet (com.synopsys.integration.detector.rule.DetectorRuleSet)8 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)8 ExtractionEnvironment (com.synopsys.integration.detectable.extraction.ExtractionEnvironment)7 Predicate (java.util.function.Predicate)7 Mockito (org.mockito.Mockito)7 DetectableResult (com.synopsys.integration.detectable.detectable.result.DetectableResult)6 List (java.util.List)6 DetectableException (com.synopsys.integration.detectable.detectable.exception.DetectableException)5 Extraction (com.synopsys.integration.detectable.extraction.Extraction)5 ArrayList (java.util.ArrayList)5 Collections (java.util.Collections)5 HashSet (java.util.HashSet)5