diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/CellValues.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/CellValues.java
index 424fbc9c2dfda..06e177e7e5ecb 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/CellValues.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/CellValues.java
@@ -17,7 +17,7 @@
* the geo-doc-values. Class must encode the values and then
* sort them in order to account for the cells correctly.
*/
-abstract class CellValues extends AbstractSortingNumericDocValues {
+public abstract class CellValues extends AbstractSortingNumericDocValues {
private MultiGeoPointValues geoValues;
protected int precision;
@@ -51,5 +51,5 @@ public boolean advanceExact(int docId) throws IOException {
* @param valuesIdx the index into values
to set
* @return valuesIdx + 1 if value was set, valuesIdx otherwise.
*/
- abstract int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx);
+ protected abstract int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx);
}
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java
index bddef4f45635e..ea247b1eda440 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java
@@ -38,7 +38,7 @@ public abstract class GeoGridAggregator> extends Bu
protected final ValuesSource.Numeric valuesSource;
protected final LongKeyedBucketOrds bucketOrds;
- GeoGridAggregator(
+ protected GeoGridAggregator(
String name,
AggregatorFactories factories,
ValuesSource.Numeric valuesSource,
@@ -92,14 +92,14 @@ public void collect(int doc, long owningBucketOrd) throws IOException {
};
}
- abstract T buildAggregation(String name, int requiredSize, List buckets, Map metadata);
+ protected abstract T buildAggregation(String name, int requiredSize, List buckets, Map metadata);
/**
* This method is used to return a re-usable instance of the bucket when building
* the aggregation.
* @return a new {@link InternalGeoGridBucket} implementation with empty parameters
*/
- abstract InternalGeoGridBucket newEmptyBucket();
+ protected abstract InternalGeoGridBucket newEmptyBucket();
@Override
public InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws IOException {
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashCellIdSource.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashCellIdSource.java
index 29a4e3b9a115d..8eaaa949cd92c 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashCellIdSource.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashCellIdSource.java
@@ -65,7 +65,7 @@ private static class UnboundedCellValues extends CellValues {
}
@Override
- int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
+ protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
values[valuesIdx] = Geohash.longEncode(target.getLon(), target.getLat(), precision);
return valuesIdx + 1;
}
@@ -83,7 +83,7 @@ private static class BoundedCellValues extends CellValues {
}
@Override
- int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
+ protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
final String hash = Geohash.stringEncode(target.getLon(), target.getLat(), precision);
if (validHash(hash)) {
values[valuesIdx] = Geohash.longEncode(hash);
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java
index c07030a2069f5..2de98c3d569b2 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java
@@ -38,7 +38,12 @@ public GeoHashGridAggregator(
}
@Override
- InternalGeoHashGrid buildAggregation(String name, int requiredSize, List buckets, Map metadata) {
+ protected InternalGeoHashGrid buildAggregation(
+ String name,
+ int requiredSize,
+ List buckets,
+ Map metadata
+ ) {
return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
}
@@ -47,7 +52,7 @@ public InternalGeoHashGrid buildEmptyAggregation() {
return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), metadata());
}
- InternalGeoGridBucket newEmptyBucket() {
+ protected InternalGeoGridBucket newEmptyBucket() {
return new InternalGeoHashGridBucket(0, 0, null);
}
}
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileCellIdSource.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileCellIdSource.java
index 20dda5d15f033..49c747156dce3 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileCellIdSource.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileCellIdSource.java
@@ -64,7 +64,7 @@ private static class UnboundedCellValues extends CellValues {
}
@Override
- int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
+ protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
values[valuesIdx] = GeoTileUtils.longEncode(target.getLon(), target.getLat(), precision);
return valuesIdx + 1;
}
@@ -97,7 +97,7 @@ protected BoundedCellValues(MultiGeoPointValues geoValues, int precision, GeoBou
}
@Override
- int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
+ protected int advanceValue(org.elasticsearch.common.geo.GeoPoint target, int valuesIdx) {
final int x = GeoTileUtils.getXTile(target.getLon(), this.tiles);
final int y = GeoTileUtils.getYTile(target.getLat(), this.tiles);
if (validTile(x, y)) {
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java
index 4547cc2e99d4a..73975302fa4c8 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java
@@ -39,7 +39,12 @@ public GeoTileGridAggregator(
}
@Override
- InternalGeoTileGrid buildAggregation(String name, int requiredSize, List buckets, Map metadata) {
+ protected InternalGeoTileGrid buildAggregation(
+ String name,
+ int requiredSize,
+ List buckets,
+ Map metadata
+ ) {
return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
}
@@ -48,7 +53,7 @@ public InternalGeoTileGrid buildEmptyAggregation() {
return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata());
}
- InternalGeoGridBucket newEmptyBucket() {
+ protected InternalGeoGridBucket newEmptyBucket() {
return new InternalGeoTileGridBucket(0, 0, null);
}
}
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java
index 3a226f83ec11e..2135841ac7800 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java
@@ -38,13 +38,13 @@ public abstract class InternalGeoGrid extends I
protected final int requiredSize;
protected final List buckets;
- InternalGeoGrid(String name, int requiredSize, List buckets, Map metadata) {
+ protected InternalGeoGrid(String name, int requiredSize, List buckets, Map metadata) {
super(name, metadata);
this.requiredSize = requiredSize;
this.buckets = buckets;
}
- abstract Writeable.Reader getBucketReader();
+ protected abstract Writeable.Reader getBucketReader();
/**
* Read from a stream.
@@ -62,7 +62,12 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeList(buckets);
}
- abstract InternalGeoGrid create(String name, int requiredSize, List buckets, Map metadata);
+ protected abstract InternalGeoGrid create(
+ String name,
+ int requiredSize,
+ List buckets,
+ Map metadata
+ );
@Override
public List getBuckets() {
@@ -117,7 +122,7 @@ protected InternalGeoGridBucket reduceBucket(List buckets
return createBucket(buckets.get(0).hashAsLong, docCount, aggs);
}
- abstract B createBucket(long hashAsLong, long docCount, InternalAggregations aggregations);
+ protected abstract B createBucket(long hashAsLong, long docCount, InternalAggregations aggregations);
@Override
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGridBucket.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGridBucket.java
index 7662fc8a172e1..9c8ac145fca47 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGridBucket.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGridBucket.java
@@ -51,7 +51,7 @@ public void writeTo(StreamOutput out) throws IOException {
aggregations.writeTo(out);
}
- long hashAsLong() {
+ protected long hashAsLong() {
return hashAsLong;
}
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java
index 0a1fa2009f53b..393c1ed9bfb20 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java
@@ -40,7 +40,7 @@ public InternalGeoGridBucket createBucket(InternalAggregations aggregations, Int
}
@Override
- InternalGeoGrid create(
+ protected InternalGeoGrid create(
String name,
int requiredSize,
List buckets,
@@ -50,12 +50,12 @@ InternalGeoGrid create(
}
@Override
- InternalGeoHashGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
+ protected InternalGeoHashGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
return new InternalGeoHashGridBucket(hashAsLong, docCount, aggregations);
}
@Override
- Reader getBucketReader() {
+ protected Reader getBucketReader() {
return InternalGeoHashGridBucket::new;
}
diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoTileGrid.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoTileGrid.java
index a036e772b1501..c5215957505de 100644
--- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoTileGrid.java
+++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoTileGrid.java
@@ -40,7 +40,7 @@ public InternalGeoGridBucket createBucket(InternalAggregations aggregations, Int
}
@Override
- InternalGeoGrid create(
+ protected InternalGeoGrid create(
String name,
int requiredSize,
List buckets,
@@ -50,12 +50,12 @@ InternalGeoGrid create(
}
@Override
- InternalGeoTileGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
+ protected InternalGeoTileGridBucket createBucket(long hashAsLong, long docCount, InternalAggregations aggregations) {
return new InternalGeoTileGridBucket(hashAsLong, docCount, aggregations);
}
@Override
- Reader getBucketReader() {
+ protected Reader getBucketReader() {
return InternalGeoTileGridBucket::new;
}
diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregatorTestCase.java b/test/framework/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregatorTestCase.java
similarity index 100%
rename from server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregatorTestCase.java
rename to test/framework/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregatorTestCase.java
diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java b/test/framework/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java
similarity index 100%
rename from server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java
rename to test/framework/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java