I'm new to writing elastic search plugin and I am still getting through the basics. I'd like to be able to test and debug my plugin from IDE. I rely on breakpoints and tracing the code to figure out what is going on.
I just realized that with ESIntegTestCase the mock cluster is not bound to http. I prefer to be able to interact with the server from the browser. I understand that this practice has been continued for good reasons and is not the default anymore. However, I'm wondering if it is possible to have http enabled anyhow. Thanks.
Here is the class I have
public class BasicPluginIntegrationTest extends ESIntegTestCase {
private Client client;
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singleton(BasicPlugin.class);
}
@Override
protected Settings nodeSettings(int nodeOrdinal) {
int randomPort = 9200; // randomIntBetween(49152, 65525);
System.out.println("Hani " + NetworkModule.HTTP_ENABLED.getKey());
Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal))
.put(NetworkModule.HTTP_ENABLED.getKey(), true)
.put(HttpTransportSettings.SETTING_HTTP_PORT.getKey(), randomPort).put("network.host", "127.0.0.1");
Settings settings = builder.build();
return settings;
}
@Test
public void testLive() {
System.out.println("Server live, hit enter to quit");
(new Scanner(System.in)).nextLine();
}
}
I am getting the following error
java.lang.IllegalStateException: Unsupported http.type []
at org.elasticsearch.common.network.NetworkModule.getHttpServerTransportSupplier(NetworkModule.java:194)
at org.elasticsearch.node.Node.<init>(Node.java:396)
at org.elasticsearch.node.MockNode.<init>(MockNode.java:61)
at org.elasticsearch.test.InternalTestCluster.buildNode(InternalTestCluster.java:616)
at org.elasticsearch.test.InternalTestCluster.reset(InternalTestCluster.java:1048)
at org.elasticsearch.test.InternalTestCluster.beforeTest(InternalTestCluster.java:986)
at org.elasticsearch.test.ESIntegTestCase.beforeInternal(ESIntegTestCase.java:353)
at org.elasticsearch.test.ESIntegTestCase.before(ESIntegTestCase.java:1989)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1713)
at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:941)
at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:957)
at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
at o...