当前位置: 首页>>代码示例>>Java>>正文


Java Netty4Plugin类代码示例

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


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

示例1: testThatTransportClientCanConnect

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
public void testThatTransportClientCanConnect() throws Exception {
    Settings settings = Settings.builder()
        .put("cluster.name", internalCluster().getClusterName())
        .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME)
        .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
        .build();
    try (TransportClient transportClient = new MockTransportClient(settings, Netty4Plugin.class)) {
        transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName("127.0.0.1"), randomPort));
        ClusterHealthResponse response = transportClient.admin().cluster().prepareHealth().get();
        assertThat(response.getStatus(), is(ClusterHealthStatus.GREEN));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:Netty4TransportMultiPortIntegrationIT.java

示例2: testPluginInstalled

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
@Test
public void testPluginInstalled() {
    try (TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)) {
        Settings settings = client.settings();
        assertEquals(Netty4Plugin.NETTY_TRANSPORT_NAME, NetworkModule.HTTP_DEFAULT_TYPE_SETTING.get(settings));
        assertEquals(Netty4Plugin.NETTY_TRANSPORT_NAME, NetworkModule.TRANSPORT_DEFAULT_TYPE_SETTING.get(settings));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:PreBuiltTransportClientTests.java

示例3: ElasticsearchTestServer

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
private ElasticsearchTestServer(Builder builder) {
    if (builder.cleanDataDir) {
        try {
            Path rootPath = Paths.get(builder.dataDirectory);
            if (Files.exists(rootPath)) {
                Files.walk(rootPath, FileVisitOption.FOLLOW_LINKS)
                        .sorted(Comparator.reverseOrder())
                        .map(Path::toFile)
                        .forEach(File::delete);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    Settings settings = Settings.builder()
            .put("client.transport.ignore_cluster_name", true)
            .put("transport.type", "netty4")
            .put("http.type", "netty4")
            .put("http.enabled", "true")
            .put("http.port", builder.httpPort)
            .put("path.home", builder.dataDirectory)
            .put("transport.tcp.port", builder.transportPort)
            .build();
    this.node = new MyNode(settings, Arrays.asList(Netty4Plugin.class));
}
 
开发者ID:tokenmill,项目名称:crawling-framework,代码行数:26,代码来源:ElasticsearchTestServer.java

示例4: elasticSearchTestNode

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
private static Node elasticSearchTestNode(Path path) throws NodeValidationException {
    return new MyNode(
            Settings.builder()
                    .put("http.enabled", "true")
                    .put("path.home", path.toString())
                    .put("cluster.name", "test-search-api-5-local_junit")
                    .put("http.port", 9211)
                    .put("transport.tcp.port", 9311)
                    .put("http.publish_port", 9211)
                    .put("http.publish_host", "127.0.0.1")
                    .put("transport.bind_host", "127.0.0.1")
                    .put("transport.publish_port", 9311)
                    .put("transport.publish_host", "127.0.0.1")
                    .build(),
            Lists.newArrayList(Netty4Plugin.class)
    ).start();
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:18,代码来源:ElasticsearchAddonMockImpl.java

示例5: startElasticsearch

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
@BeforeClass
public static void startElasticsearch() throws Exception {
  Settings settings = Settings.builder()
      .put("path.home", ES_WORKING_DIR)
      .put("path.data", ES_WORKING_DIR + "/data")
      .put("path.logs", ES_WORKING_DIR + "/logs")
      .put("transport.type", "netty4")
      .put("http.type", "netty4")
      .put("cluster.name", clusterName)
      .put("http.port", HTTP_PORT)
      .put("transport.tcp.port", HTTP_TRANSPORT_PORT)
      .put("network.host", "127.0.0.1")
      .build();
  Collection plugins = Collections.singletonList(Netty4Plugin.class);
  node = new PluginConfigurableNode(settings, plugins);
  node.start();
}
 
开发者ID:opentracing-contrib,项目名称:java-elasticsearch-client,代码行数:18,代码来源:TracingTest.java

示例6: start

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
public static synchronized void start(String clusterName, String host, int port, boolean enableTransportClient) throws Exception{

		if (instance != null && !instance.isClosed()) {
			logger.info("Elastic Search is already running on port {}", getPort());
			return;
		}

		final Settings settings = getSettings(clusterName, host, port, enableTransportClient);
		setupDataDir(settings);

		logger.info("Starting ElasticSearch for cluster {} ", settings.get("cluster.name"));
		instance = new PluginConfigurableNode(settings, Arrays.asList(Netty4Plugin.class));
		instance.start();
		Runtime.getRuntime().addShutdownHook(new Thread() {
			@Override
			public void run() {
				try {
					instance.close();
				} catch (IOException e) {
					logger.error("Error closing ElasticSearch");
				}
			}
		});
		logger.info("ElasticSearch cluster {} started in local mode on port {}", instance.settings().get("cluster.name"), getPort());
		client = instance.client();
	}
 
开发者ID:Netflix,项目名称:conductor,代码行数:27,代码来源:EmbeddedElasticSearch.java

示例7: startEmbeddedNode

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
@Override
public void startEmbeddedNode() throws NodeValidationException {
  if (this.embeddedNode != null) {
    log.info("Embedded Elasticsearch cluster already running");
    return;
  }
  log.info("Launching an embedded Elasticsearch cluster: {}", properties.getClusterName());

  Collection<Class<? extends Plugin>> plugins = Arrays.asList(Netty4Plugin.class);
  embeddedNode = new PluginConfigurableNode(Settings.builder()
   .put("path.home", properties.getEmbeddedStoragePath())
   .put("cluster.name", properties.getClusterName())
   .put("node.name", properties.getNodeName())
   .put("transport.type", "netty4")
   .put("node.data", true)
   .put("node.master", true)
   .put("network.host", "0.0.0.0")
   .put("http.type", "netty4")
   .put("http.enabled", true)
   .put("http.cors.enabled", true)
   .put("http.cors.allow-origin", "/.*/")
   .build(), plugins);

    embeddedNode.start();
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:26,代码来源:ElasticsearchClientImpl.java

示例8: testNodeClientAllowedWithServerCertificate

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test
public void testNodeClientAllowedWithServerCertificate() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());

    
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(4, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:25,代码来源:IntegrationTests.java

示例9: testNodeClientDisallowedWithNonServerCertificate

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test
public void testNodeClientDisallowedWithNonServerCertificate() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());

    
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .put("searchguard.ssl.transport.keystore_filepath", FileHelper.getAbsoluteFilePathFromClassPath("kirk-keystore.jks"))
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS,"kirk")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(1, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:27,代码来源:IntegrationTests.java

示例10: testNodeClientDisallowedWithNonServerCertificate2

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test
public void testNodeClientDisallowedWithNonServerCertificate2() throws Exception {
    setup();
    Assert.assertEquals(3, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getNumberOfNodes());
    Assert.assertEquals(ClusterHealthStatus.GREEN, clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest().waitForGreenStatus()).actionGet().getStatus());
 
    final Settings tcSettings = Settings.builder()
            .put(minimumSearchGuardSettings(Settings.EMPTY).get(0))
            .put("cluster.name", clusterInfo.clustername)
            .put("node.data", false)
            .put("node.master", false)
            .put("node.ingest", false)
            .put("path.home", ".")
            .put("searchguard.ssl.transport.keystore_filepath", FileHelper.getAbsoluteFilePathFromClassPath("spock-keystore.jks"))
            .put(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_KEYSTORE_ALIAS,"spock")
            .build();

    log.debug("Start node client");
    
    try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, SearchGuardPlugin.class).start()) {
        Thread.sleep(50);
        Assert.assertEquals(1, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size());    
    }
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:26,代码来源:IntegrationTests.java

示例11: getInternalTransportClient

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
protected TransportClient getInternalTransportClient(ClusterInfo info, Settings initTransportClientSettings) {
    
    final String prefix = getResourceFolder()==null?"":getResourceFolder()+"/";
    
    Settings tcSettings = Settings.builder()
            .put("cluster.name", info.clustername)
            .put("searchguard.ssl.transport.truststore_filepath",
                    FileHelper.getAbsoluteFilePathFromClassPath(prefix+"truststore.jks"))
            .put("searchguard.ssl.transport.enforce_hostname_verification", false)
            .put("searchguard.ssl.transport.keystore_filepath",
                    FileHelper.getAbsoluteFilePathFromClassPath(prefix+"kirk-keystore.jks"))
            .put(initTransportClientSettings)
            .build();
    
    TransportClient tc = new TransportClientImpl(tcSettings, asCollection(Netty4Plugin.class, SearchGuardPlugin.class));
    tc.addTransportAddress(new TransportAddress(new InetSocketAddress(info.nodeHost, info.nodePort)));
    return tc;
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:19,代码来源:AbstractSGUnitTest.java

示例12: getUserTransportClient

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
protected TransportClient getUserTransportClient(ClusterInfo info, String keyStore, Settings initTransportClientSettings) {
    
    final String prefix = getResourceFolder()==null?"":getResourceFolder()+"/";
    
    Settings tcSettings = Settings.builder()
            .put("cluster.name", info.clustername)
            .put("searchguard.ssl.transport.truststore_filepath",
                    FileHelper.getAbsoluteFilePathFromClassPath(prefix+"truststore.jks"))
            .put("searchguard.ssl.transport.enforce_hostname_verification", false)
            .put("searchguard.ssl.transport.keystore_filepath",
                    FileHelper.getAbsoluteFilePathFromClassPath(prefix+keyStore))
            .put(initTransportClientSettings)
            .build();
    
    TransportClient tc = new TransportClientImpl(tcSettings, asCollection(Netty4Plugin.class, SearchGuardPlugin.class));
    tc.addTransportAddress(new TransportAddress(new InetSocketAddress(info.nodeHost, info.nodePort)));
    return tc;
}
 
开发者ID:floragunncom,项目名称:search-guard,代码行数:19,代码来源:AbstractSGUnitTest.java

示例13: startES

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
public final void startES(final Settings settings) throws Exception {

        FileUtils.deleteDirectory(new File("data"));

        esNode1 = new PluginAwareNode(getDefaultSettingsBuilder(1, false, true).put(
                settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, SearchGuardSSLPlugin.class);
        esNode2 = new PluginAwareNode(getDefaultSettingsBuilder(2, true, true).put(
                settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, SearchGuardSSLPlugin.class);
        esNode3 = new PluginAwareNode(getDefaultSettingsBuilder(3, true, false).put(
                settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, SearchGuardSSLPlugin.class);

        esNode1.start();
        esNode2.start();
        esNode3.start();

        waitForGreenClusterState(esNode1.client());
    }
 
开发者ID:floragunncom,项目名称:search-guard-ssl,代码行数:18,代码来源:AbstractUnitTest.java

示例14: getElasticsearchNode

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
@Produces
@Singleton
@SuppressWarnings("resource")
public Node getElasticsearchNode() throws Exception {

    FileUtils.deleteDirectory(DATA_PATH);

    class PluginConfigurableNode extends Node {
        PluginConfigurableNode(Settings settings, Collection<Class<? extends Plugin>> classpathPlugins) {
            super(InternalSettingsPreparer.prepareEnvironment(settings, null), classpathPlugins);
        }
    }

    // create an embedded node to resume
    return new PluginConfigurableNode(Settings.builder()
        .put("http.enabled", true)
        .put("path.data", DATA_PATH)
        .put("path.home", HOME_PATH)
        .put("transport.profiles.default.port", ES_TRANSPORT_PORT)
        .build(), Arrays.asList(Netty4Plugin.class)).start();
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:22,代码来源:ElasticsearchNodeProducer.java

示例15: startElasticsearch

import org.elasticsearch.transport.Netty4Plugin; //导入依赖的package包/类
private static void startElasticsearch() throws Exception {
	try {
		FileUtils.deleteDirectory(new File("build/elasticsearch"));
	} catch (IOException e) {
		// ignore
	}
	final Settings settings = Settings.builder()
			.put("path.home", "build/elasticsearch")
			.put("node.name", "junit-es-node")
			.put("path.logs", "build/elasticsearch/logs")
			.put("path.data", "build/elasticsearch/data")
			.put("transport.type", "local")
			.put("http.type", "netty4")
			.build();

	node = new TestNode(settings, Collections.singletonList(Netty4Plugin.class));
	node.start();
	node.client().admin().cluster().prepareHealth().setWaitForGreenStatus().get();
}
 
开发者ID:stagemonitor,项目名称:stagemonitor,代码行数:20,代码来源:InstrumentationPerformanceTest.java


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