Remove //norelease and cleans up somet aggregations tests (#24789)
This commit is contained in:
parent
dd731d9e98
commit
4c34ea8fc8
|
@ -22,7 +22,6 @@ package org.elasticsearch.search.aggregations.metrics.cardinality;
|
|||
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.ParsedAggregation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -33,10 +32,7 @@ public class ParsedCardinality extends ParsedAggregation implements Cardinality
|
|||
|
||||
@Override
|
||||
public String getValueAsString() {
|
||||
// InternalCardinality doesn't print "value_as_string", but you can get a formatted value using
|
||||
// getValueAsString(). That method uses the raw formatter so we also use it here.
|
||||
//norelease is it worth doing Double.toString(value) and removing the dependency to DocValueFormat.RAW ?
|
||||
return DocValueFormat.RAW.format((double) cardinalityValue);
|
||||
return Double.toString((double) cardinalityValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -36,7 +35,6 @@ public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregation
|
|||
private List<String> keys;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
keys = new ArrayList<>();
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -37,7 +36,6 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase
|
|||
private List<String> keys;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
keyed = randomBoolean();
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregationTestC
|
|||
import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -37,7 +36,6 @@ public abstract class InternalRangeTestCase<T extends InternalAggregation & Rang
|
|||
private boolean keyed;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
keyed = randomBoolean();
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -39,7 +38,6 @@ public class InternalRangeTests extends InternalRangeTestCase<InternalRange> {
|
|||
private List<Tuple<Double, Double>> ranges;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
format = randomNumericDocValueFormat();
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.bucket.range.InternalRangeTestCase;
|
|||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -43,7 +42,6 @@ public class InternalDateRangeTests extends InternalRangeTestCase<InternalDateRa
|
|||
private List<Tuple<Double, Double>> dateRanges;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
format = randomNumericDocValueFormat();
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
|||
import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.InternalRangeTestCase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -38,7 +37,6 @@ public class InternalGeoDistanceTests extends InternalRangeTestCase<InternalGeoD
|
|||
private List<Tuple<Double, Double>> geoDistanceRanges;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHSc
|
|||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
@ -43,7 +42,6 @@ public class SignificantLongTermsTests extends InternalSignificantTermsTestCase
|
|||
private DocValueFormat format;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
significanceHeuristic = randomSignificanceHeuristic();
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHSc
|
|||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
@ -43,7 +42,6 @@ public class SignificantStringTermsTests extends InternalSignificantTermsTestCas
|
|||
private SignificanceHeuristic significanceHeuristic;
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
significanceHeuristic = randomSignificanceHeuristic();
|
||||
|
|
|
@ -27,16 +27,16 @@ import org.elasticsearch.search.aggregations.metrics.stats.extended.InternalExte
|
|||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ParsedExtendedStats;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.test.InternalAggregationTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InternalExtendedStatsTests extends InternalAggregationTestCase<InternalExtendedStats> {
|
||||
protected double sigma;
|
||||
|
||||
@Before
|
||||
public void randomSigma() {
|
||||
private double sigma;
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
this.sigma = randomDoubleBetween(0, 10, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -297,18 +297,11 @@ public abstract class InternalAggregationTestCase<T extends InternalAggregation>
|
|||
|
||||
public final void testFromXContent() throws IOException {
|
||||
final T aggregation = createTestInstance();
|
||||
|
||||
//norelease Remove this assumption when all aggregations can be parsed back.
|
||||
assumeTrue("This test does not support the aggregation type yet",
|
||||
getNamedXContents().stream().filter(entry -> entry.name.match(aggregation.getType())).count() > 0);
|
||||
|
||||
final Aggregation parsedAggregation = parseAndAssert(aggregation, randomBoolean());
|
||||
assertFromXContent(aggregation, (ParsedAggregation) parsedAggregation);
|
||||
}
|
||||
|
||||
//norelease TODO make abstract
|
||||
protected void assertFromXContent(T aggregation, ParsedAggregation parsedAggregation) throws IOException {
|
||||
}
|
||||
protected abstract void assertFromXContent(T aggregation, ParsedAggregation parsedAggregation) throws IOException;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <P extends ParsedAggregation> P parseAndAssert(final InternalAggregation aggregation,
|
||||
|
|
Loading…
Reference in New Issue