diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java index a6f9d7f7258..6e3ae34e271 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/watcher/actions/hipchat/HipChatAction.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.watcher.actions.hipchat; -import com.google.common.base.Objects; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.ParseField; @@ -19,6 +18,7 @@ import org.elasticsearch.xpack.notification.hipchat.SentMessages; import org.elasticsearch.xpack.watcher.actions.Action; import java.io.IOException; +import java.util.Objects; public class HipChatAction implements Action { @@ -46,14 +46,14 @@ public class HipChatAction implements Action { HipChatAction that = (HipChatAction) o; - return Objects.equal(account, that.account) && - Objects.equal(message, that.message) && - Objects.equal(proxy, that.proxy); + return Objects.equals(account, that.account) && + Objects.equals(message, that.message) && + Objects.equals(proxy, that.proxy); } @Override public int hashCode() { - return Objects.hashCode(account, message, proxy); + return Objects.hash(account, message, proxy); } @Override diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/email/attachment/ReportingAttachmentParserTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/email/attachment/ReportingAttachmentParserTests.java index 110e5969988..b75e2791b47 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/email/attachment/ReportingAttachmentParserTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/notification/email/attachment/ReportingAttachmentParserTests.java @@ -6,8 +6,6 @@ package org.elasticsearch.xpack.notification.email.attachment; import com.fasterxml.jackson.core.io.JsonEOFException; -import com.google.common.collect.Maps; - import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.settings.Settings; @@ -148,7 +146,7 @@ public class ReportingAttachmentParserTests extends ESTestCase { String content = randomAsciiOfLength(200); String path = "/ovb/api/reporting/jobs/download/iu5zfzvk15oa8990bfas9wy2"; String randomContentType = randomAsciiOfLength(20); - Map headers = Maps.newHashMap(); + Map headers = new HashMap<>(); headers.put("Content-Type", new String[] { randomContentType }); when(httpClient.execute(any(HttpRequest.class))) .thenReturn(new HttpResponse(200, "{\"path\":\""+ path +"\", \"other\":\"content\"}")) diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java index 770af038dc5..f6515752c92 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/watcher/history/HistoryActionConditionTests.java @@ -5,8 +5,6 @@ */ package org.elasticsearch.xpack.watcher.history; -import com.google.common.collect.Lists; - import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.MockScriptPlugin; @@ -15,9 +13,9 @@ import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; -import org.elasticsearch.xpack.watcher.condition.Condition; import org.elasticsearch.xpack.watcher.condition.AlwaysCondition; import org.elasticsearch.xpack.watcher.condition.CompareCondition; +import org.elasticsearch.xpack.watcher.condition.Condition; import org.elasticsearch.xpack.watcher.condition.NeverCondition; import org.elasticsearch.xpack.watcher.condition.ScriptCondition; import org.elasticsearch.xpack.watcher.execution.ExecutionState; @@ -25,6 +23,8 @@ import org.elasticsearch.xpack.watcher.input.Input; import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -98,7 +98,7 @@ public class HistoryActionConditionTests extends AbstractWatcherIntegrationTestC final Condition scriptConditionFailsHard = mockScriptCondition("throw new IllegalStateException('failed');"); final List actionConditionsWithFailure = - Lists.newArrayList(scriptConditionFailsHard, conditionPasses, AlwaysCondition.INSTANCE); + Arrays.asList(scriptConditionFailsHard, conditionPasses, AlwaysCondition.INSTANCE); Collections.shuffle(actionConditionsWithFailure, random()); @@ -143,7 +143,7 @@ public class HistoryActionConditionTests extends AbstractWatcherIntegrationTestC @SuppressWarnings("unchecked") public void testActionConditionWithFailures() throws Exception { final String id = "testActionConditionWithFailures"; - final List actionConditionsWithFailure = Lists.newArrayList(conditionFails, conditionPasses, AlwaysCondition.INSTANCE); + final List actionConditionsWithFailure = Arrays.asList(conditionFails, conditionPasses, AlwaysCondition.INSTANCE); Collections.shuffle(actionConditionsWithFailure, random()); @@ -187,7 +187,8 @@ public class HistoryActionConditionTests extends AbstractWatcherIntegrationTestC @SuppressWarnings("unchecked") public void testActionCondition() throws Exception { final String id = "testActionCondition"; - final List actionConditions = Lists.newArrayList(conditionPasses); + final List actionConditions = new ArrayList<>(); + actionConditions.add(conditionPasses); if (randomBoolean()) { actionConditions.add(AlwaysCondition.INSTANCE);