summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java
diff options
context:
space:
mode:
authorRyan Ernst <ryan@iernst.net>2015-08-10 14:04:45 -0700
committerRyan Ernst <ryan@iernst.net>2015-08-10 14:04:45 -0700
commit40f119d85a4eaa39d0a6e594e46f70de725557f0 (patch)
treedb093bacb57ed77e4218949265bdcb7186cb9424 /core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java
parent13a347239a48d71486692a72c066e940dec8921b (diff)
This method on settings loaded a class, based on a setting value, using
the default classloader. It had all kinds of leniency in how the classname was found, and simply cannot work with plugins having isolated classloaders. This change removes that method. Some of the uses of it were for custom extension points, like custom repository or discovery types. A lot were just there to plugin mock implementations for tests. For the settings that were legitimate, all now support plugins adding the given setting via onModule. For those that were specific to tests for mocks, they now use Classes.loadClass (a helper around Class.forName). This is a temporary measure until (in a future PR) tests can change the implementation via package private statics. I also removed a number of unnecessary intermediate modules, added a "jvm-example" plugin that can be filled in in the future as a smoke test for breaking plugins, and gave some documentation to "spawn" modules interface. closes #12643 closes #12656
Diffstat (limited to 'core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java')
-rw-r--r--core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java b/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java
index 1b95665609..3d017cf8f6 100644
--- a/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java
+++ b/core/src/test/java/org/elasticsearch/action/IndicesRequestIT.java
@@ -89,6 +89,7 @@ import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.script.Script;
import org.elasticsearch.search.action.SearchServiceTransportAction;
import org.elasticsearch.test.ESIntegTestCase;
@@ -143,7 +144,7 @@ public class IndicesRequestIT extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.settingsBuilder()
.put(super.nodeSettings(nodeOrdinal))
- .put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, InterceptingTransportService.class.getName())
+ .extendArray("plugin.types", InterceptingTransportService.Plugin.class.getName())
.build();
}
@@ -843,6 +844,24 @@ public class IndicesRequestIT extends ESIntegTestCase {
public static class InterceptingTransportService extends TransportService {
+ public static class Plugin extends AbstractPlugin {
+ @Override
+ public String name() {
+ return "intercepting-transport-service";
+ }
+ @Override
+ public String description() {
+ return "an intercepting transport service for testing";
+ }
+ public void onModule(TransportModule transportModule) {
+ transportModule.addTransportService("intercepting", InterceptingTransportService.class);
+ }
+ @Override
+ public Settings additionalSettings() {
+ return Settings.builder().put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, "intercepting").build();
+ }
+ }
+
private final Set<String> actions = new HashSet<>();
private final Map<String, List<TransportRequest>> requests = new HashMap<>();