@Test public void testIndexCreationOptions() throws InterruptedException, BackendException { final int shards = 77; ElasticsearchRunner esr = new ElasticsearchRunner(".", "indexCreationOptions.yml"); esr.start(); CommonsConfiguration cc = new CommonsConfiguration(new BaseConfiguration()); cc.set("index." + INDEX_NAME + ".elasticsearch.create.ext.number_of_shards", String.valueOf(shards)); cc.set("index." + INDEX_NAME + ".elasticsearch.ext.cluster.name", "indexCreationOptions"); ModifiableConfiguration config = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE); config.set(INTERFACE, ElasticSearchSetup.NODE.toString(), INDEX_NAME); Configuration indexConfig = config.restrictTo(INDEX_NAME); IndexProvider idx = new ElasticSearchIndex(indexConfig); simpleWriteAndQuery(idx); ImmutableSettings.Builder settingsBuilder = ImmutableSettings.settingsBuilder(); settingsBuilder.put("discovery.zen.ping.multicast.enabled", "false"); settingsBuilder.put("discovery.zen.ping.unicast.hosts", "localhost,127.0.0.1:9300"); settingsBuilder.put("cluster.name", "indexCreationOptions"); NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder().settings(settingsBuilder.build()); nodeBuilder.client(true).data(false).local(false); Node n = nodeBuilder.build().start(); GetSettingsResponse response = n.client().admin().indices().getSettings(new GetSettingsRequest().indices("titan")).actionGet(); assertEquals(String.valueOf(shards), response.getSetting("titan", "index.number_of_shards")); idx.close(); n.stop(); esr.stop(); }
@Override public synchronized void close() throws IOException { if (lifecycle.started()) { stop();
@Override public Node stop() { return nodeDelegate.stop(); }
@Override public Node stop() { return nodeDelegate.stop(); }
/** * hook for JSVC */ @Override public void stop() { super.stop(); if (node != null) node.stop(); }
@Override public void shutdown() { client.close(); if (inProcessNode != null) { inProcessNode.stop(); inProcessNode = null; } if (propertyNameVisibilitiesStore instanceof Closeable) { try { ((Closeable) propertyNameVisibilitiesStore).close(); } catch (IOException e) { Throwables.propagate(e); } } }
BasicConfigurator.configure(); Node node = NodeBuilder.nodeBuilder().local(true).node(); node.start(); while (!node.isClosed()) { try { Thread.sleep(60*1000); } catch (InterruptedException e) { node.close(); } } node.stop();
private static void stopNode() throws IOException { if (ElassandraDaemon.instance != null) { Node node = ElassandraDaemon.instance.node(); if (node != null) node.stop(); ElassandraDaemon.instance.node(null); IOUtils.close(node); } }
elasticSearchNode.stop(); elasticSearchNode.close();
@Override public synchronized void close() throws IOException { if (lifecycle.started()) { stop();
@Override public synchronized void close() throws IOException { if (lifecycle.started()) { stop();
@Override public synchronized void close() { if (lifecycle.started()) { stop();