From c2bdafd33a940ce377ab765e36db0cd1229cb774 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Tue, 21 Sep 2021 13:00:52 -0700 Subject: [PATCH] Fix split packages in external test modules (#78136) The external test modules are plugins which provide extra test functionality in snapshot builds. These are independent Elasticsearch plugins added as modules. They currently share package names with server. This commit moves them each into their own java package name. --- test/external-modules/delayed-aggs/build.gradle | 8 +------- .../delayedshard}/DelayedShardAggregationBuilder.java | 8 +++++++- .../delayedshard}/DelayedShardAggregationPlugin.java | 2 +- .../DelayedShardAggregationBuilderTests.java | 3 ++- test/external-modules/die-with-dignity/build.gradle | 8 +------- .../{ => test/diewithdignity}/DieWithDignityPlugin.java | 2 +- .../diewithdignity}/RestDieWithDignityAction.java | 2 +- test/external-modules/error-query/build.gradle | 9 +-------- .../query => test/errorquery}/ErrorQueryBuilder.java | 2 +- .../query => test/errorquery}/ErrorQueryPlugin.java | 2 +- .../{search/query => test/errorquery}/IndexError.java | 2 +- .../errorquery}/ErrorQueryBuilderTests.java | 2 +- 12 files changed, 19 insertions(+), 31 deletions(-) rename test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/{search/aggregations => test/delayedshard}/DelayedShardAggregationBuilder.java (91%) rename test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/{search/aggregations => test/delayedshard}/DelayedShardAggregationPlugin.java (96%) rename test/external-modules/delayed-aggs/src/test/java/org/elasticsearch/{search/aggregations => test/delayedshard}/DelayedShardAggregationBuilderTests.java (90%) rename test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/{ => test/diewithdignity}/DieWithDignityPlugin.java (97%) rename test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/{ => test/diewithdignity}/RestDieWithDignityAction.java (97%) rename test/external-modules/error-query/src/main/java/org/elasticsearch/{search/query => test/errorquery}/ErrorQueryBuilder.java (99%) rename test/external-modules/error-query/src/main/java/org/elasticsearch/{search/query => test/errorquery}/ErrorQueryPlugin.java (95%) rename test/external-modules/error-query/src/main/java/org/elasticsearch/{search/query => test/errorquery}/IndexError.java (99%) rename test/external-modules/error-query/src/test/java/org/elasticsearch/{search/query => test/errorquery}/ErrorQueryBuilderTests.java (98%) diff --git a/test/external-modules/delayed-aggs/build.gradle b/test/external-modules/delayed-aggs/build.gradle index ef42ac3796592..88a1fe5568c66 100644 --- a/test/external-modules/delayed-aggs/build.gradle +++ b/test/external-modules/delayed-aggs/build.gradle @@ -8,7 +8,7 @@ esplugin { description 'A test module that allows to delay aggregations on shards with a configurable time' - classname 'org.elasticsearch.search.aggregations.DelayedShardAggregationPlugin' + classname 'org.elasticsearch.test.delayedshard.DelayedShardAggregationPlugin' } restResources { @@ -16,9 +16,3 @@ restResources { include '_common', 'indices', 'index', 'cluster', 'search' } } - -tasks.named('splitPackagesAudit').configure { - // aggs is owned by server, these should be moved to delayedaggs - ignoreClasses 'org.elasticsearch.search.aggregations.DelayedShardAggregationBuilder', - 'org.elasticsearch.search.aggregations.DelayedShardAggregationPlugin' -} diff --git a/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilder.java b/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationBuilder.java similarity index 91% rename from test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilder.java rename to test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationBuilder.java index 2672dbe0fc880..878cb0b23ab9d 100644 --- a/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilder.java +++ b/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationBuilder.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.search.aggregations; +package org.elasticsearch.test.delayedshard; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -15,6 +15,12 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.core.TimeValue; import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.search.aggregations.AbstractAggregationBuilder; +import org.elasticsearch.search.aggregations.AggregationBuilder; +import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.AggregatorFactory; +import org.elasticsearch.search.aggregations.CardinalityUpperBound; import org.elasticsearch.search.aggregations.bucket.filter.FilterAggregationBuilder; import org.elasticsearch.search.aggregations.support.AggregationContext; diff --git a/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationPlugin.java b/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationPlugin.java similarity index 96% rename from test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationPlugin.java rename to test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationPlugin.java index b5fad05733988..5812087998d94 100644 --- a/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/search/aggregations/DelayedShardAggregationPlugin.java +++ b/test/external-modules/delayed-aggs/src/main/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationPlugin.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.search.aggregations; +package org.elasticsearch.test.delayedshard; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.SearchPlugin; diff --git a/test/external-modules/delayed-aggs/src/test/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilderTests.java b/test/external-modules/delayed-aggs/src/test/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationBuilderTests.java similarity index 90% rename from test/external-modules/delayed-aggs/src/test/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilderTests.java rename to test/external-modules/delayed-aggs/src/test/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationBuilderTests.java index 55cff8aeb7eef..7a442920c0f00 100644 --- a/test/external-modules/delayed-aggs/src/test/java/org/elasticsearch/search/aggregations/DelayedShardAggregationBuilderTests.java +++ b/test/external-modules/delayed-aggs/src/test/java/org/elasticsearch/test/delayedshard/DelayedShardAggregationBuilderTests.java @@ -5,10 +5,11 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -package org.elasticsearch.search.aggregations; +package org.elasticsearch.test.delayedshard; import org.elasticsearch.core.TimeValue; import org.elasticsearch.plugins.Plugin; +import org.elasticsearch.search.aggregations.BaseAggregationTestCase; import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin; import java.util.Arrays; diff --git a/test/external-modules/die-with-dignity/build.gradle b/test/external-modules/die-with-dignity/build.gradle index 64165a4c278b0..a203d6e8fd948 100644 --- a/test/external-modules/die-with-dignity/build.gradle +++ b/test/external-modules/die-with-dignity/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'elasticsearch.internal-es-plugin' esplugin { description 'Die with dignity plugin' - classname 'org.elasticsearch.DieWithDignityPlugin' + classname 'org.elasticsearch.test.diewithdignity.DieWithDignityPlugin' } // let the javaRestTest see the classpath of main @@ -31,9 +31,3 @@ tasks.named("test").configure { tasks.named("yamlRestTest").configure { enabled = false } - -tasks.named('splitPackagesAudit').configure { - // these should be moved to an actual package, not the root package - ignoreClasses 'org.elasticsearch.DieWithDignityPlugin', - 'org.elasticsearch.RestDieWithDignityAction' -} diff --git a/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/DieWithDignityPlugin.java b/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/test/diewithdignity/DieWithDignityPlugin.java similarity index 97% rename from test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/DieWithDignityPlugin.java rename to test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/test/diewithdignity/DieWithDignityPlugin.java index c17369928a4d1..96e48b1c3fd58 100644 --- a/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/DieWithDignityPlugin.java +++ b/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/test/diewithdignity/DieWithDignityPlugin.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch; +package org.elasticsearch.test.diewithdignity; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.node.DiscoveryNodes; diff --git a/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java b/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/test/diewithdignity/RestDieWithDignityAction.java similarity index 97% rename from test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java rename to test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/test/diewithdignity/RestDieWithDignityAction.java index fa22699453cfe..a94a98de3e1ea 100644 --- a/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/RestDieWithDignityAction.java +++ b/test/external-modules/die-with-dignity/src/main/java/org/elasticsearch/test/diewithdignity/RestDieWithDignityAction.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch; +package org.elasticsearch.test.diewithdignity; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Randomness; diff --git a/test/external-modules/error-query/build.gradle b/test/external-modules/error-query/build.gradle index e5588419ee094..c9b8ab9a4dfd5 100644 --- a/test/external-modules/error-query/build.gradle +++ b/test/external-modules/error-query/build.gradle @@ -8,7 +8,7 @@ esplugin { description 'A test module that exposes a way to simulate search shard failures and warnings' - classname 'org.elasticsearch.search.query.ErrorQueryPlugin' + classname 'org.elasticsearch.test.errorquery.ErrorQueryPlugin' } restResources { @@ -16,10 +16,3 @@ restResources { include '_common', 'indices', 'index', 'cluster', 'search' } } - -tasks.named('splitPackagesAudit').configure { - // search.query is owned by server, these should be moved to errorquery - ignoreClasses 'org.elasticsearch.search.query.ErrorQueryBuilder', - 'org.elasticsearch.search.query.ErrorQueryPlugin', - 'org.elasticsearch.search.query.IndexError' -} diff --git a/test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/ErrorQueryBuilder.java b/test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/ErrorQueryBuilder.java similarity index 99% rename from test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/ErrorQueryBuilder.java rename to test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/ErrorQueryBuilder.java index ab81bf510b206..d9f6c53b869f2 100644 --- a/test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/ErrorQueryBuilder.java +++ b/test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/ErrorQueryBuilder.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.search.query; +package org.elasticsearch.test.errorquery; import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.Query; diff --git a/test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/ErrorQueryPlugin.java b/test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/ErrorQueryPlugin.java similarity index 95% rename from test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/ErrorQueryPlugin.java rename to test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/ErrorQueryPlugin.java index f65f644e4d1db..e76d8dcde2595 100644 --- a/test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/ErrorQueryPlugin.java +++ b/test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/ErrorQueryPlugin.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.search.query; +package org.elasticsearch.test.errorquery; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.SearchPlugin; diff --git a/test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/IndexError.java b/test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/IndexError.java similarity index 99% rename from test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/IndexError.java rename to test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/IndexError.java index ef3f60bf7e272..8c7856367b7c4 100644 --- a/test/external-modules/error-query/src/main/java/org/elasticsearch/search/query/IndexError.java +++ b/test/external-modules/error-query/src/main/java/org/elasticsearch/test/errorquery/IndexError.java @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -package org.elasticsearch.search.query; +package org.elasticsearch.test.errorquery; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; diff --git a/test/external-modules/error-query/src/test/java/org/elasticsearch/search/query/ErrorQueryBuilderTests.java b/test/external-modules/error-query/src/test/java/org/elasticsearch/test/errorquery/ErrorQueryBuilderTests.java similarity index 98% rename from test/external-modules/error-query/src/test/java/org/elasticsearch/search/query/ErrorQueryBuilderTests.java rename to test/external-modules/error-query/src/test/java/org/elasticsearch/test/errorquery/ErrorQueryBuilderTests.java index f2b3e355e6a39..c92c2a5f89362 100644 --- a/test/external-modules/error-query/src/test/java/org/elasticsearch/search/query/ErrorQueryBuilderTests.java +++ b/test/external-modules/error-query/src/test/java/org/elasticsearch/test/errorquery/ErrorQueryBuilderTests.java @@ -5,7 +5,7 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -package org.elasticsearch.search.query; +package org.elasticsearch.test.errorquery; import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.Query;