From d794253fc5cf78d3c56eda6aa51ca60381a8be6c Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Thu, 14 Jun 2018 13:42:12 +0100 Subject: [PATCH] Removes warnings from ILM code --- .../indexlifecycle/action/DeleteLifecycleAction.java | 1 - .../core/indexlifecycle/action/RetryAction.java | 3 --- .../MoveToNextStepUpdateTaskTests.java | 5 ----- .../indexlifecycle/TimeSeriesLifecycleActionsIT.java | 12 ++++++++---- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java index f6acdea5919..63935f490ab 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java @@ -10,7 +10,6 @@ import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContentObject; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java index 5868f8eeb06..3da1fe290fc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java @@ -10,8 +10,6 @@ import org.elasticsearch.action.Action; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.IndicesRequest; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.action.support.IndicesOptions.Option; -import org.elasticsearch.action.support.IndicesOptions.WildcardStates; import org.elasticsearch.action.support.master.AcknowledgedRequest; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.Strings; @@ -21,7 +19,6 @@ import org.elasticsearch.common.xcontent.ToXContentObject; import java.io.IOException; import java.util.Arrays; -import java.util.EnumSet; import java.util.Objects; public class RetryAction extends Action { diff --git a/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/MoveToNextStepUpdateTaskTests.java b/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/MoveToNextStepUpdateTaskTests.java index 244efd26d8d..67e618b67da 100644 --- a/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/MoveToNextStepUpdateTaskTests.java +++ b/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/MoveToNextStepUpdateTaskTests.java @@ -15,13 +15,10 @@ import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.xpack.core.indexlifecycle.LifecyclePolicy; import org.elasticsearch.xpack.core.indexlifecycle.LifecycleSettings; import org.elasticsearch.xpack.core.indexlifecycle.MockStep; -import org.elasticsearch.xpack.core.indexlifecycle.Phase; import org.elasticsearch.xpack.core.indexlifecycle.Step; import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey; -import org.elasticsearch.xpack.core.indexlifecycle.TestLifecycleType; import org.junit.Before; import java.util.Collections; @@ -29,8 +26,6 @@ import java.util.HashMap; import java.util.Map; import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.sameInstance; -import static org.mockito.Mockito.mock; public class MoveToNextStepUpdateTaskTests extends ESTestCase { diff --git a/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java index 26e076960c9..3d0c328c18c 100644 --- a/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/index-lifecycle/src/test/java/org/elasticsearch/xpack/indexlifecycle/TimeSeriesLifecycleActionsIT.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.indexlifecycle; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; +import org.elasticsearch.client.Request; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; @@ -28,7 +29,6 @@ import org.elasticsearch.xpack.core.indexlifecycle.TimeseriesLifecycleType; import org.junit.Before; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Map; @@ -88,8 +88,10 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase { createIndexWithSettings(index, Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)); for (int i = 0; i < randomIntBetween(2, 10); i++) { - client().performRequest("PUT", index + "/_doc/" + i, singletonMap("refresh", "true"), - new StringEntity("{\"a\": \"test\"}", ContentType.APPLICATION_JSON)); + Request request = new Request("PUT", index + "/_doc/" + i); + request.addParameter("refresh", "true"); + request.setEntity(new StringEntity("{\"a\": \"test\"}", ContentType.APPLICATION_JSON)); + client().performRequest(request); } Supplier numSegments = () -> { @@ -139,7 +141,9 @@ public class TimeSeriesLifecycleActionsIT extends ESRestTestCase { lifecyclePolicy.toXContent(builder, null); final StringEntity entity = new StringEntity( "{ \"policy\":" + Strings.toString(builder) + "}", ContentType.APPLICATION_JSON); - client().performRequest("PUT", "_xpack/index_lifecycle/" + policy, Collections.emptyMap(), entity); + Request request = new Request("PUT", "_xpack/index_lifecycle/" + policy); + request.setEntity(entity); + client().performRequest(request); } private void createIndexWithSettings(String index, Settings.Builder settings) throws IOException {