From 416267c038e0dae0d5c81cca538a020e01926f2c Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Mon, 6 Apr 2020 21:12:05 +0200 Subject: [PATCH] Remove RestController from tests where it's not needed (#53782) (#54833) --- .../rest/action/cat/RestIndicesActionTests.java | 5 ----- .../rest/action/cat/RestRecoveryActionTests.java | 8 -------- 2 files changed, 13 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java index dd7106be86d..61860aa7084 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/cat/RestIndicesActionTests.java @@ -34,12 +34,9 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.rest.RestController; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; -import org.elasticsearch.usage.UsageService; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; @@ -127,9 +124,7 @@ public class RestIndicesActionTests extends ESTestCase { } } - final RestController restController = new RestController(Collections.emptySet(), null, null, null, new UsageService()); final RestIndicesAction action = new RestIndicesAction(); - restController.registerHandler(action); final Table table = action.buildTable(new FakeRestRequest(), indicesSettings, indicesHealths, indicesStats, indicesMetadatas); // now, verify the table is correct diff --git a/server/src/test/java/org/elasticsearch/rest/action/cat/RestRecoveryActionTests.java b/server/src/test/java/org/elasticsearch/rest/action/cat/RestRecoveryActionTests.java index 9f8ab08ed0d..ed19582abac 100644 --- a/server/src/test/java/org/elasticsearch/rest/action/cat/RestRecoveryActionTests.java +++ b/server/src/test/java/org/elasticsearch/rest/action/cat/RestRecoveryActionTests.java @@ -27,19 +27,15 @@ import org.elasticsearch.cluster.routing.RecoverySource.SnapshotRecoverySource; import org.elasticsearch.cluster.routing.TestShardRouting; import org.elasticsearch.common.Randomness; import org.elasticsearch.common.Table; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentElasticsearchExtension; import org.elasticsearch.index.Index; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.indices.recovery.RecoveryState; -import org.elasticsearch.rest.RestController; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.usage.UsageService; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -53,11 +49,7 @@ import static org.mockito.Mockito.mock; public class RestRecoveryActionTests extends ESTestCase { public void testRestRecoveryAction() { - final Settings settings = Settings.EMPTY; - UsageService usageService = new UsageService(); - final RestController restController = new RestController(Collections.emptySet(), null, null, null, usageService); final RestCatRecoveryAction action = new RestCatRecoveryAction(); - restController.registerHandler(action); final int totalShards = randomIntBetween(1, 32); final int successfulShards = Math.max(0, totalShards - randomIntBetween(1, 2)); final int failedShards = totalShards - successfulShards;