Search in sources :

Example 26 with Transport

use of org.elasticsearch.transport.Transport in project crate by crate.

the class MockTransportService method createNewService.

public static MockTransportService createNewService(Settings settings, Version version, ThreadPool threadPool, @Nullable ClusterSettings clusterSettings) {
    var allSettings = Settings.builder().put(TransportSettings.PORT.getKey(), ESTestCase.getPortRange()).put(settings).build();
    var namedWriteableRegistry = new NamedWriteableRegistry(ClusterModule.getNamedWriteables());
    var transport = new Netty4Transport(allSettings, version, threadPool, new NetworkService(List.of()), new PageCacheRecycler(allSettings), namedWriteableRegistry, new NoneCircuitBreakerService(), new NettyBootstrap(), new AlwaysOKAuthentication(name -> User.CRATE_USER), new SslContextProvider(allSettings));
    return new MockTransportService(allSettings, transport, threadPool, boundAddress -> new DiscoveryNode(Node.NODE_NAME_SETTING.get(settings), UUIDs.randomBase64UUID(), boundAddress.publishAddress(), Node.NODE_ATTRIBUTES.getAsMap(settings), DiscoveryNode.getRolesFromSettings(settings), version), clusterSettings);
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) Arrays(java.util.Arrays) TransportRequest(org.elasticsearch.transport.TransportRequest) ConnectTransportException(org.elasticsearch.transport.ConnectTransportException) Settings(org.elasticsearch.common.settings.Settings) Map(java.util.Map) ThreadPool(org.elasticsearch.threadpool.ThreadPool) Transport(org.elasticsearch.transport.Transport) User(io.crate.user.User) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) UUIDs(org.elasticsearch.common.UUIDs) Set(java.util.Set) PageCacheRecycler(org.elasticsearch.common.util.PageCacheRecycler) ConnectionManager(org.elasticsearch.transport.ConnectionManager) ClusterModule(org.elasticsearch.cluster.ClusterModule) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) AbstractRunnable(org.elasticsearch.common.util.concurrent.AbstractRunnable) Version(org.elasticsearch.Version) TransportAddress(org.elasticsearch.common.transport.TransportAddress) TransportSettings(org.elasticsearch.transport.TransportSettings) TimeValue(io.crate.common.unit.TimeValue) Queue(java.util.Queue) TransportRequestOptions(org.elasticsearch.transport.TransportRequestOptions) SslContextProvider(io.crate.protocols.ssl.SslContextProvider) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) BytesStreamOutput(org.elasticsearch.common.io.stream.BytesStreamOutput) RequestHandlerRegistry(org.elasticsearch.transport.RequestHandlerRegistry) BoundTransportAddress(org.elasticsearch.common.transport.BoundTransportAddress) Function(java.util.function.Function) Supplier(java.util.function.Supplier) HashSet(java.util.HashSet) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) NetworkService(org.elasticsearch.common.network.NetworkService) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService) NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) TcpTransport(org.elasticsearch.transport.TcpTransport) NettyBootstrap(io.crate.netty.NettyBootstrap) Node(org.elasticsearch.node.Node) ESTestCase(org.elasticsearch.test.ESTestCase) TransportService(org.elasticsearch.transport.TransportService) Nullable(javax.annotation.Nullable) ConnectionProfile(org.elasticsearch.transport.ConnectionProfile) Netty4Transport(org.elasticsearch.transport.netty4.Netty4Transport) IOUtils(io.crate.common.io.IOUtils) Plugin(org.elasticsearch.plugins.Plugin) IOException(java.io.IOException) TimeUnit(java.util.concurrent.TimeUnit) ClusterSettings(org.elasticsearch.common.settings.ClusterSettings) LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) AlwaysOKAuthentication(io.crate.auth.AlwaysOKAuthentication) ActionListener(org.elasticsearch.action.ActionListener) AlwaysOKAuthentication(io.crate.auth.AlwaysOKAuthentication) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) PageCacheRecycler(org.elasticsearch.common.util.PageCacheRecycler) Netty4Transport(org.elasticsearch.transport.netty4.Netty4Transport) NetworkService(org.elasticsearch.common.network.NetworkService) SslContextProvider(io.crate.protocols.ssl.SslContextProvider) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService) NettyBootstrap(io.crate.netty.NettyBootstrap)

Aggregations

Transport (org.elasticsearch.transport.Transport)26 NamedWriteableRegistry (org.elasticsearch.common.io.stream.NamedWriteableRegistry)19 TransportService (org.elasticsearch.transport.TransportService)17 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)16 NetworkService (org.elasticsearch.common.network.NetworkService)16 Settings (org.elasticsearch.common.settings.Settings)16 ThreadPool (org.elasticsearch.threadpool.ThreadPool)16 NoneCircuitBreakerService (org.elasticsearch.indices.breaker.NoneCircuitBreakerService)15 TransportAddress (org.elasticsearch.common.transport.TransportAddress)14 TestThreadPool (org.elasticsearch.threadpool.TestThreadPool)14 MockTransportService (org.elasticsearch.test.transport.MockTransportService)13 MockTcpTransport (org.elasticsearch.transport.MockTcpTransport)13 Collections (java.util.Collections)12 List (java.util.List)12 TimeUnit (java.util.concurrent.TimeUnit)12 BoundTransportAddress (org.elasticsearch.common.transport.BoundTransportAddress)12 BigArrays (org.elasticsearch.common.util.BigArrays)12 IOException (java.io.IOException)11 Map (java.util.Map)11 Logger (org.apache.logging.log4j.Logger)11