• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MockNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.elasticsearch.node.MockNode的典型用法代码示例。如果您正苦于以下问题:Java MockNode类的具体用法?Java MockNode怎么用?Java MockNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MockNode类属于org.elasticsearch.node包,在下文中一共展示了MockNode类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: assertTribeNodeSuccessfullyCreated

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
private static void assertTribeNodeSuccessfullyCreated(Settings extraSettings) throws Exception {
    //The tribe clients do need it to make sure they can find their corresponding tribes using the proper transport
    Settings settings = Settings.builder().put(NetworkModule.HTTP_ENABLED.getKey(), false).put("node.name", "tribe_node")
            .put("transport.type", MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME).put("discovery.type", "local")
            .put("tribe.t1.transport.type", MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME)
            .put("tribe.t2.transport.type",MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME)
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
            .put(extraSettings).build();

    try (Node node = new MockNode(settings, Arrays.asList(MockTcpTransportPlugin.class, TestZenDiscovery.TestPlugin.class)).start()) {
        try (Client client = node.client()) {
            assertBusy(() -> {
                ClusterState state = client.admin().cluster().prepareState().clear().setNodes(true).get().getState();
                assertThat(state.getClusterName().value(), equalTo("tribe_node_cluster"));
                assertThat(state.getNodes().getSize(), equalTo(5));
                for (DiscoveryNode discoveryNode : state.getNodes()) {
                    assertThat(discoveryNode.getName(), either(equalTo("tribe1_node")).or(equalTo("tribe2_node"))
                            .or(equalTo("tribe_node")).or(equalTo("tribe_node/t1")).or(equalTo("tribe_node/t2")));
                }
            });
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:TribeUnitTests.java


示例2: createTribes

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
@BeforeClass
public static void createTribes() throws NodeValidationException {
    Settings baseSettings = Settings.builder()
        .put(NetworkModule.HTTP_ENABLED.getKey(), false)
        .put("transport.type", MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME)
        .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
        .put(NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey(), 2)
        .build();

    final List<Class<? extends Plugin>> mockPlugins = Arrays.asList(MockTcpTransportPlugin.class, TestZenDiscovery.TestPlugin.class);
    tribe1 = new MockNode(
        Settings.builder()
            .put(baseSettings)
            .put("cluster.name", "tribe1")
            .put("node.name", "tribe1_node")
                .put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), random().nextLong())
            .build(), mockPlugins).start();
    tribe2 = new MockNode(
        Settings.builder()
            .put(baseSettings)
            .put("cluster.name", "tribe2")
            .put("node.name", "tribe2_node")
                .put(NodeEnvironment.NODE_ID_SEED_SETTING.getKey(), random().nextLong())
            .build(), mockPlugins).start();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:TribeUnitTests.java


示例3: FilterJoinBenchmark

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
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());
}
 
开发者ID:sirensolutions,项目名称:siren-join,代码行数:20,代码来源:FilterJoinBenchmark.java


示例4: TermsByQueryBenchmark

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
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());
}
 
开发者ID:sirensolutions,项目名称:siren-join,代码行数:19,代码来源:TermsByQueryBenchmark.java


示例5: main

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public static void main(String[] args) throws Throwable {
    Settings.Builder settings = Settings.builder();
    settings.put("http.cors.enabled", "true");
    settings.put("http.cors.allow-origin", "*");
    settings.put("cluster.name", AzureRepositoryF.class.getSimpleName());

    // Example for azure repo settings
    // settings.put("cloud.azure.storage.my_account1.account", "account_name");
    // settings.put("cloud.azure.storage.my_account1.key", "account_key");
    // settings.put("cloud.azure.storage.my_account1.default", true);
    // settings.put("cloud.azure.storage.my_account2.account", "account_name");
    // settings.put("cloud.azure.storage.my_account2.key", "account_key_secondary");

    final CountDownLatch latch = new CountDownLatch(1);
    final Node node = new MockNode(settings.build(), Collections.singletonList(AzureRepositoryPlugin.class));
    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            try {
                IOUtils.close(node);
            } catch (IOException e) {
                throw new ElasticsearchException(e);
            } finally {
                latch.countDown();
            }
        }
    });
    node.start();
    latch.await();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:AzureRepositoryF.java


