@SuppressWarnings({"PMD.AvoidLiteralsInIfCondition", "PMD.AvoidInstantiatingObjectsInLoops"}) @Override public void aggregate(final Configuration configuration, final List<LaunchResults> launchesResults, final Path outputDirectory) { final Map<String, List<TestResult>> byHistory = launchesResults.stream() .flatMap(results -> results.getAllResults().stream()) .filter(result -> Objects.nonNull(result.getHistoryId())) .collect(Collectors.toMap(TestResult::getHistoryId, Arrays::asList, this::merge)); byHistory.forEach((historyId, results) -> findLatest(results).ifPresent(addRetries(results))); }
protected Map<String, HistoryData> getData(final List<LaunchResults> launches) { return launches.stream() .map(launch -> { final ExecutorInfo executorInfo = launch.getExtra( ExecutorPlugin.EXECUTORS_BLOCK_NAME, ExecutorInfo::new ); final Map<String, HistoryData> history = launch.getExtra(HISTORY_BLOCK_NAME, HashMap::new); launch.getResults().stream() .filter(result -> Objects.nonNull(result.getHistoryId())) .forEach(result -> updateHistory(history, result, executorInfo)); return history; }) .reduce(new HashMap<>(), (a, b) -> { a.putAll(b); return a; }); }
private void updateHistory(final Map<String, HistoryData> history, final TestResult result, final ExecutorInfo info) { //@formatter:off final HistoryData data = history.computeIfAbsent( result.getHistoryId(), id -> new HistoryData().setStatistic(new Statistic()) ); //@formatter:on data.getStatistic().update(result); if (!data.getItems().isEmpty()) { result.addExtraBlock(HISTORY_BLOCK_NAME, copy(data)); } final HistoryItem newItem = new HistoryItem() .setUid(result.getUid()) .setStatus(result.getStatus()) .setStatusDetails(result.getStatusMessage()) .setTime(result.getTime()); if (Objects.nonNull(info.getReportUrl())) { newItem.setReportUrl(createReportUrl(info.getReportUrl(), result.getUid())); } final List<HistoryItem> newItems = Stream.concat(Stream.of(newItem), data.getItems().stream()) .limit(5) .collect(Collectors.toList()); data.setItems(newItems); }
@SuppressWarnings({"PMD.AvoidLiteralsInIfCondition", "PMD.AvoidInstantiatingObjectsInLoops"}) @Override public void aggregate(final Configuration configuration, final List<LaunchResults> launchesResults, final Path outputDirectory) { final Map<String, List<TestResult>> byHistory = launchesResults.stream() .flatMap(results -> results.getAllResults().stream()) .filter(result -> Objects.nonNull(result.getHistoryId())) .collect(Collectors.toMap(TestResult::getHistoryId, Arrays::asList, this::merge)); byHistory.forEach((historyId, results) -> findLatest(results).ifPresent(addRetries(results))); }
protected Map<String, HistoryData> getData(final List<LaunchResults> launches) { return launches.stream() .map(launch -> { final ExecutorInfo executorInfo = launch.getExtra( ExecutorPlugin.EXECUTORS_BLOCK_NAME, ExecutorInfo::new ); final Map<String, HistoryData> history = launch.getExtra(HISTORY_BLOCK_NAME, HashMap::new); launch.getResults().stream() .filter(result -> Objects.nonNull(result.getHistoryId())) .forEach(result -> updateHistory(history, result, executorInfo)); return history; }) .reduce(new HashMap<>(), (a, b) -> { a.putAll(b); return a; }); }
private void updateHistory(final Map<String, HistoryData> history, final TestResult result, final ExecutorInfo info) { //@formatter:off final HistoryData data = history.computeIfAbsent( result.getHistoryId(), id -> new HistoryData().setStatistic(new Statistic()) ); //@formatter:on data.getStatistic().update(result); if (!data.getItems().isEmpty()) { result.addExtraBlock(HISTORY_BLOCK_NAME, copy(data)); } final HistoryItem newItem = new HistoryItem() .setUid(result.getUid()) .setStatus(result.getStatus()) .setStatusDetails(result.getStatusMessage()) .setTime(result.getTime()); if (Objects.nonNull(info.getReportUrl())) { newItem.setReportUrl(createReportUrl(info.getReportUrl(), result.getUid())); } final List<HistoryItem> newItems = Stream.concat(Stream.of(newItem), data.getItems().stream()) .limit(5) .collect(Collectors.toList()); data.setItems(newItems); }