[Watcher] Removed not needed usages of `com.google.common.*` classes.

Original commit: elastic/x-pack-elasticsearch@a8dea17a90
This commit is contained in:
Martijn van Groningen 2017-02-09 10:40:30 +01:00
parent 2838946d8b
commit 5185e06631
3 changed files with 13 additions and 14 deletions

View File

@ -6,7 +6,6 @@
package org.elasticsearch.xpack.watcher.actions.hipchat; package org.elasticsearch.xpack.watcher.actions.hipchat;
import com.google.common.base.Objects;
import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
@ -19,6 +18,7 @@ import org.elasticsearch.xpack.notification.hipchat.SentMessages;
import org.elasticsearch.xpack.watcher.actions.Action; import org.elasticsearch.xpack.watcher.actions.Action;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
public class HipChatAction implements Action { public class HipChatAction implements Action {
@ -46,14 +46,14 @@ public class HipChatAction implements Action {
HipChatAction that = (HipChatAction) o; HipChatAction that = (HipChatAction) o;
return Objects.equal(account, that.account) && return Objects.equals(account, that.account) &&
Objects.equal(message, that.message) && Objects.equals(message, that.message) &&
Objects.equal(proxy, that.proxy); Objects.equals(proxy, that.proxy);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(account, message, proxy); return Objects.hash(account, message, proxy);
} }
@Override @Override

View File

@ -6,8 +6,6 @@
package org.elasticsearch.xpack.notification.email.attachment; package org.elasticsearch.xpack.notification.email.attachment;
import com.fasterxml.jackson.core.io.JsonEOFException; import com.fasterxml.jackson.core.io.JsonEOFException;
import com.google.common.collect.Maps;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.MapBuilder;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -148,7 +146,7 @@ public class ReportingAttachmentParserTests extends ESTestCase {
String content = randomAsciiOfLength(200); String content = randomAsciiOfLength(200);
String path = "/ovb/api/reporting/jobs/download/iu5zfzvk15oa8990bfas9wy2"; String path = "/ovb/api/reporting/jobs/download/iu5zfzvk15oa8990bfas9wy2";
String randomContentType = randomAsciiOfLength(20); String randomContentType = randomAsciiOfLength(20);
Map<String, String[]> headers = Maps.newHashMap(); Map<String, String[]> headers = new HashMap<>();
headers.put("Content-Type", new String[] { randomContentType }); headers.put("Content-Type", new String[] { randomContentType });
when(httpClient.execute(any(HttpRequest.class))) when(httpClient.execute(any(HttpRequest.class)))
.thenReturn(new HttpResponse(200, "{\"path\":\""+ path +"\", \"other\":\"content\"}")) .thenReturn(new HttpResponse(200, "{\"path\":\""+ path +"\", \"other\":\"content\"}"))

View File

@ -5,8 +5,6 @@
*/ */
package org.elasticsearch.xpack.watcher.history; package org.elasticsearch.xpack.watcher.history;
import com.google.common.collect.Lists;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.MockScriptPlugin; import org.elasticsearch.script.MockScriptPlugin;
@ -15,9 +13,9 @@ import org.elasticsearch.script.ScriptType;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.xpack.watcher.client.WatchSourceBuilder; 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.AlwaysCondition;
import org.elasticsearch.xpack.watcher.condition.CompareCondition; 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.NeverCondition;
import org.elasticsearch.xpack.watcher.condition.ScriptCondition; import org.elasticsearch.xpack.watcher.condition.ScriptCondition;
import org.elasticsearch.xpack.watcher.execution.ExecutionState; 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.test.AbstractWatcherIntegrationTestCase;
import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse; import org.elasticsearch.xpack.watcher.transport.actions.put.PutWatchResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -98,7 +98,7 @@ public class HistoryActionConditionTests extends AbstractWatcherIntegrationTestC
final Condition scriptConditionFailsHard = mockScriptCondition("throw new IllegalStateException('failed');"); final Condition scriptConditionFailsHard = mockScriptCondition("throw new IllegalStateException('failed');");
final List<Condition> actionConditionsWithFailure = final List<Condition> actionConditionsWithFailure =
Lists.newArrayList(scriptConditionFailsHard, conditionPasses, AlwaysCondition.INSTANCE); Arrays.asList(scriptConditionFailsHard, conditionPasses, AlwaysCondition.INSTANCE);
Collections.shuffle(actionConditionsWithFailure, random()); Collections.shuffle(actionConditionsWithFailure, random());
@ -143,7 +143,7 @@ public class HistoryActionConditionTests extends AbstractWatcherIntegrationTestC
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testActionConditionWithFailures() throws Exception { public void testActionConditionWithFailures() throws Exception {
final String id = "testActionConditionWithFailures"; final String id = "testActionConditionWithFailures";
final List<Condition> actionConditionsWithFailure = Lists.newArrayList(conditionFails, conditionPasses, AlwaysCondition.INSTANCE); final List<Condition> actionConditionsWithFailure = Arrays.asList(conditionFails, conditionPasses, AlwaysCondition.INSTANCE);
Collections.shuffle(actionConditionsWithFailure, random()); Collections.shuffle(actionConditionsWithFailure, random());
@ -187,7 +187,8 @@ public class HistoryActionConditionTests extends AbstractWatcherIntegrationTestC
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testActionCondition() throws Exception { public void testActionCondition() throws Exception {
final String id = "testActionCondition"; final String id = "testActionCondition";
final List<Condition> actionConditions = Lists.newArrayList(conditionPasses); final List<Condition> actionConditions = new ArrayList<>();
actionConditions.add(conditionPasses);
if (randomBoolean()) { if (randomBoolean()) {
actionConditions.add(AlwaysCondition.INSTANCE); actionConditions.add(AlwaysCondition.INSTANCE);