From d013ec2fbd1ddeab41f1ab6c92ddb88d29d220c5 Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 23 May 2019 10:26:58 -0600 Subject: [PATCH] Remove MonitoringClient from x-pack This commit removes the monitoring client from x-pack. This class is a relic of the TransportClient and was only used in a test. --- .../monitoring/client/MonitoringClient.java | 60 ------------------- .../local/LocalExporterIntegTests.java | 2 +- .../test/MonitoringIntegTestCase.java | 5 -- 3 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/client/MonitoringClient.java diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/client/MonitoringClient.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/client/MonitoringClient.java deleted file mode 100644 index 2dba6e6a4664f..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/client/MonitoringClient.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.xpack.core.monitoring.client; - -import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction; -import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkRequest; -import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkRequestBuilder; -import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkResponse; - -import java.util.Map; - -public class MonitoringClient { - - private final Client client; - - @Inject - public MonitoringClient(Client client) { - this.client = client; - } - - - /** - * Creates a request builder that bulk index monitoring documents. - * - * @return The request builder - */ - public MonitoringBulkRequestBuilder prepareMonitoringBulk() { - return new MonitoringBulkRequestBuilder(client); - } - - /** - * Executes a bulk of index operations that concern monitoring documents. - * - * @param request The monitoring bulk request - * @param listener A listener to be notified with a result - */ - public void bulk(MonitoringBulkRequest request, ActionListener listener) { - client.execute(MonitoringBulkAction.INSTANCE, request, listener); - } - - /** - * Executes a bulk of index operations that concern monitoring documents. - * - * @param request The monitoring bulk request - */ - public ActionFuture bulk(MonitoringBulkRequest request) { - return client.execute(MonitoringBulkAction.INSTANCE, request); - } - - public MonitoringClient filterWithHeader(Map headers) { - return new MonitoringClient(client.filterWithHeader(headers)); - } -} diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterIntegTests.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterIntegTests.java index 5db71f72cf6ef..137721f84462b 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterIntegTests.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterIntegTests.java @@ -105,7 +105,7 @@ public void testExport() throws Exception { } assertBusy(() -> { - MonitoringBulkRequestBuilder bulk = monitoringClient().prepareMonitoringBulk(); + MonitoringBulkRequestBuilder bulk = new MonitoringBulkRequestBuilder(client()); monitoringDocs.forEach(bulk::add); assertEquals(RestStatus.OK, bulk.get().status()); refresh(); diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java index c3921b7e7199b..6917fd5c5697e 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/test/MonitoringIntegTestCase.java @@ -19,7 +19,6 @@ import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.store.MockFSIndexStore; import org.elasticsearch.test.transport.MockTransportService; -import org.elasticsearch.xpack.core.monitoring.client.MonitoringClient; import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringTemplateUtils; import org.elasticsearch.xpack.core.monitoring.test.MockPainlessScriptEngine; import org.elasticsearch.xpack.monitoring.LocalStateMonitoring; @@ -74,10 +73,6 @@ protected Collection> nodePlugins() { MockIngestPlugin.class, CommonAnalysisPlugin.class); } - protected MonitoringClient monitoringClient() { - return new MonitoringClient(client()); - } - @Override protected Set excludeTemplates() { return new HashSet<>(monitoringTemplateNames());