org.elasticsearch.node.MockNode Java Examples

The following examples show how to use org.elasticsearch.node.MockNode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterJoinBenchmark.java    From siren-join with GNU Affero General Public License v3.0 6 votes vote down vote up
FilterJoinBenchmark() {
  Settings settings = Settings.builder()
    .put(FilterJoinCache.SIREN_FILTERJOIN_CACHE_ENABLED, false)
    .put("index.engine.robin.refreshInterval", "-1")
    .put("path.home", "./target/elasticsearch-benchmark/home/")
    .put("node.local", true)
    .put(SETTING_NUMBER_OF_SHARDS, NUM_SHARDS)
    .put(SETTING_NUMBER_OF_REPLICAS, NUM_REPLICAS)
    .put(IndexCacheModule.QUERY_CACHE_EVERYTHING, true)
    .build();

  this.nodes = new MockNode[2];
  this.nodes[0] = new MockNode(Settings.builder().put(settings).put("name", "node1").build(),
          Version.CURRENT, Collections.<Class<? extends Plugin>>singletonList(SirenJoinPlugin.class)).start();
  this.nodes[1] = new MockNode(Settings.builder().put(settings).put("name", "node2").build(),
          Version.CURRENT, Collections.<Class<? extends Plugin>>singletonList(SirenJoinPlugin.class)).start();
  this.client = nodes[0].client();
  this.random = new Random(System.currentTimeMillis());
}
 
Example #2
Source File: TermsByQueryBenchmark.java    From siren-join with GNU Affero General Public License v3.0 6 votes vote down vote up
TermsByQueryBenchmark() {
  Settings settings = Settings.builder()
    .put(FilterJoinCache.SIREN_FILTERJOIN_CACHE_ENABLED, false)
    .put("index.engine.robin.refreshInterval", "-1")
    .put("path.home", "./target/elasticsearch-benchmark/home/")
    .put("node.local", true)
    .put(SETTING_NUMBER_OF_SHARDS, NUM_SHARDS)
    .put(SETTING_NUMBER_OF_REPLICAS, NUM_REPLICAS)
    .build();

  this.nodes = new MockNode[2];
  this.nodes[0] = new MockNode(Settings.builder().put(settings).put("name", "node1").build(),
          Version.CURRENT, Collections.<Class<? extends Plugin>>singletonList(SirenJoinPlugin.class)).start();
  this.nodes[1] = new MockNode(Settings.builder().put(settings).put("name", "node2").build(),
          Version.CURRENT, Collections.<Class<? extends Plugin>>singletonList(SirenJoinPlugin.class)).start();
  this.client = nodes[0].client();
  this.random = new Random(System.currentTimeMillis());
}
 
Example #3
Source File: ElasticsearchCollectorTest.java    From karaf-decanter with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
    Collection plugins = Arrays.asList(Netty4Plugin.class);
    Settings settings = Settings.builder()
            .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), CLUSTER_NAME)
            .put(Node.NODE_NAME_SETTING.getKey(), "test")
            .put(NetworkModule.HTTP_TYPE_KEY, Netty4Plugin.NETTY_HTTP_TRANSPORT_NAME)
            .put(Environment.PATH_HOME_SETTING.getKey(), "target/data")
            .put(Environment.PATH_DATA_SETTING.getKey(), "target/data")
            .put("network.host", HOST)
            .put("http.port", HTTP_PORT)
            .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME)
            .put("transport.port", TRANSPORT_PORT)
            .build();
    node = new MockNode(settings, plugins);
    node.start();
}
 
Example #4
Source File: TestElasticsearchAppender.java    From karaf-decanter with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
    Collection plugins = Arrays.asList(Netty4Plugin.class);
    Settings settings = Settings.builder()
            .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), CLUSTER_NAME)
            .put(Node.NODE_NAME_SETTING.getKey(), "test")
            .put(NetworkModule.HTTP_TYPE_KEY, Netty4Plugin.NETTY_HTTP_TRANSPORT_NAME)
            .put(Environment.PATH_HOME_SETTING.getKey(), "target/data")
            .put(Environment.PATH_DATA_SETTING.getKey(), "target/data")
            .put("network.host", HOST)
            .put("http.port", HTTP_PORT)
            .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME)
            .put("transport.port", TRANSPORT_PORT)
            .build();
    node = new MockNode(settings, plugins);
    node.start();
}
 
Example #5
Source File: NodeTestUtils.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
private Node buildNode(String id) throws IOException {
    Settings nodeSettings = settingsBuilder()
            .put(getNodeSettings())
            .put("name", id)
            .build();
    logger.info("settings={}", nodeSettings.getAsMap());
    // ES 2.1 renders NodeBuilder as useless
    Node node = new MockNode(nodeSettings, HelperPlugin.class);
    AbstractClient client = (AbstractClient)node.client();
    nodes.put(id, node);
    clients.put(id, client);
    logger.info("clients={}", clients);
    return node;
}
 
Example #6
Source File: InternalTestCluster.java    From crate with Apache License 2.0 5 votes vote down vote up
NodeAndClient(String name, MockNode node, Settings originalNodeSettings, int nodeAndClientId) {
    this.node = node;
    this.name = name;
    this.originalNodeSettings = originalNodeSettings;
    this.nodeAndClientId = nodeAndClientId;
    markNodeDataDirsAsNotEligibleForWipe(node);
}