Search in sources :

Example 41 with NoneCircuitBreakerService

use of org.elasticsearch.indices.breaker.NoneCircuitBreakerService in project crate by crate.

the class TcpTransportTests method testDefaultSeedAddresses.

private void testDefaultSeedAddresses(final Settings settings, Matcher<Iterable<? extends String>> seedAddressesMatcher) {
    final TestThreadPool testThreadPool = new TestThreadPool("test");
    try {
        final TcpTransport tcpTransport = new TcpTransport(settings, Version.CURRENT, testThreadPool, new MockPageCacheRecycler(settings), new NoneCircuitBreakerService(), writableRegistry(), new NetworkService(Collections.emptyList())) {

            @Override
            protected TcpServerChannel bind(String name, InetSocketAddress address) {
                throw new UnsupportedOperationException();
            }

            @Override
            protected TcpChannel initiateChannel(DiscoveryNode node) {
                throw new UnsupportedOperationException();
            }

            @Override
            protected void stopInternal() {
                throw new UnsupportedOperationException();
            }
        };
        assertThat(tcpTransport.getDefaultSeedAddresses(), seedAddressesMatcher);
    } finally {
        testThreadPool.shutdown();
    }
}
Also used : DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) MockPageCacheRecycler(org.elasticsearch.common.util.MockPageCacheRecycler) InetSocketAddress(java.net.InetSocketAddress) NetworkService(org.elasticsearch.common.network.NetworkService) TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService)

Example 42 with NoneCircuitBreakerService

use of org.elasticsearch.indices.breaker.NoneCircuitBreakerService in project crate by crate.

the class TransportServiceHandshakeTests method startServices.

private NetworkHandle startServices(String nodeNameAndId, Settings settings, Version version) {
    var allSettings = Settings.builder().put(TransportSettings.PORT.getKey(), ESTestCase.getPortRange()).put(settings).build();
    var transport = new Netty4Transport(allSettings, // handle the real world scenario instead of a faked one.
    Version.CURRENT, threadPool, new NetworkService(Collections.emptyList()), PageCacheRecycler.NON_RECYCLING_INSTANCE, new NamedWriteableRegistry(Collections.emptyList()), new NoneCircuitBreakerService(), new NettyBootstrap(), new AlwaysOKAuthentication(userName -> User.CRATE_USER), new SslContextProvider(settings));
    TransportService transportService = new MockTransportService(allSettings, transport, threadPool, (boundAddress) -> new DiscoveryNode(nodeNameAndId, nodeNameAndId, boundAddress.publishAddress(), emptyMap(), emptySet(), version), null);
    transportService.start();
    transportService.acceptIncomingRequests();
    transportServices.add(transportService);
    return new NetworkHandle(transportService, transportService.getLocalNode());
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) BeforeClass(org.junit.BeforeClass) ArrayList(java.util.ArrayList) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) NetworkService(org.elasticsearch.common.network.NetworkService) Settings(org.elasticsearch.common.settings.Settings) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService) NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) After(org.junit.After) NettyBootstrap(io.crate.netty.NettyBootstrap) ThreadPool(org.elasticsearch.threadpool.ThreadPool) ESTestCase(org.elasticsearch.test.ESTestCase) MockTransportService(org.elasticsearch.test.transport.MockTransportService) Collections.emptyMap(java.util.Collections.emptyMap) TestThreadPool(org.elasticsearch.threadpool.TestThreadPool) AfterClass(org.junit.AfterClass) Collections.emptySet(java.util.Collections.emptySet) Netty4Transport(org.elasticsearch.transport.netty4.Netty4Transport) User(io.crate.user.User) PlainActionFuture(org.elasticsearch.action.support.PlainActionFuture) IOException(java.io.IOException) PageCacheRecycler(org.elasticsearch.common.util.PageCacheRecycler) Test(org.junit.Test) VersionUtils(org.elasticsearch.test.VersionUtils) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Version(org.elasticsearch.Version) SslContextProvider(io.crate.protocols.ssl.SslContextProvider) AlwaysOKAuthentication(io.crate.auth.AlwaysOKAuthentication) Matchers.containsString(org.hamcrest.Matchers.containsString) Collections(java.util.Collections) ActionListener(org.elasticsearch.action.ActionListener) AlwaysOKAuthentication(io.crate.auth.AlwaysOKAuthentication) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) MockTransportService(org.elasticsearch.test.transport.MockTransportService) Netty4Transport(org.elasticsearch.transport.netty4.Netty4Transport) MockTransportService(org.elasticsearch.test.transport.MockTransportService) NetworkService(org.elasticsearch.common.network.NetworkService) SslContextProvider(io.crate.protocols.ssl.SslContextProvider) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService) NettyBootstrap(io.crate.netty.NettyBootstrap)

Aggregations

NoneCircuitBreakerService (org.elasticsearch.indices.breaker.NoneCircuitBreakerService)42 NetworkService (org.elasticsearch.common.network.NetworkService)29 NamedWriteableRegistry (org.elasticsearch.common.io.stream.NamedWriteableRegistry)24 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)22 MockTransportService (org.elasticsearch.test.transport.MockTransportService)17 TestThreadPool (org.elasticsearch.threadpool.TestThreadPool)17 Settings (org.elasticsearch.common.settings.Settings)15 Before (org.junit.Before)15 Transport (org.elasticsearch.transport.Transport)14 Version (org.elasticsearch.Version)13 TransportAddress (org.elasticsearch.common.transport.TransportAddress)13 MockTcpTransport (org.elasticsearch.transport.MockTcpTransport)13 ThreadPool (org.elasticsearch.threadpool.ThreadPool)12 IOException (java.io.IOException)11 ArrayList (java.util.ArrayList)11 Collections (java.util.Collections)11 BoundTransportAddress (org.elasticsearch.common.transport.BoundTransportAddress)11 BigArrays (org.elasticsearch.common.util.BigArrays)11 TransportService (org.elasticsearch.transport.TransportService)11 Arrays (java.util.Arrays)10