|
13 | 13 | import org.elasticsearch.script.ScriptType;
|
14 | 14 | import org.elasticsearch.search.aggregations.AggregationTestScriptsPlugin;
|
15 | 15 | import org.elasticsearch.search.aggregations.BucketOrder;
|
16 |
| -import org.elasticsearch.search.aggregations.InternalAggregation; |
17 | 16 | import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregation;
|
18 | 17 | import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
19 | 18 | import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
@@ -293,57 +292,45 @@ public void testSingleValuedFieldGetProperty() throws Exception {
|
293 | 292 | ExtendedStats stats = global.getAggregations().get("stats");
|
294 | 293 | assertThat(stats, notNullValue());
|
295 | 294 | assertThat(stats.getName(), equalTo("stats"));
|
296 |
| - ExtendedStats statsFromProperty = (ExtendedStats) ((InternalAggregation) global).getProperty("stats"); |
| 295 | + ExtendedStats statsFromProperty = (ExtendedStats) global.getProperty("stats"); |
297 | 296 | assertThat(statsFromProperty, notNullValue());
|
298 | 297 | assertThat(statsFromProperty, sameInstance(stats));
|
299 | 298 | double expectedAvgValue = (double) (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10) / 10;
|
300 | 299 | assertThat(stats.getAvg(), equalTo(expectedAvgValue));
|
301 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.avg"), equalTo(expectedAvgValue)); |
| 300 | + assertThat((double) global.getProperty("stats.avg"), equalTo(expectedAvgValue)); |
302 | 301 | double expectedMinValue = 1.0;
|
303 | 302 | assertThat(stats.getMin(), equalTo(expectedMinValue));
|
304 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.min"), equalTo(expectedMinValue)); |
| 303 | + assertThat((double) global.getProperty("stats.min"), equalTo(expectedMinValue)); |
305 | 304 | double expectedMaxValue = 10.0;
|
306 | 305 | assertThat(stats.getMax(), equalTo(expectedMaxValue));
|
307 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.max"), equalTo(expectedMaxValue)); |
| 306 | + assertThat((double) global.getProperty("stats.max"), equalTo(expectedMaxValue)); |
308 | 307 | double expectedSumValue = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10;
|
309 | 308 | assertThat(stats.getSum(), equalTo(expectedSumValue));
|
310 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.sum"), equalTo(expectedSumValue)); |
| 309 | + assertThat((double) global.getProperty("stats.sum"), equalTo(expectedSumValue)); |
311 | 310 | long expectedCountValue = 10;
|
312 | 311 | assertThat(stats.getCount(), equalTo(expectedCountValue));
|
313 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.count"), equalTo((double) expectedCountValue)); |
| 312 | + assertThat((double) global.getProperty("stats.count"), equalTo((double) expectedCountValue)); |
314 | 313 | double expectedSumOfSquaresValue = (double) 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100;
|
315 | 314 | assertThat(stats.getSumOfSquares(), equalTo(expectedSumOfSquaresValue));
|
316 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.sum_of_squares"), equalTo(expectedSumOfSquaresValue)); |
| 315 | + assertThat((double) global.getProperty("stats.sum_of_squares"), equalTo(expectedSumOfSquaresValue)); |
317 | 316 | double expectedVarianceValue = variance(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
318 | 317 | assertThat(stats.getVariance(), equalTo(expectedVarianceValue));
|
319 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.variance"), equalTo(expectedVarianceValue)); |
| 318 | + assertThat((double) global.getProperty("stats.variance"), equalTo(expectedVarianceValue)); |
320 | 319 | double expectedVariancePopulationValue = variancePopulation(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
321 | 320 | assertThat(stats.getVariancePopulation(), equalTo(expectedVariancePopulationValue));
|
322 |
| - assertThat( |
323 |
| - (double) ((InternalAggregation) global).getProperty("stats.variance_population"), |
324 |
| - equalTo(expectedVariancePopulationValue) |
325 |
| - ); |
| 321 | + assertThat((double) global.getProperty("stats.variance_population"), equalTo(expectedVariancePopulationValue)); |
326 | 322 | double expectedVarianceSamplingValue = varianceSampling(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
327 | 323 | assertThat(stats.getVarianceSampling(), equalTo(expectedVarianceSamplingValue));
|
328 |
| - assertThat( |
329 |
| - (double) ((InternalAggregation) global).getProperty("stats.variance_sampling"), |
330 |
| - equalTo(expectedVarianceSamplingValue) |
331 |
| - ); |
| 324 | + assertThat((double) global.getProperty("stats.variance_sampling"), equalTo(expectedVarianceSamplingValue)); |
332 | 325 | double expectedStdDevValue = stdDev(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
333 | 326 | assertThat(stats.getStdDeviation(), equalTo(expectedStdDevValue));
|
334 |
| - assertThat((double) ((InternalAggregation) global).getProperty("stats.std_deviation"), equalTo(expectedStdDevValue)); |
| 327 | + assertThat((double) global.getProperty("stats.std_deviation"), equalTo(expectedStdDevValue)); |
335 | 328 | double expectedStdDevPopulationValue = stdDevPopulation(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
336 | 329 | assertThat(stats.getStdDeviationPopulation(), equalTo(expectedStdDevValue));
|
337 |
| - assertThat( |
338 |
| - (double) ((InternalAggregation) global).getProperty("stats.std_deviation_population"), |
339 |
| - equalTo(expectedStdDevPopulationValue) |
340 |
| - ); |
| 330 | + assertThat((double) global.getProperty("stats.std_deviation_population"), equalTo(expectedStdDevPopulationValue)); |
341 | 331 | double expectedStdDevSamplingValue = stdDevSampling(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
342 | 332 | assertThat(stats.getStdDeviationSampling(), equalTo(expectedStdDevSamplingValue));
|
343 |
| - assertThat( |
344 |
| - (double) ((InternalAggregation) global).getProperty("stats.std_deviation_sampling"), |
345 |
| - equalTo(expectedStdDevSamplingValue) |
346 |
| - ); |
| 333 | + assertThat((double) global.getProperty("stats.std_deviation_sampling"), equalTo(expectedStdDevSamplingValue)); |
347 | 334 | }
|
348 | 335 | );
|
349 | 336 | }
|
|
0 commit comments