use of org.elasticsearch.common.cli.Terminal in project crate by crate.
the class NodeSettingsTest method doSetup.
private void doSetup() throws IOException {
// mute log4j warning by configuring a dummy logger
if (!loggingConfigured) {
Logger root = Logger.getRootLogger();
root.removeAllAppenders();
root.setLevel(Level.OFF);
root.addAppender(new NullAppender());
loggingConfigured = true;
}
tmp.create();
Settings.Builder builder = Settings.settingsBuilder().put("node.name", "node-test").put("node.data", true).put("index.store.type", "default").put("index.store.fs.memory.enabled", "true").put("gateway.type", "default").put("path.home", createConfigPath()).put("index.number_of_shards", "1").put("index.number_of_replicas", "0").put("cluster.routing.schedule", "50ms").put("node.local", true);
Terminal terminal = Terminal.DEFAULT;
Environment environment = CrateSettingsPreparer.prepareEnvironment(builder.build(), terminal);
node = new CrateNode(environment);
node.start();
client = node.client();
client.admin().indices().prepareCreate("test").execute().actionGet();
}
use of org.elasticsearch.common.cli.Terminal in project crate by crate.
the class NodeSettingsTest method testInvalidUnicastHost.
@Test
public void testInvalidUnicastHost() throws Exception {
Settings.Builder builder = Settings.settingsBuilder().put("discovery.zen.ping.multicast.enabled", false).put("discovery.zen.ping.unicast.hosts", "nonexistinghost:4300").put("path.home", createConfigPath());
Terminal terminal = Terminal.DEFAULT;
Environment environment = CrateSettingsPreparer.prepareEnvironment(builder.build(), terminal);
try {
node = new CrateNode(environment);
fail("Exception expected (failed to resolve address)");
} catch (Throwable t) {
assertThat(t, instanceOf(CreationException.class));
Throwable rootCause = ((CreationException) t).getErrorMessages().iterator().next().getCause();
assertThat(rootCause, instanceOf(IllegalArgumentException.class));
assertThat(rootCause.getMessage(), is("Failed to resolve address for [nonexistinghost:4300]"));
}
}
Aggregations