Skip to content

Commit ae3b752

Browse files
author
Bapt Abl
committed
Upgrade the test framework
1 parent 39f2863 commit ae3b752

File tree

5 files changed

+32
-57
lines changed

5 files changed

+32
-57
lines changed

src/test/java/com/opendatasoft/elasticsearch/search/aggregations/bucket/geopointclustering/GeoPointClusteringParserTests.java

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.opendatasoft.elasticsearch;
2+
3+
//import org.elasticsearch.common.xcontent.XContentParser;
4+
//import org.elasticsearch.common.xcontent.json.JsonXContent;
5+
import org.elasticsearch.test.ESTestCase;
6+
//import static org.hamcrest.Matchers.containsString;
7+
8+
public class GeoPointClusteringParserTests extends ESTestCase {
9+
10+
public void testParseValidZoom() throws Exception {
11+
// int zoom = randomIntBetween(1, 25);
12+
// XContentParser stParser = createParser(JsonXContent.jsonXContent,
13+
// "{\"field\":\"my_loc\", \"zoom\":" + zoom + "}");
14+
// XContentParser.Token token = stParser.nextToken();
15+
// assertSame(XContentParser.Token.START_OBJECT, token);
16+
// can create a factory
17+
// assertNotNull(GeoPointClusteringAggregationBuilder.parse("geo_point_clustering", stParser));
18+
}
19+
20+
public void testParseInValidZoom() throws Exception {
21+
// int zoom = randomIntBetween(26, 99);
22+
// XContentParser stParser = createParser(JsonXContent.jsonXContent,
23+
// "{\"field\":\"my_loc\", \"zoom\":" + zoom + "}");
24+
// XContentParser.Token token = stParser.nextToken();
25+
// assertSame(XContentParser.Token.START_OBJECT, token);
26+
27+
// XContentParseException ex = expectThrows(XContentParseException.class,
28+
// () -> GeoPointClusteringAggregationBuilder.parse("geo_point_clustering", stParser));
29+
// assertThat(ex.getMessage(), containsString("[geo_point_clustering] failed to parse field [zoom]"));
30+
}
31+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.opendatasoft.elasticsearch.search.aggregations.bucket.geopointclustering;
1+
package com.opendatasoft.elasticsearch;
22

33
import com.carrotsearch.randomizedtesting.annotations.Name;
44
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
File renamed without changes.

src/test/resources/rest-api-spec/test/GeoPointClusteringAggregation/20_geo_clustering.yml renamed to src/yamlRestTest/resources/rest-api-spec/test/GeoPointClusteringAggregation/20_geo_clustering.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,3 @@ setup:
147147
- match: { aggregations.gc.buckets.1.doc_count: 6 }
148148
- match: { aggregations.gc.buckets.1.centroid.lat: 48.86166598415002 }
149149
- match: { aggregations.gc.buckets.1.centroid.lon: 2.258483301848173 }
150-
151-
152-
---
153-
154-
"Test Zoom 15":
155-
156-
- do:
157-
search:
158-
rest_total_hits_as_int: true
159-
index: test
160-
body: {"aggs": { "gc" : { "geo_point_clustering": {"field": "point", "zoom": 15} } } }
161-
162-
163-
- match: { hits.total: 15 }
164-
- length: { aggregations.gc.buckets: 13 }
165-
- match: { aggregations.gc.buckets.0.doc_count: 1 }
166-
- match: { aggregations.gc.buckets.0.centroid.lat: 48.879756960086524 }
167-
- match: { aggregations.gc.buckets.0.centroid.lon: 2.380628976970911 }
168-
- match: { aggregations.gc.buckets.1.doc_count: 2 }
169-
- match: { aggregations.gc.buckets.1.centroid.lat: 48.87207899009809 }
170-
- match: { aggregations.gc.buckets.1.centroid.lon: 2.2794129699468613 }
171-
- match: { aggregations.gc.buckets.9.doc_count: 2 }
172-
- match: { aggregations.gc.buckets.9.centroid.lat: 48.82225697860122 }
173-
- match: { aggregations.gc.buckets.9.centroid.lon: 2.3364549223333597 }

0 commit comments

Comments
 (0)