diff --git a/allure-generator/src/main/java/io/qameta/allure/category/CategoriesTrendPlugin.java b/allure-generator/src/main/java/io/qameta/allure/category/CategoriesTrendPlugin.java index 76ccf63a8..6bf6c79d1 100644 --- a/allure-generator/src/main/java/io/qameta/allure/category/CategoriesTrendPlugin.java +++ b/allure-generator/src/main/java/io/qameta/allure/category/CategoriesTrendPlugin.java @@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import io.qameta.allure.Aggregator; import io.qameta.allure.CommonJsonAggregator; import io.qameta.allure.Constants; import io.qameta.allure.core.LaunchResults; @@ -54,7 +55,7 @@ protected static List getData(final List lau final List data = getHistoryItems(launchesResults); return Stream.concat(Stream.of(item), data.stream()) - .limit(20) + .limit(Aggregator.resultsLimit()) .collect(Collectors.toList()); } diff --git a/allure-generator/src/main/java/io/qameta/allure/duration/DurationTrendPlugin.java b/allure-generator/src/main/java/io/qameta/allure/duration/DurationTrendPlugin.java index ac809b163..e51a8f345 100644 --- a/allure-generator/src/main/java/io/qameta/allure/duration/DurationTrendPlugin.java +++ b/allure-generator/src/main/java/io/qameta/allure/duration/DurationTrendPlugin.java @@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import io.qameta.allure.Aggregator; import io.qameta.allure.CommonJsonAggregator; import io.qameta.allure.Constants; import io.qameta.allure.core.LaunchResults; @@ -55,7 +56,7 @@ protected Optional parseItem(final ObjectMapper mapper, final final List data = getHistoryItems(launchesResults); return Stream.concat(Stream.of(item), data.stream()) - .limit(20) + .limit(Aggregator.resultsLimit()) .collect(Collectors.toList()); } diff --git a/allure-generator/src/main/java/io/qameta/allure/history/HistoryPlugin.java b/allure-generator/src/main/java/io/qameta/allure/history/HistoryPlugin.java index 87c0449fa..095802c06 100644 --- a/allure-generator/src/main/java/io/qameta/allure/history/HistoryPlugin.java +++ b/allure-generator/src/main/java/io/qameta/allure/history/HistoryPlugin.java @@ -189,7 +189,7 @@ private void updateHistory(final Map history, result.setNewPassed(isNewPassed(current, prevItems)); final List newItems = Stream.concat(Stream.of(current), prevItems.stream()) - .limit(20) + .limit(Aggregator.resultsLimit()) .collect(Collectors.toList()); data.setItems(newItems); } diff --git a/allure-generator/src/main/java/io/qameta/allure/history/HistoryTrendPlugin.java b/allure-generator/src/main/java/io/qameta/allure/history/HistoryTrendPlugin.java index f487bb7b7..0ad22dc47 100644 --- a/allure-generator/src/main/java/io/qameta/allure/history/HistoryTrendPlugin.java +++ b/allure-generator/src/main/java/io/qameta/allure/history/HistoryTrendPlugin.java @@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import io.qameta.allure.Aggregator; import io.qameta.allure.CommonJsonAggregator; import io.qameta.allure.Constants; import io.qameta.allure.core.LaunchResults; @@ -65,7 +66,7 @@ protected Optional parseItem(final ObjectMapper mapper, final final List data = getHistoryItems(launchesResults); return Stream.concat(Stream.of(item), data.stream()) - .limit(20) + .limit(Aggregator.resultsLimit()) .collect(Collectors.toList()); } diff --git a/allure-generator/src/main/java/io/qameta/allure/retry/RetryTrendPlugin.java b/allure-generator/src/main/java/io/qameta/allure/retry/RetryTrendPlugin.java index 4de86c822..6df460710 100644 --- a/allure-generator/src/main/java/io/qameta/allure/retry/RetryTrendPlugin.java +++ b/allure-generator/src/main/java/io/qameta/allure/retry/RetryTrendPlugin.java @@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import io.qameta.allure.Aggregator; import io.qameta.allure.CommonJsonAggregator; import io.qameta.allure.Constants; import io.qameta.allure.core.LaunchResults; @@ -55,7 +56,7 @@ protected Optional parseItem(final ObjectMapper mapper, final Js final List data = getHistoryItems(launchesResults); return Stream.concat(Stream.of(item), data.stream()) - .limit(20) + .limit(Aggregator.resultsLimit()) .collect(Collectors.toList()); } diff --git a/allure-plugin-api/src/main/java/io/qameta/allure/Aggregator.java b/allure-plugin-api/src/main/java/io/qameta/allure/Aggregator.java index a1f6ab261..e99e9dd6e 100644 --- a/allure-plugin-api/src/main/java/io/qameta/allure/Aggregator.java +++ b/allure-plugin-api/src/main/java/io/qameta/allure/Aggregator.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.nio.file.Path; import java.util.List; +import java.util.Optional; /** * Aggregator extension. Can be used to process results and/or generate @@ -31,6 +32,17 @@ @FunctionalInterface public interface Aggregator extends Extension { + /** + * Configure the number of items to be rendered on different charts. + * + * @return RESULTS_LIMIT provided by user, or a default value = 20. + */ + static long resultsLimit() { + return Optional.ofNullable(System.getenv("ALLURE_RESULTS_LIMIT")) + .map(Long::parseLong) + .orElse(20L); + } + /** * Process report data. *