From 079d130d8c4827426ee15e7d7964b1c993a6c491 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Mon, 10 Sep 2018 18:29:00 +0200 Subject: [PATCH] [Test] Remove duplicate method in TestShardRouting (#32815) --- .../org/elasticsearch/gradle/BuildPlugin.groovy | 2 +- .../gradle/precommit/PrecommitTasks.groovy | 2 +- docs/reference/setup/setup-xclient.asciidoc | 2 +- docs/reference/upgrade/set-paths-tip.asciidoc | 2 +- modules/reindex/build.gradle | 2 +- .../allocation/ResizeAllocationDeciderTests.java | 12 ++++++------ .../elasticsearch/index/shard/IndexShardTests.java | 3 ++- .../cluster/routing/TestShardRouting.java | 4 ---- .../index/shard/IndexShardTestCase.java | 2 +- x-pack/docs/en/watcher/customizing-watches.asciidoc | 2 +- .../main/resources/meta-plugin-descriptor.properties | 2 +- 11 files changed, 16 insertions(+), 19 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 39f985c2eb7..110982e31e6 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -66,7 +66,7 @@ class BuildPlugin implements Plugin { void apply(Project project) { if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) { throw new InvalidUserDataException('elasticsearch.standalone-test, ' - + 'elasticsearch.standalone-rest-test, and elasticsearch.build ' + + 'elasticearch.standalone-rest-test, and elasticsearch.build ' + 'are mutually exclusive') } final String minimumGradleVersion diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy index e8ea1ab35d3..06557d4ccfd 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy @@ -63,7 +63,7 @@ class PrecommitTasks { * (which provides NamingConventionsCheck) and :test:logger-usage * which provides the logger usage check. Since the build tools * don't use the logger usage check because they don't have any - * of Elasticsearch's loggers and :test:logger-usage actually does + * of Elaticsearch's loggers and :test:logger-usage actually does * use the NamingConventionsCheck we break the circular dependency * here. */ diff --git a/docs/reference/setup/setup-xclient.asciidoc b/docs/reference/setup/setup-xclient.asciidoc index 4b38e869e25..4282264e395 100644 --- a/docs/reference/setup/setup-xclient.asciidoc +++ b/docs/reference/setup/setup-xclient.asciidoc @@ -11,7 +11,7 @@ cluster where {xpack} is installed, then you must download and configure the . Add the {xpack} transport JAR file to your *CLASSPATH*. You can download the {xpack} distribution and extract the JAR file manually or you can get it from the -https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.jar[Elasticsearch Maven repository]. +https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.jar[Elasticsearc Maven repository]. As with any dependency, you will also need its transitive dependencies. Refer to the https://artifacts.elastic.co/maven/org/elasticsearch/client/x-pack-transport/{version}/x-pack-transport-{version}.pom[X-Pack POM file for your version] when downloading for offline usage. diff --git a/docs/reference/upgrade/set-paths-tip.asciidoc b/docs/reference/upgrade/set-paths-tip.asciidoc index adfe3e29dac..2dd120767c2 100644 --- a/docs/reference/upgrade/set-paths-tip.asciidoc +++ b/docs/reference/upgrade/set-paths-tip.asciidoc @@ -2,7 +2,7 @@ ================================================ When you extract the zip or tarball packages, the `elasticsearch-n.n.n` -directory contains the Elasticsearch `config`, `data`, `logs` and +directory contains the Elasticsearh `config`, `data`, `logs` and `plugins` directories. We recommend moving these directories out of the Elasticsearch directory diff --git a/modules/reindex/build.gradle b/modules/reindex/build.gradle index e1b352e1a22..8870e21858d 100644 --- a/modules/reindex/build.gradle +++ b/modules/reindex/build.gradle @@ -71,7 +71,7 @@ thirdPartyAudit.excludes = [ 'org.apache.log.Logger', ] -// Support for testing reindex-from-remote against old Elasticsearch versions +// Support for testing reindex-from-remote against old Elaticsearch versions configurations { oldesFixture es2 diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/ResizeAllocationDeciderTests.java b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/ResizeAllocationDeciderTests.java index 536e3cbb7e0..eeec65f0e2e 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/ResizeAllocationDeciderTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/ResizeAllocationDeciderTests.java @@ -134,8 +134,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase { ResizeAllocationDecider resizeAllocationDecider = new ResizeAllocationDecider(Settings.EMPTY); RoutingAllocation routingAllocation = new RoutingAllocation(null, null, clusterState, null, 0); - ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, RecoverySource - .LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED); + ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, 0), null, true, ShardRoutingState.UNASSIGNED, + RecoverySource.LocalShardsRecoverySource.INSTANCE); assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation)); assertEquals(Decision.ALWAYS, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"), routingAllocation)); @@ -164,8 +164,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase { RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0); int shardId = randomIntBetween(0, 3); int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id(); - ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource - .LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED); + ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED, + RecoverySource.LocalShardsRecoverySource.INSTANCE); assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation)); assertEquals(Decision.NO, resizeAllocationDecider.canAllocate(shardRouting, clusterState.getRoutingNodes().node("node1"), routingAllocation)); @@ -204,8 +204,8 @@ public class ResizeAllocationDeciderTests extends ESAllocationTestCase { RoutingAllocation routingAllocation = new RoutingAllocation(null, clusterState.getRoutingNodes(), clusterState, null, 0); int shardId = randomIntBetween(0, 3); int sourceShardId = IndexMetaData.selectSplitShard(shardId, clusterState.metaData().index("source"), 4).id(); - ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, RecoverySource - .LocalShardsRecoverySource.INSTANCE, ShardRoutingState.UNASSIGNED); + ShardRouting shardRouting = TestShardRouting.newShardRouting(new ShardId(idx, shardId), null, true, ShardRoutingState.UNASSIGNED, + RecoverySource.LocalShardsRecoverySource.INSTANCE); assertEquals(Decision.YES, resizeAllocationDecider.canAllocate(shardRouting, routingAllocation)); String allowedNode = clusterState.getRoutingTable().index("source").shard(sourceShardId).primaryShard().currentNodeId(); diff --git a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java index 4ed74388f0e..7f37846d3f0 100644 --- a/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java +++ b/server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java @@ -1200,7 +1200,8 @@ public class IndexShardTests extends IndexShardTestCase { public void testShardStatsWithFailures() throws IOException { allowShardFailures(); final ShardId shardId = new ShardId("index", "_na_", 0); - final ShardRouting shardRouting = newShardRouting(shardId, "node", true, RecoverySource.EmptyStoreRecoverySource.INSTANCE, ShardRoutingState.INITIALIZING); + final ShardRouting shardRouting = + newShardRouting(shardId, "node", true, ShardRoutingState.INITIALIZING, RecoverySource.EmptyStoreRecoverySource.INSTANCE); final NodeEnvironment.NodePath nodePath = new NodeEnvironment.NodePath(createTempDir()); diff --git a/test/framework/src/main/java/org/elasticsearch/cluster/routing/TestShardRouting.java b/test/framework/src/main/java/org/elasticsearch/cluster/routing/TestShardRouting.java index c91c04884c5..ee270ee6e48 100644 --- a/test/framework/src/main/java/org/elasticsearch/cluster/routing/TestShardRouting.java +++ b/test/framework/src/main/java/org/elasticsearch/cluster/routing/TestShardRouting.java @@ -39,10 +39,6 @@ public class TestShardRouting { return newShardRouting(new ShardId(index, IndexMetaData.INDEX_UUID_NA_VALUE, shardId), currentNodeId, primary, state); } - public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId, boolean primary, RecoverySource recoverySource, ShardRoutingState state) { - return new ShardRouting(shardId, currentNodeId, null, primary, state, recoverySource, buildUnassignedInfo(state), buildAllocationId(state), -1); - } - public static ShardRouting newShardRouting(ShardId shardId, String currentNodeId, boolean primary, ShardRoutingState state) { return new ShardRouting(shardId, currentNodeId, null, primary, state, buildRecoveryTarget(primary, state), buildUnassignedInfo(state), buildAllocationId(state), -1); } diff --git a/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java b/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java index 9082b4153b0..ca2156144b3 100644 --- a/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/index/shard/IndexShardTestCase.java @@ -726,7 +726,7 @@ public abstract class IndexShardTestCase extends ESTestCase { final IndexId indexId = new IndexId(shardId.getIndex().getName(), shardId.getIndex().getUUID()); final DiscoveryNode node = getFakeDiscoNode(shard.routingEntry().currentNodeId()); final RecoverySource.SnapshotRecoverySource recoverySource = new RecoverySource.SnapshotRecoverySource(snapshot, version, index); - final ShardRouting shardRouting = newShardRouting(shardId, node.getId(), true, recoverySource, ShardRoutingState.INITIALIZING); + final ShardRouting shardRouting = newShardRouting(shardId, node.getId(), true, ShardRoutingState.INITIALIZING, recoverySource); shard.markAsRecovering("from snapshot", new RecoveryState(shardRouting, node, null)); repository.restoreShard(shard, snapshot.getSnapshotId(), version, indexId, shard.shardId(), shard.recoveryState()); diff --git a/x-pack/docs/en/watcher/customizing-watches.asciidoc b/x-pack/docs/en/watcher/customizing-watches.asciidoc index b250ea89d6f..fc45bc636bf 100644 --- a/x-pack/docs/en/watcher/customizing-watches.asciidoc +++ b/x-pack/docs/en/watcher/customizing-watches.asciidoc @@ -49,7 +49,7 @@ initial payload. A <> input contains a `request` object that specifies the indices you want to search, the {ref}/search-request-search-type.html[search type], and the search request body. The `body` field of a search input is the same as -the body of an Elasticsearch `_search` request, making the full Elasticsearch +the body of an Elasticsearch `_search` request, making the full Elaticsearch Query DSL available for you to use. For example, the following `search` input loads the latest VIX quote: diff --git a/x-pack/plugin/security/src/main/resources/meta-plugin-descriptor.properties b/x-pack/plugin/security/src/main/resources/meta-plugin-descriptor.properties index e80494fc1cb..2e878c207ac 100644 --- a/x-pack/plugin/security/src/main/resources/meta-plugin-descriptor.properties +++ b/x-pack/plugin/security/src/main/resources/meta-plugin-descriptor.properties @@ -5,7 +5,7 @@ # # meta-foo.zip <-- zip file for the meta plugin, with this structure: #|____elasticsearch/ -#| |____ <-- The plugin files for bundled_plugin_1 (the content of the elasticsearch directory) +#| |____ <-- The plugin files for bundled_plugin_1 (the content of the elastisearch directory) #| |____ <-- The plugin files for bundled_plugin_2 #| |____ meta-plugin-descriptor.properties <-- example contents below: #