示例6: createNode

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public static Node createNode() {
    Settings nodeSettings = Settings.settingsBuilder()
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put("index.number_of_shards", 5)
            .put("index.number_of_replica", 0)
            .build();
    // ES 2.1 renders NodeBuilder as useless
    Node node = new MockNode(nodeSettings, AggregationPlugin.class);
    node.start();
    return node;
}
 
开发者ID:jprante,项目名称:elasticsearch-aggregations,代码行数:13,代码来源:NodeTestUtils.java


示例7: createNode

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public static Node createNode() {
    Settings nodeSettings = Settings.settingsBuilder()
            .put("path.home", System.getProperty("path.home"))
            .put("client.type", "node")
            .put("index.number_of_shards", 1)
            .put("index.number_of_replica", 0)
            .build();
    // ES 2.1 renders NodeBuilder as useless
    Node node = new MockNode(nodeSettings, SyslogPlugin.class);
    node.start();
    return node;
}
 
开发者ID:jprante,项目名称:elasticsearch-syslog,代码行数:13,代码来源:NodeTestUtils.java


示例8: buildNodeWithoutPlugins

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public Node buildNodeWithoutPlugins() throws IOException {
    Settings nodeSettings = Settings.builder()
            .put(getNodeSettings())
            .build();
    logger.info("settings={}", nodeSettings.getAsMap());
    return new MockNode(nodeSettings, Collections.emptyList());
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-reference,代码行数:8,代码来源:NodeTestUtils.java


示例9: buildNode

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public Node buildNode() throws IOException {
    Settings nodeSettings = Settings.builder()
            .put(getNodeSettings())
            .build();
    logger.info("settings={}", nodeSettings.getAsMap());
    return new MockNode(nodeSettings, Collections.singletonList(ReferencePlugin.class));
}
 
开发者ID:jprante,项目名称:elasticsearch-analysis-reference,代码行数:8,代码来源:NodeTestUtils.java


示例10: buildNodeWithoutBundlePlugin

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public Node buildNodeWithoutBundlePlugin() throws IOException {
    Settings nodeSettings = Settings.builder()
            .put(getNodeSettings())
            .build();
    logger.info("settings={}", nodeSettings.getAsMap());
    return new MockNode(nodeSettings, Collections.singletonList(Netty4Plugin.class));
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-bundle,代码行数:8,代码来源:NodeTestUtils.java


示例11: buildNode

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public Node buildNode() throws IOException {
    Settings nodeSettings = Settings.builder()
            .put(getNodeSettings())
            .build();
    logger.info("settings={}", nodeSettings.getAsMap());
    return new MockNode(nodeSettings, Arrays.asList(Netty4Plugin.class, BundlePlugin.class));
}
 
开发者ID:jprante,项目名称:elasticsearch-plugin-bundle,代码行数:8,代码来源:NodeTestUtils.java


示例12: buildNode

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
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;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:15,代码来源:NodeTestUtils.java


示例13: main

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Settings settings = Settings.builder()
        .put("cluster.name", "test-cluster")
        .put("path.home", "target/home")
        .put("path.data", "target/data")
        .put("path.plugins", "src")            
        .build();
    Collection<Class<? extends Plugin>> plugins = 
        Collections.<Class<? extends Plugin>> singletonList(ClusteringPlugin.class);
    try (Node node = new MockNode(settings, plugins)) {
      node.start();
      new CountDownLatch(1).await();
    }
}
 
开发者ID:carrot2,项目名称:elasticsearch-carrot2,代码行数:15,代码来源:StartLocalNode.java


示例14: NodeAndClient

import org.elasticsearch.node.MockNode; //导入依赖的package包/类
NodeAndClient(String name, MockNode node, int nodeAndClientId) {
    this.node = node;
    this.name = name;
    this.nodeAndClientId = nodeAndClientId;
    markNodeDataDirsAsNotEligableForWipe(node);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:InternalTestCluster.java



注:本文中的org.elasticsearch.node.MockNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DeploymentQuery类代码示例发布时间:2022-05-23
下一篇:
Java PigStorage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap