Skip to content

Commit

Permalink
Fixup test
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Nov 11, 2020
1 parent e41b3f3 commit 59e7cf5
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.elasticsearch.xpack.analytics.topmetrics.InternalTopMetrics.MetricValue;
import org.elasticsearch.xpack.analytics.topmetrics.InternalTopMetrics.TopMetric;
import org.elasticsearch.xpack.analytics.topmetrics.TopMetricsAggregator.MetricValues;
import org.elasticsearch.xpack.analytics.topmetrics.TopMetricsAggregator.MetricValuesSupplier;
import org.elasticsearch.xpack.analytics.topmetrics.TopMetricsAggregator.Metrics;

import java.io.IOException;
Expand All @@ -39,7 +38,6 @@

import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.toList;
import static org.elasticsearch.xpack.analytics.topmetrics.TopMetricsAggregationBuilder.REGISTRY_KEY;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
Expand Down Expand Up @@ -255,8 +253,13 @@ private void withMetric(ValuesSourceConfig config, CheckedConsumer<Metrics, IOEx
private void withMetrics(List<ValuesSourceConfig> configs, CheckedConsumer<Metrics, IOException> consumer) throws IOException {
MetricValues[] values = new MetricValues[configs.size()];
for (int i = 0; i < configs.size(); i++) {
MetricValuesSupplier supplier = REGISTRY.getAggregator(REGISTRY_KEY, configs.get(i));
values[i] = supplier.build(1, BigArrays.NON_RECYCLING_INSTANCE, configs.get(i).fieldContext().field(), configs.get(i));
values[i] = TopMetricsAggregator.buildMetricValues(
REGISTRY,
BigArrays.NON_RECYCLING_INSTANCE,
1,
configs.get(i).fieldContext().field(),
configs.get(i)
);
}
try (Metrics m = new Metrics(values)) {
consumer.accept(m);
Expand Down

0 comments on commit 59e7cf5

Please sign in to comment.