diff --git a/elasticsearch/license/base/src/test/java/org/elasticsearch/license/core/LicenseSerializationTests.java b/elasticsearch/license/base/src/test/java/org/elasticsearch/license/core/LicenseSerializationTests.java index b1947ee971b..950e6db6e7c 100644 --- a/elasticsearch/license/base/src/test/java/org/elasticsearch/license/core/LicenseSerializationTests.java +++ b/elasticsearch/license/base/src/test/java/org/elasticsearch/license/core/LicenseSerializationTests.java @@ -49,7 +49,7 @@ public class LicenseSerializationTests extends ESTestCase { XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON); license.toXContent(builder, new ToXContent.MapParams(Collections.singletonMap(License.REST_VIEW_MODE, "true"))); builder.flush(); - Map map = XContentHelper.convertToMap(builder.bytesStream().bytes(), false).v2(); + Map map = XContentHelper.convertToMap(builder.bytes(), false).v2(); // should have an extra status field, human readable issue_data and expiry_date assertThat(map.get("status"), notNullValue()); @@ -59,14 +59,14 @@ public class LicenseSerializationTests extends ESTestCase { builder = XContentFactory.contentBuilder(XContentType.JSON); license.toXContent(builder, ToXContent.EMPTY_PARAMS); builder.flush(); - map = XContentHelper.convertToMap(builder.bytesStream().bytes(), false).v2(); + map = XContentHelper.convertToMap(builder.bytes(), false).v2(); assertThat(map.get("status"), nullValue()); license = TestUtils.generateLicenses(new TestUtils.LicenseSpec(validLicenseIssueDate, validLicenseExpiryDate)); builder = XContentFactory.contentBuilder(XContentType.JSON); license.toXContent(builder, new ToXContent.MapParams(Collections.singletonMap(License.REST_VIEW_MODE, "true"))); builder.flush(); - map = XContentHelper.convertToMap(builder.bytesStream().bytes(), false).v2(); + map = XContentHelper.convertToMap(builder.bytes(), false).v2(); // should have an extra status field, human readable issue_data and expiry_date assertThat(map.get("status"), notNullValue()); @@ -76,14 +76,14 @@ public class LicenseSerializationTests extends ESTestCase { builder = XContentFactory.contentBuilder(XContentType.JSON); license.toXContent(builder, ToXContent.EMPTY_PARAMS); builder.flush(); - map = XContentHelper.convertToMap(builder.bytesStream().bytes(), false).v2(); + map = XContentHelper.convertToMap(builder.bytes(), false).v2(); assertThat(map.get("status"), nullValue()); license = TestUtils.generateLicenses(new TestUtils.LicenseSpec(invalidLicenseIssueDate, validLicenseExpiryDate)); builder = XContentFactory.contentBuilder(XContentType.JSON); license.toXContent(builder, new ToXContent.MapParams(Collections.singletonMap(License.REST_VIEW_MODE, "true"))); builder.flush(); - map = XContentHelper.convertToMap(builder.bytesStream().bytes(), false).v2(); + map = XContentHelper.convertToMap(builder.bytes(), false).v2(); // should have an extra status field, human readable issue_data and expiry_date assertThat(map.get("status"), notNullValue()); @@ -93,7 +93,7 @@ public class LicenseSerializationTests extends ESTestCase { builder = XContentFactory.contentBuilder(XContentType.JSON); license.toXContent(builder, ToXContent.EMPTY_PARAMS); builder.flush(); - map = XContentHelper.convertToMap(builder.bytesStream().bytes(), false).v2(); + map = XContentHelper.convertToMap(builder.bytes(), false).v2(); assertThat(map.get("status"), nullValue()); } } diff --git a/elasticsearch/qa/shield-audit-tests/build.gradle b/elasticsearch/qa/shield-audit-tests/build.gradle index 32f50580d7f..90c5855c734 100644 --- a/elasticsearch/qa/shield-audit-tests/build.gradle +++ b/elasticsearch/qa/shield-audit-tests/build.gradle @@ -13,7 +13,7 @@ integTest { 'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin' waitCondition = { node, ant -> File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://localhost:${node.httpPort()}", + ant.get(src: "http://${node.httpUri()}", dest: tmpFile.toString(), username: 'test_user', password: 'changeme', diff --git a/elasticsearch/qa/shield-client-tests/build.gradle b/elasticsearch/qa/shield-client-tests/build.gradle index 1a3ea6ccaf8..6a295696b96 100644 --- a/elasticsearch/qa/shield-client-tests/build.gradle +++ b/elasticsearch/qa/shield-client-tests/build.gradle @@ -13,7 +13,7 @@ integTest { 'bin/x-pack/esusers', 'useradd', 'transport', '-p', 'changeme', '-r', 'transport_client' waitCondition = { node, ant -> File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://localhost:${node.httpPort()}", + ant.get(src: "http://${node.httpUri()}", dest: tmpFile.toString(), username: 'test_user', password: 'changeme', diff --git a/elasticsearch/qa/shield-core-rest-tests/build.gradle b/elasticsearch/qa/shield-core-rest-tests/build.gradle index 4da9a0b405e..ef5d461a0a4 100644 --- a/elasticsearch/qa/shield-core-rest-tests/build.gradle +++ b/elasticsearch/qa/shield-core-rest-tests/build.gradle @@ -37,7 +37,7 @@ integTest { 'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin' waitCondition = { node, ant -> File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://localhost:${node.httpPort()}", + ant.get(src: "http://${node.httpUri()}", dest: tmpFile.toString(), username: 'test_user', password: 'changeme', diff --git a/elasticsearch/qa/shield-example-realm/build.gradle b/elasticsearch/qa/shield-example-realm/build.gradle index acd928f580f..dcd703124d5 100644 --- a/elasticsearch/qa/shield-example-realm/build.gradle +++ b/elasticsearch/qa/shield-example-realm/build.gradle @@ -26,7 +26,7 @@ integTest { 'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin' waitCondition = { node, ant -> File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://localhost:${node.httpPort()}", + ant.get(src: "http://${node.httpUri()}", dest: tmpFile.toString(), username: 'test_user', password: 'changeme', diff --git a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle index 8c24e025c6e..2bda5811e46 100644 --- a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle +++ b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle @@ -18,6 +18,23 @@ task createKey(type: LoggedExec) { project.delete(keystore.parentFile) keystore.parentFile.mkdirs() } + String subjectAlternateNames = 'san=dns:localhost,ip:127.0.0.1' + // some machines have a different name for ipv6 loopback, + // at least on ubuntu its ip6-localhost. other machines, like windows, + // won't resolve it back to any hostname at all. Try to setup ipv6 to + // work in all cases. + try { + String localhost6 = InetAddress.getByName("::1").getCanonicalHostName() + if (!localhost6.equals("localhost")) { + if (localhost6.startsWith("0")) { + subjectAlternateNames += ",ip:" + localhost6 + } else { + subjectAlternateNames += ",dns:" + localhost6 + } + } + } catch (UnknownHostException ok) { + // e.g. no ipv6 support + } executable = 'keytool' standardInput = new ByteArrayInputStream('FirstName LastName\nUnit\nOrganization\nCity\nState\nNL\nyes\n\n'.getBytes('UTF-8')) args '-genkey', @@ -26,7 +43,7 @@ task createKey(type: LoggedExec) { '-keyalg', 'RSA', '-keysize', '2048', '-validity', '712', - '-ext', 'san=dns:localhost,ip:127.0.0.1', + '-ext', subjectAlternateNames, '-storepass', 'keypass' } @@ -43,8 +60,6 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':plugins:') }.each integTest { cluster { - // TODO: use some variable here for port number - systemProperty 'es.marvel.agent.exporter.es.hosts', 'https://marvel_export:changeme@localhost:9400' systemProperty 'es.marvel.agent.exporter.es.ssl.truststore.path', keystore.name systemProperty 'es.marvel.agent.exporter.es.ssl.truststore.password', 'keypass' systemProperty 'es.shield.transport.ssl', 'true' diff --git a/elasticsearch/qa/smoke-test-plugins/build.gradle b/elasticsearch/qa/smoke-test-plugins/build.gradle index ec1db099338..bd139c3701c 100644 --- a/elasticsearch/qa/smoke-test-plugins/build.gradle +++ b/elasticsearch/qa/smoke-test-plugins/build.gradle @@ -21,7 +21,7 @@ integTest { 'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin' waitCondition = { node, ant -> File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://localhost:${node.httpPort()}", + ant.get(src: "http://${node.httpUri()}", dest: tmpFile.toString(), username: 'test_user', password: 'changeme', diff --git a/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherRestTestCase.java b/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherRestTestCase.java index bc998eb11c4..067a4176588 100644 --- a/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherRestTestCase.java +++ b/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherRestTestCase.java @@ -3,7 +3,7 @@ * 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.watcher.test.rest; +package org.elasticsearch.smoketest; import com.carrotsearch.randomizedtesting.annotations.Name; import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; diff --git a/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherWithGroovyIT.java b/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherWithGroovyIT.java index fd8232869d4..f4d1d4993a5 100644 --- a/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherWithGroovyIT.java +++ b/elasticsearch/qa/smoke-test-watcher-with-groovy/src/test/java/org/elasticsearch/smoketest/WatcherWithGroovyIT.java @@ -3,7 +3,7 @@ * 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.watcher.test.rest; +package org.elasticsearch.smoketest; import org.elasticsearch.test.rest.RestTestCandidate; diff --git a/elasticsearch/qa/smoke-test-watcher-with-shield/build.gradle b/elasticsearch/qa/smoke-test-watcher-with-shield/build.gradle index 16eb7e07509..3891ee268c2 100644 --- a/elasticsearch/qa/smoke-test-watcher-with-shield/build.gradle +++ b/elasticsearch/qa/smoke-test-watcher-with-shield/build.gradle @@ -15,7 +15,8 @@ integTest { dependsOn copyWatcherRestTests systemProperty 'tests.rest.blacklist', ['hijack/10_basic/*', - 'array_compare_watch/10_basic/Basic array_compare watch'].join(',') + 'array_compare_watch/10_basic/Basic array_compare watch', + 'getting_started/10_monitor_cluster_health/Getting started - Monitor cluster health'].join(',') cluster { plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack') @@ -28,7 +29,7 @@ integTest { 'bin/x-pack/esusers', 'useradd', 'powerless_user', '-p', 'changeme', '-r', 'crapy_role' waitCondition = { node, ant -> File tmpFile = new File(node.cwd, 'wait.success') - ant.get(src: "http://localhost:${node.httpPort()}", + ant.get(src: "http://${node.httpUri()}", dest: tmpFile.toString(), username: 'test_admin', password: 'changeme', diff --git a/elasticsearch/x-pack/build.gradle b/elasticsearch/x-pack/build.gradle index 25287b5e481..5e8b7fa9ab2 100644 --- a/elasticsearch/x-pack/build.gradle +++ b/elasticsearch/x-pack/build.gradle @@ -70,7 +70,6 @@ compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,- ext.expansions = [ 'project.version': version, - 'integ.http.port': integTest.cluster.baseHttpPort ] processResources { @@ -117,12 +116,14 @@ bundlePlugin { from('watcher/bin/watcher') { into 'bin' } +} - integTest { - cluster { - // TODO set up tests so that shield can be enabled or disabled - systemProperty 'es.shield.enabled', 'false' - } +integTest { + // TODO: fix this rest test to not depend on a hardcoded port! + systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*' + cluster { + // TODO set up tests so that shield can be enabled or disabled + systemProperty 'es.shield.enabled', 'false' } } diff --git a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/PutLicenseResponseTests.java b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/PutLicenseResponseTests.java index 5bec19a549c..1f38970fa2b 100644 --- a/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/PutLicenseResponseTests.java +++ b/elasticsearch/x-pack/license-plugin/src/test/java/org/elasticsearch/license/plugin/PutLicenseResponseTests.java @@ -42,7 +42,7 @@ public class PutLicenseResponseTests extends ESTestCase { response.toXContent(contentBuilder, ToXContent.EMPTY_PARAMS); contentBuilder.endObject(); - Map map = XContentHelper.convertToMap(contentBuilder.bytesStream().bytes(), false).v2(); + Map map = XContentHelper.convertToMap(contentBuilder.bytes(), false).v2(); assertThat(map.containsKey("acknowledged"), equalTo(true)); boolean actualAcknowledged = (boolean) map.get("acknowledged"); assertThat(actualAcknowledged, equalTo(acknowledged)); diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java index 9713d1d9aeb..00029426569 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/exporter/http/HttpExporter.java @@ -199,18 +199,15 @@ public class HttpExporter extends Exporter { } builder.endObject(); builder.endObject(); - - // Adds action metadata line bulk separator - builder.flush(); // Flush is needed here because the separator is written directly in the builder's stream - builder.stream().write(builder.contentType().xContent().streamSeparator()); - - // Render the MarvelDoc - renderer.render(marvelDoc, xContentType, out); - - // Adds final bulk separator - builder.flush(); - builder.stream().write(builder.contentType().xContent().streamSeparator()); } + // Adds action metadata line bulk separator + out.write(xContentType.xContent().streamSeparator()); + + // Render the MarvelDoc + renderer.render(marvelDoc, xContentType, out); + + // Adds final bulk separator + out.write(xContentType.xContent().streamSeparator()); } @SuppressWarnings("unchecked") diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/action/ShieldActionMapperTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/action/ShieldActionMapperTests.java index 189a15e5ef1..0a92383496c 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/action/ShieldActionMapperTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/action/ShieldActionMapperTests.java @@ -61,7 +61,7 @@ public class ShieldActionMapperTests extends ESTestCase { } clearScrollRequest.addScrollId("_all"); //make sure that wherever the _all is among the scroll ids the action name gets translated - Collections.shuffle(clearScrollRequest.getScrollIds(), getRandom()); + Collections.shuffle(clearScrollRequest.getScrollIds(), random()); assertThat(shieldActionMapper.action(ClearScrollAction.NAME, clearScrollRequest), equalTo(ShieldActionMapper.CLUSTER_PERMISSION_SCROLL_CLEAR_ALL_NAME)); } diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authc/RealmsTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authc/RealmsTests.java index 31c205ff4d5..cdf4dfe6c7b 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authc/RealmsTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/authc/RealmsTests.java @@ -60,7 +60,7 @@ public class RealmsTests extends ESTestCase { for (int i = 0; i < factories.size() - 1; i++) { orders.add(i); } - Collections.shuffle(orders, getRandom()); + Collections.shuffle(orders, random()); Map orderToIndex = new HashMap<>(); for (int i = 0; i < factories.size() - 1; i++) { builder.put("shield.authc.realms.realm_" + i + ".type", "type_" + i); @@ -118,7 +118,7 @@ public class RealmsTests extends ESTestCase { for (int i = 0; i < factories.size() - 1; i++) { orders.add(i); } - Collections.shuffle(orders, getRandom()); + Collections.shuffle(orders, random()); Map orderToIndex = new HashMap<>(); for (int i = 0; i < factories.size() - 1; i++) { builder.put("shield.authc.realms.realm_" + i + ".type", "type_" + i); @@ -186,7 +186,7 @@ public class RealmsTests extends ESTestCase { for (int i = 0; i < factories.size() - 1; i++) { orders.add(i); } - Collections.shuffle(orders, getRandom()); + Collections.shuffle(orders, random()); Map orderToIndex = new HashMap<>(); for (int i = 0; i < factories.size() - 1; i++) { builder.put("shield.authc.realms.realm_" + i + ".type", "type_" + i); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/tribe/TribeShieldLoadedTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/tribe/TribeShieldLoadedTests.java index ebde440376a..7af1ff49d28 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/tribe/TribeShieldLoadedTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/tribe/TribeShieldLoadedTests.java @@ -8,11 +8,10 @@ package org.elasticsearch.shield.tribe; import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.Version; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.node.MockNode; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.xpack.XPackPlugin; import java.util.Arrays; @@ -42,7 +41,7 @@ public class TribeShieldLoadedTests extends ESTestCase { Settings.Builder builder = defaultSettings(); try { - NodeBuilder.nodeBuilder().settings(builder.build()).build(); + new Node(builder.build()); fail("node initialization should have failed due to missing shield plugin"); } catch(Throwable t) { assertThat(t.getMessage(), containsString("Missing mandatory plugins [shield]")); @@ -55,7 +54,7 @@ public class TribeShieldLoadedTests extends ESTestCase { Settings.Builder builder = addTribeSettings(defaultSettings(), "t2"); try { - NodeBuilder.nodeBuilder().settings(builder.build()).build(); + new Node(builder.build()); fail("node initialization should have failed due to missing shield plugin"); } catch(Throwable t) { assertThat(t.getMessage(), containsString("Missing mandatory plugins [shield]")); diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/ScheduleEngineTriggerBenchmark.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/ScheduleEngineTriggerBenchmark.java index 7043b8885aa..0ce9e76fd76 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/ScheduleEngineTriggerBenchmark.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/ScheduleEngineTriggerBenchmark.java @@ -5,9 +5,9 @@ */ package org.elasticsearch.watcher.test.bench; +import org.elasticsearch.common.Randomness; import org.elasticsearch.common.metrics.MeanMetric; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.watcher.support.clock.SystemClock; import org.elasticsearch.watcher.trigger.Trigger; import org.elasticsearch.watcher.trigger.TriggerEngine; @@ -22,7 +22,6 @@ import org.elasticsearch.watcher.trigger.schedule.engine.TickerScheduleTriggerEn import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.concurrent.atomic.AtomicBoolean; @@ -65,7 +64,7 @@ public class ScheduleEngineTriggerBenchmark { } ScheduleRegistry scheduleRegistry = new ScheduleRegistry(emptyMap()); List impls = new ArrayList<>(Arrays.asList(new String[]{"schedule", "ticker"})); - Collections.shuffle(impls); + Randomness.shuffle(impls); List results = new ArrayList<>(); for (String impl : impls) { diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherExecutorServiceBenchmark.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherExecutorServiceBenchmark.java index dc9c3842d72..cb70a829967 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherExecutorServiceBenchmark.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherExecutorServiceBenchmark.java @@ -11,21 +11,22 @@ import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.watcher.WatcherPlugin; -import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.node.MockNode; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.xpack.XPackPlugin; +import org.elasticsearch.watcher.WatcherPlugin; import org.elasticsearch.watcher.client.WatchSourceBuilder; import org.elasticsearch.watcher.client.WatcherClient; import org.elasticsearch.watcher.support.http.HttpRequestTemplate; import org.elasticsearch.watcher.transport.actions.put.PutWatchRequest; import org.elasticsearch.watcher.trigger.ScheduleTriggerEngineMock; import org.elasticsearch.watcher.trigger.TriggerModule; +import org.elasticsearch.xpack.XPackPlugin; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; import static org.elasticsearch.watcher.actions.ActionBuilders.indexAction; import static org.elasticsearch.watcher.condition.ConditionBuilders.scriptCondition; diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherScheduleEngineBenchmark.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherScheduleEngineBenchmark.java index cd50a14eace..f4a04f5ce7b 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherScheduleEngineBenchmark.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/watcher/test/bench/WatcherScheduleEngineBenchmark.java @@ -19,18 +19,15 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.node.MockNode; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.script.Script; import org.elasticsearch.search.aggregations.bucket.histogram.Histogram; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.metrics.percentiles.Percentiles; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.threadpool.ThreadPoolStats; -import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.watcher.WatcherState; import org.elasticsearch.watcher.actions.ActionBuilders; import org.elasticsearch.watcher.actions.logging.LoggingLevel; @@ -39,6 +36,7 @@ import org.elasticsearch.watcher.client.WatcherClient; import org.elasticsearch.watcher.history.HistoryStore; import org.elasticsearch.watcher.support.clock.Clock; import org.elasticsearch.watcher.watch.WatchStore; +import org.elasticsearch.xpack.XPackPlugin; import java.io.IOException; import java.util.Arrays; @@ -47,7 +45,9 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import static org.elasticsearch.search.aggregations.AggregationBuilders.*; +import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram; +import static org.elasticsearch.search.aggregations.AggregationBuilders.percentiles; +import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; import static org.elasticsearch.watcher.condition.ConditionBuilders.scriptCondition; import static org.elasticsearch.watcher.input.InputBuilders.searchInput; import static org.elasticsearch.watcher.trigger.TriggerBuilders.schedule; @@ -94,7 +94,7 @@ public class WatcherScheduleEngineBenchmark { // First clean everything and index the watcher (but not via put alert api!) - try (Node node = NodeBuilder.nodeBuilder().settings(SETTINGS).data(false).node()) { + try (Node node = new Node(Settings.builder().put(SETTINGS).put("node.data", false).build()).start()) { try (Client client = node.client()) { ClusterHealthResponse response = client.admin().cluster().prepareHealth().setWaitForNodes("2").get(); if (response.getNumberOfNodes() != 2 && response.getNumberOfDataNodes() != 1) {