@Override public void publish(ScannerReportWriter writer) { final ScannerReport.Measure.Builder builder = ScannerReport.Measure.newBuilder(); for (final InputComponent c : componentStore.all()) { DefaultInputComponent component = (DefaultInputComponent) c; if (component.isFile()) { DefaultInputFile file = (DefaultInputFile) component; // Recompute all coverage measures from line data to take into account the possible merge of several reports updateCoverageFromLineData(file); // Recompute test execution measures from MutableTestPlan to take into account the possible merge of several reports updateTestExecutionFromTestPlan(file); } Iterable<DefaultMeasure<?>> scannerMeasures = measureCache.byComponentKey(component.key()); if (scannerMeasures.iterator().hasNext()) { writer.writeComponentMeasures(component.scannerId(), StreamSupport.stream(scannerMeasures.spliterator(), false) .map(input -> { if (input.value() == null) { throw new IllegalArgumentException( String.format("Measure on metric '%s' and component '%s' has no value, but it's not allowed", input.metric().key(), component.key())); } builder.clear(); builder.setMetricKey(input.metric().key()); setValueAccordingToType(builder, input); return builder.build(); }).collect(Collectors.toList())); } } }
@Override public void publish(ScannerReportWriter writer) { final ScannerReport.Measure.Builder builder = ScannerReport.Measure.newBuilder(); for (final InputComponent c : componentStore.all()) { DefaultInputComponent component = (DefaultInputComponent) c; if (component.isFile()) { DefaultInputFile file = (DefaultInputFile) component; // Recompute all coverage measures from line data to take into account the possible merge of several reports updateCoverageFromLineData(file); // Recompute test execution measures from MutableTestPlan to take into account the possible merge of several reports updateTestExecutionFromTestPlan(file); } Iterable<DefaultMeasure<?>> scannerMeasures = measureCache.byComponentKey(component.key()); if (scannerMeasures.iterator().hasNext()) { writer.writeComponentMeasures(component.scannerId(), StreamSupport.stream(scannerMeasures.spliterator(), false) .map(input -> { if (input.value() == null) { throw new IllegalArgumentException( String.format("Measure on metric '%s' and component '%s' has no value, but it's not allowed", input.metric().key(), component.key())); } builder.clear(); builder.setMetricKey(input.metric().key()); setValueAccordingToType(builder, input); return builder.build(); }).collect(Collectors.toList())); } } }