diff --git a/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRenderer.java b/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRenderer.java index 16a7aef8b6c..b7eabbf53d4 100644 --- a/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRenderer.java +++ b/marvel/src/main/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRenderer.java @@ -6,10 +6,10 @@ package org.elasticsearch.marvel.agent.renderer.indices; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; -import org.elasticsearch.action.admin.indices.recovery.ShardRecoveryResponse; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilderString; +import org.elasticsearch.indices.recovery.RecoveryState; import org.elasticsearch.marvel.agent.collector.indices.IndexRecoveryMarvelDoc; import org.elasticsearch.marvel.agent.renderer.AbstractRenderer; @@ -30,13 +30,13 @@ public class IndexRecoveryRenderer extends AbstractRenderer> shards = recovery.shardResponses(); + Map> shards = recovery.shardRecoveryStates(); if (shards != null) { - for (Map.Entry> shard : shards.entrySet()) { + for (Map.Entry> shard : shards.entrySet()) { - List indexShards = shard.getValue(); + List indexShards = shard.getValue(); if (indexShards != null) { - for (ShardRecoveryResponse indexShard : indexShards) { + for (RecoveryState indexShard : indexShards) { builder.startObject(); builder.field(Fields.INDEX_NAME, shard.getKey()); indexShard.toXContent(builder, params); diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java index bfe6ddef29e..a064d6a1bcc 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/indices/IndexRecoveryCollectorTests.java @@ -6,7 +6,6 @@ package org.elasticsearch.marvel.agent.collector.indices; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; -import org.elasticsearch.action.admin.indices.recovery.ShardRecoveryResponse; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; @@ -102,17 +101,17 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase { RecoveryResponse recovery = indexRecoveryMarvelDoc.getRecoveryResponse(); assertNotNull(recovery); - Map> shards = recovery.shardResponses(); + Map> shards = recovery.shardRecoveryStates(); assertThat(shards.size(), greaterThan(0)); - for (Map.Entry> shard : shards.entrySet()) { - List shardRecoveries = shard.getValue(); + for (Map.Entry> shard : shards.entrySet()) { + List shardRecoveries = shard.getValue(); assertNotNull(shardRecoveries); assertThat(shardRecoveries.size(), greaterThan(0)); - for (ShardRecoveryResponse shardRecovery : shardRecoveries) { - assertThat(shardRecovery.getIndex(), equalTo(indexName)); - assertThat(shardRecovery.recoveryState().getType(), anyOf(equalTo(RecoveryState.Type.RELOCATION), equalTo(RecoveryState.Type.STORE), equalTo(RecoveryState.Type.REPLICA))); + for (RecoveryState shardRecovery : shardRecoveries) { + assertThat(shard.getKey(), equalTo(indexName)); + assertThat(shardRecovery.getType(), anyOf(equalTo(RecoveryState.Type.RELOCATION), equalTo(RecoveryState.Type.STORE), equalTo(RecoveryState.Type.REPLICA))); } } } diff --git a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java index 90c4037c6ca..1bc493c92d4 100644 --- a/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java +++ b/marvel/src/test/java/org/elasticsearch/marvel/agent/renderer/indices/IndexRecoveryRendererTests.java @@ -7,7 +7,6 @@ package org.elasticsearch.marvel.agent.renderer.indices; import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; -import org.elasticsearch.action.admin.indices.recovery.ShardRecoveryResponse; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.transport.DummyTransportAddress; import org.elasticsearch.index.shard.ShardId; @@ -36,19 +35,17 @@ public class IndexRecoveryRendererTests extends ESTestCase { DiscoveryNode source = new DiscoveryNode("node-src", DummyTransportAddress.INSTANCE, Version.CURRENT); DiscoveryNode target = new DiscoveryNode("node-tgt", DummyTransportAddress.INSTANCE, Version.CURRENT); - List shards = new ArrayList<>(); + List shards = new ArrayList<>(); // Shard 0 - ShardRecoveryResponse shard0 = new ShardRecoveryResponse(); - shard0.recoveryState(new RecoveryState(new ShardId(indexName, 0), true, RecoveryState.Type.RELOCATION, source, target)); + RecoveryState shard0 = new RecoveryState(new ShardId(indexName, 0), true, RecoveryState.Type.RELOCATION, source, target); shards.add(shard0); // Shard 1 - ShardRecoveryResponse shard1 = new ShardRecoveryResponse(); - shard1.recoveryState(new RecoveryState(new ShardId(indexName, 1), true, RecoveryState.Type.STORE, source, target)); + RecoveryState shard1 = new RecoveryState(new ShardId(indexName, 1), true, RecoveryState.Type.STORE, source, target); shards.add(shard1); - Map> shardResponses = new HashMap<>(1); + Map> shardResponses = new HashMap<>(1); shardResponses.put(indexName, shards); RecoveryResponse recoveryResponse = new RecoveryResponse(2, 2, 2, false, shardResponses, null);