Search in sources :

Example 1 with NetworkService

use of org.opensearch.common.network.NetworkService in project OpenSearch by opensearch-project.

the class Ec2NetworkTests method testNetworkHostCoreLocal.

/**
 * Test that we don't have any regression with network host core settings such as
 * network.host: _local_
 */
public void testNetworkHostCoreLocal() throws IOException {
    NetworkService networkService = new NetworkService(Collections.singletonList(new Ec2NameResolver()));
    InetAddress[] addresses = networkService.resolveBindHostAddresses(null);
    assertThat(addresses, arrayContaining(networkService.resolveBindHostAddresses(new String[] { "_local_" })));
}
Also used : NetworkService(org.opensearch.common.network.NetworkService) InetAddress(java.net.InetAddress)

Example 2 with NetworkService

use of org.opensearch.common.network.NetworkService in project OpenSearch by opensearch-project.

the class GceDiscoveryTests method buildDynamicNodes.

protected List<TransportAddress> buildDynamicNodes(GceInstancesServiceImpl gceInstancesService, Settings nodeSettings) {
    GceSeedHostsProvider provider = new GceSeedHostsProvider(nodeSettings, gceInstancesService, transportService, new NetworkService(Collections.emptyList()));
    List<TransportAddress> dynamicHosts = provider.getSeedAddresses(null);
    logger.info("--> addresses found: {}", dynamicHosts);
    return dynamicHosts;
}
Also used : TransportAddress(org.opensearch.common.transport.TransportAddress) NetworkService(org.opensearch.common.network.NetworkService)

Example 3 with NetworkService

use of org.opensearch.common.network.NetworkService in project OpenSearch by opensearch-project.

the class Netty4SizeHeaderFrameDecoderTests method startThreadPool.

@Before
public void startThreadPool() {
    threadPool = new ThreadPool(settings);
    NetworkService networkService = new NetworkService(Collections.emptyList());
    PageCacheRecycler recycler = new MockPageCacheRecycler(Settings.EMPTY);
    nettyTransport = new Netty4Transport(settings, Version.CURRENT, threadPool, networkService, recycler, new NamedWriteableRegistry(Collections.emptyList()), new NoneCircuitBreakerService(), new SharedGroupFactory(settings));
    nettyTransport.start();
    TransportAddress[] boundAddresses = nettyTransport.boundAddress().boundAddresses();
    TransportAddress transportAddress = randomFrom(boundAddresses);
    port = transportAddress.address().getPort();
    host = transportAddress.address().getAddress();
}
Also used : NamedWriteableRegistry(org.opensearch.common.io.stream.NamedWriteableRegistry) MockPageCacheRecycler(org.opensearch.common.util.MockPageCacheRecycler) PageCacheRecycler(org.opensearch.common.util.PageCacheRecycler) MockPageCacheRecycler(org.opensearch.common.util.MockPageCacheRecycler) TransportAddress(org.opensearch.common.transport.TransportAddress) ThreadPool(org.opensearch.threadpool.ThreadPool) NetworkService(org.opensearch.common.network.NetworkService) SharedGroupFactory(org.opensearch.transport.SharedGroupFactory) NoneCircuitBreakerService(org.opensearch.indices.breaker.NoneCircuitBreakerService) Before(org.junit.Before)

Example 4 with NetworkService

use of org.opensearch.common.network.NetworkService in project OpenSearch by opensearch-project.

the class NettyTransportMultiPortTests method startTransport.

private TcpTransport startTransport(Settings settings, ThreadPool threadPool) {
    PageCacheRecycler recycler = new MockPageCacheRecycler(Settings.EMPTY);
    TcpTransport transport = new Netty4Transport(settings, Version.CURRENT, threadPool, new NetworkService(Collections.emptyList()), recycler, new NamedWriteableRegistry(Collections.emptyList()), new NoneCircuitBreakerService(), new SharedGroupFactory(settings));
    transport.start();
    assertThat(transport.lifecycleState(), is(Lifecycle.State.STARTED));
    return transport;
}
Also used : NamedWriteableRegistry(org.opensearch.common.io.stream.NamedWriteableRegistry) MockPageCacheRecycler(org.opensearch.common.util.MockPageCacheRecycler) PageCacheRecycler(org.opensearch.common.util.PageCacheRecycler) MockPageCacheRecycler(org.opensearch.common.util.MockPageCacheRecycler) TcpTransport(org.opensearch.transport.TcpTransport) NetworkService(org.opensearch.common.network.NetworkService) SharedGroupFactory(org.opensearch.transport.SharedGroupFactory) NoneCircuitBreakerService(org.opensearch.indices.breaker.NoneCircuitBreakerService)

Example 5 with NetworkService

use of org.opensearch.common.network.NetworkService in project OpenSearch by opensearch-project.

the class Netty4HttpServerPipeliningTests method setup.

@Before
public void setup() throws Exception {
    networkService = new NetworkService(Collections.emptyList());
    threadPool = new TestThreadPool("test");
    bigArrays = new MockBigArrays(new MockPageCacheRecycler(Settings.EMPTY), new NoneCircuitBreakerService());
}
Also used : MockPageCacheRecycler(org.opensearch.common.util.MockPageCacheRecycler) NetworkService(org.opensearch.common.network.NetworkService) MockBigArrays(org.opensearch.common.util.MockBigArrays) TestThreadPool(org.opensearch.threadpool.TestThreadPool) NoneCircuitBreakerService(org.opensearch.indices.breaker.NoneCircuitBreakerService) Before(org.junit.Before)

Aggregations

NetworkService (org.opensearch.common.network.NetworkService)25 NoneCircuitBreakerService (org.opensearch.indices.breaker.NoneCircuitBreakerService)21 NamedWriteableRegistry (org.opensearch.common.io.stream.NamedWriteableRegistry)15 MockPageCacheRecycler (org.opensearch.common.util.MockPageCacheRecycler)11 MockNioTransport (org.opensearch.transport.nio.MockNioTransport)11 Before (org.junit.Before)9 TestThreadPool (org.opensearch.threadpool.TestThreadPool)9 TransportAddress (org.opensearch.common.transport.TransportAddress)8 TransportService (org.opensearch.transport.TransportService)7 BoundTransportAddress (org.opensearch.common.transport.BoundTransportAddress)6 Transport (org.opensearch.transport.Transport)6 ActionListener (org.opensearch.action.ActionListener)5 PlainActionFuture (org.opensearch.action.support.PlainActionFuture)5 Settings (org.opensearch.common.settings.Settings)5 InetAddress (java.net.InetAddress)4 UnknownHostException (java.net.UnknownHostException)4 HashSet (java.util.HashSet)4 DiscoveryNode (org.opensearch.cluster.node.DiscoveryNode)4 MockBigArrays (org.opensearch.common.util.MockBigArrays)4 PageCacheRecycler (org.opensearch.common.util.PageCacheRecycler)4