Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop registering TestGeoShapeFieldMapperPlugin in ESIntegTestCase #88460

Merged
merged 2 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@

public class GeoBoundingBoxQueryLegacyGeoShapeIT extends GeoBoundingBoxQueryIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(TestLegacyGeoShapeFieldMapperPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@

public class LegacyGeoShapeIT extends GeoShapeIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(TestLegacyGeoShapeFieldMapperPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@

public class PercolatorQuerySearchIT extends ESIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Arrays.asList(PercolatorPlugin.class, TestGeoShapeFieldMapperPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.plugins.EnginePlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.test.transport.MockTransportService;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xcontent.XContentBuilder;
Expand Down Expand Up @@ -57,6 +58,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
List<Class<? extends Plugin>> plugins = new ArrayList<>(super.nodePlugins());
plugins.add(EngineTestPlugin.class);
plugins.add(MockTransportService.TestPlugin.class);
plugins.add(TestGeoShapeFieldMapperPlugin.class);
return plugins;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@
package org.elasticsearch.search.geo;

import org.elasticsearch.Version;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.test.VersionUtils;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;

public class GeoBoundingBoxQueryGeoPointIT extends GeoBoundingBoxQueryIntegTestCase {

@SuppressWarnings("deprecation")
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(TestGeoShapeFieldMapperPlugin.class);
}

@Override
public XContentBuilder getMapping() throws IOException {
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@
package org.elasticsearch.search.geo;

import org.elasticsearch.Version;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.test.VersionUtils;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;

public class GeoBoundingBoxQueryGeoShapeIT extends GeoBoundingBoxQueryIntegTestCase {

@SuppressWarnings("deprecation")
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(TestGeoShapeFieldMapperPlugin.class);
}

@Override
public XContentBuilder getMapping() throws IOException {
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@
package org.elasticsearch.search.geo;

import org.elasticsearch.Version;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.test.VersionUtils;
import org.elasticsearch.xcontent.XContentBuilder;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;

public class GeoShapeIT extends GeoShapeIntegTestCase {

@SuppressWarnings("deprecation")
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(TestGeoShapeFieldMapperPlugin.class);
}

@Override
protected void getGeoShapeMapping(XContentBuilder b) throws IOException {
b.field("type", "geo_shape");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.query.Operator;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.xcontent.XContentType;
import org.junit.Before;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand All @@ -35,6 +38,12 @@

public class QueryStringIT extends ESIntegTestCase {

@SuppressWarnings("deprecation")
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return List.of(TestGeoShapeFieldMapperPlugin.class);
}

@Before
public void setup() throws Exception {
String indexBody = copyToStringFromClasspath("/org/elasticsearch/search/query/all-query-index.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.xcontent.XContentFactory;
import org.elasticsearch.xcontent.XContentType;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -65,7 +65,7 @@ public class SimpleQueryStringIT extends ESIntegTestCase {

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singletonList(MockAnalysisPlugin.class);
return List.of(MockAnalysisPlugin.class, TestGeoShapeFieldMapperPlugin.class);
}

public void testSimpleQueryString() throws ExecutionException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
import org.elasticsearch.geo.GeometryTestUtils;
import org.elasticsearch.geometry.Point;
import org.elasticsearch.geometry.utils.WellKnownText;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;

import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
Expand All @@ -27,6 +31,12 @@

public class GeoPointShapeQueryTests extends GeoPointShapeQueryTestCase {

@SuppressWarnings("deprecation")
@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singleton(TestGeoShapeFieldMapperPlugin.class);
}

@Override
protected void createMapping(String indexName, String fieldName, Settings settings) throws Exception {
XContentBuilder xcb = XContentFactory.jsonBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,27 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.geo.GeometryTestUtils;
import org.elasticsearch.geometry.MultiPoint;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;

import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
import static org.elasticsearch.index.query.QueryBuilders.geoShapeQuery;
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;

public class GeoShapeQueryTests extends GeoShapeQueryTestCase {

@SuppressWarnings("deprecation")
@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singleton(TestGeoShapeFieldMapperPlugin.class);
}

@Override
protected void createMapping(String indexName, String fieldName, Settings settings) throws Exception {
XContentBuilder xcb = XContentFactory.jsonBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,11 @@
import org.elasticsearch.geometry.utils.WellKnownText;
import org.elasticsearch.index.query.GeoShapeQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.xcontent.XContentFactory;
import org.elasticsearch.xcontent.XContentType;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;

Expand All @@ -57,11 +53,6 @@

public abstract class GeoPointShapeQueryTestCase extends ESSingleNodeTestCase {

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singleton(TestGeoShapeFieldMapperPlugin.class);
}

protected abstract void createMapping(String indexName, String fieldName, Settings settings) throws Exception;

protected void createMapping(String indexName, String fieldName) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2049,11 +2049,6 @@ protected boolean addMockInternalEngine() {
return true;
}

/** Returns {@code true} iff this test cluster should use a dummy geo_shape field mapper */
protected boolean addMockGeoShapeFieldMapper() {
return true;
}

/**
* Returns a function that allows to wrap / filter all clients that are exposed by the test cluster. This is useful
* for debugging or request / response pre and post processing. It also allows to intercept all calls done by the test
Expand Down Expand Up @@ -2095,9 +2090,6 @@ protected Collection<Class<? extends Plugin>> getMockPlugins() {
mocks.add(TestSeedPlugin.class);
mocks.add(AssertActionNamePlugin.class);
mocks.add(MockScriptService.TestPlugin.class);
if (addMockGeoShapeFieldMapper()) {
mocks.add(TestGeoShapeFieldMapperPlugin.class);
}
return Collections.unmodifiableList(mocks);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
);
}

@Override
protected boolean addMockGeoShapeFieldMapper() {
// a test requires the real SpatialPlugin because it utilizes the shape query
return false;
}

@Override
protected String configUsers() {
final String usersPasswdHashed = new String(getFastStoredHashAlgoForTests().hash(USERS_PASSWD));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
);
}

@Override
protected boolean addMockGeoShapeFieldMapper() {
// a test requires the real SpatialPlugin because it utilizes the shape query
return false;
}

@Override
protected String configUsers() {
final String usersPasswHashed = new String(getFastStoredHashAlgoForTests().hash(USERS_PASSWD));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@

public class GeoBoundingBoxQueryGeoShapeWithDocValuesIT extends GeoBoundingBoxQueryIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(LocalStateSpatialPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@

public class GeoBoundingBoxQueryLegacyGeoShapeWithDocValuesIT extends GeoBoundingBoxQueryIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(LocalStateSpatialPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@

public class GeoGridAggAndQueryConsistencyIT extends ESIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(LocalStateSpatialPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@

public class GeoShapeWithDocValuesIT extends GeoShapeIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(LocalStateSpatialPlugin.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@

public class LegacyGeoShapeWithDocValuesIT extends GeoShapeIntegTestCase {

@Override
protected boolean addMockGeoShapeFieldMapper() {
return false;
}

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(LocalStateSpatialPlugin.class);
Expand Down