Search in sources :

Example 1 with NoneCircuitBreakerService

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

the class AbstractSimpleTransportTestCase method testHandshakeWithIncompatVersion.

public void testHandshakeWithIncompatVersion() {
    assumeTrue("only tcp transport has a handshake method", serviceA.getOriginalTransport() instanceof TcpTransport);
    NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList());
    try (MockTcpTransport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(Settings.EMPTY, Collections.emptyList()), Version.fromString("2.0.0"))) {
        transport.transportServiceAdapter(serviceA.new Adapter());
        transport.start();
        DiscoveryNode node = new DiscoveryNode("TS_TPC", "TS_TPC", transport.boundAddress().publishAddress(), emptyMap(), emptySet(), version0);
        ConnectionProfile.Builder builder = new ConnectionProfile.Builder();
        builder.addConnections(1, TransportRequestOptions.Type.BULK, TransportRequestOptions.Type.PING, TransportRequestOptions.Type.RECOVERY, TransportRequestOptions.Type.REG, TransportRequestOptions.Type.STATE);
        expectThrows(ConnectTransportException.class, () -> serviceA.openConnection(node, builder.build()));
    }
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) NetworkService(org.elasticsearch.common.network.NetworkService) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService)

Example 2 with NoneCircuitBreakerService

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

the class Netty4HttpServerTransportTests method setup.

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

Example 3 with NoneCircuitBreakerService

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

the class SimpleNetty4TransportTests method nettyFromThreadPool.

public static MockTransportService nettyFromThreadPool(Settings settings, ThreadPool threadPool, final Version version, ClusterSettings clusterSettings, boolean doHandshake) {
    NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList());
    Transport transport = new Netty4Transport(settings, threadPool, new NetworkService(settings, Collections.emptyList()), BigArrays.NON_RECYCLING_INSTANCE, namedWriteableRegistry, new NoneCircuitBreakerService()) {

        @Override
        protected Version executeHandshake(DiscoveryNode node, Channel channel, TimeValue timeout) throws IOException, InterruptedException {
            if (doHandshake) {
                return super.executeHandshake(node, channel, timeout);
            } else {
                return version.minimumCompatibilityVersion();
            }
        }

        @Override
        protected Version getCurrentVersion() {
            return version;
        }
    };
    MockTransportService mockTransportService = MockTransportService.createNewService(Settings.EMPTY, transport, version, threadPool, clusterSettings);
    mockTransportService.start();
    return mockTransportService;
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) MockTransportService(org.elasticsearch.test.transport.MockTransportService) Channel(io.netty.channel.Channel) NetworkService(org.elasticsearch.common.network.NetworkService) Transport(org.elasticsearch.transport.Transport) TimeValue(org.elasticsearch.common.unit.TimeValue) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService)

Example 4 with NoneCircuitBreakerService

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

the class Netty4HttpServerPipeliningTests method setup.

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

Example 5 with NoneCircuitBreakerService

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

the class Netty4SizeHeaderFrameDecoderTests method startThreadPool.

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

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