Search in sources :

Example 6 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)

Example 7 with NoneCircuitBreakerService

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

the class Ec2DiscoveryTests method createTransportService.

@Before
public void createTransportService() {
    NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList());
    final Transport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(Settings.EMPTY, Collections.emptyList()), Version.CURRENT) {

        @Override
        public TransportAddress[] addressesFromString(String address, int perAddressLimit) throws UnknownHostException {
            // we just need to ensure we don't resolve DNS here
            return new TransportAddress[] { poorMansDNS.getOrDefault(address, buildNewFakeTransportAddress()) };
        }
    };
    transportService = new MockTransportService(Settings.EMPTY, transport, threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR, null);
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) MockTransportService(org.elasticsearch.test.transport.MockTransportService) TransportAddress(org.elasticsearch.common.transport.TransportAddress) NetworkService(org.elasticsearch.common.network.NetworkService) Matchers.containsString(org.hamcrest.Matchers.containsString) Transport(org.elasticsearch.transport.Transport) MockTcpTransport(org.elasticsearch.transport.MockTcpTransport) MockTcpTransport(org.elasticsearch.transport.MockTcpTransport) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService) Before(org.junit.Before)

Example 8 with NoneCircuitBreakerService

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

the class FileBasedUnicastHostsProviderTests method createTransportSvc.

@Before
public void createTransportSvc() {
    MockTcpTransport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), new NamedWriteableRegistry(Collections.emptyList()), new NetworkService(Settings.EMPTY, Collections.emptyList())) {

        @Override
        public BoundTransportAddress boundAddress() {
            return new BoundTransportAddress(new TransportAddress[] { new TransportAddress(InetAddress.getLoopbackAddress(), 9300) }, new TransportAddress(InetAddress.getLoopbackAddress(), 9300));
        }
    };
    transportService = new MockTransportService(Settings.EMPTY, transport, threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR, null);
}
Also used : NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) MockTransportService(org.elasticsearch.test.transport.MockTransportService) BoundTransportAddress(org.elasticsearch.common.transport.BoundTransportAddress) TransportAddress(org.elasticsearch.common.transport.TransportAddress) BoundTransportAddress(org.elasticsearch.common.transport.BoundTransportAddress) NetworkService(org.elasticsearch.common.network.NetworkService) MockTcpTransport(org.elasticsearch.transport.MockTcpTransport) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService) Before(org.junit.Before)

Example 9 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 10 with NoneCircuitBreakerService

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

the class MockTcpTransportTests method build.

@Override
protected MockTransportService build(Settings settings, Version version, ClusterSettings clusterSettings, boolean doHandshake) {
    NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList());
    Transport transport = new MockTcpTransport(settings, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(settings, Collections.emptyList()), version) {

        @Override
        protected Version executeHandshake(DiscoveryNode node, MockChannel mockChannel, TimeValue timeout) throws IOException, InterruptedException {
            if (doHandshake) {
                return super.executeHandshake(node, mockChannel, timeout);
            } else {
                return version.minimumCompatibilityVersion();
            }
        }
    };
    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) NetworkService(org.elasticsearch.common.network.NetworkService) TimeValue(org.elasticsearch.common.unit.TimeValue) NoneCircuitBreakerService(org.elasticsearch.indices.breaker.NoneCircuitBreakerService)

Aggregations

NoneCircuitBreakerService (org.elasticsearch.indices.breaker.NoneCircuitBreakerService)32 NetworkService (org.elasticsearch.common.network.NetworkService)25 NamedWriteableRegistry (org.elasticsearch.common.io.stream.NamedWriteableRegistry)22 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)17 MockTransportService (org.elasticsearch.test.transport.MockTransportService)16 TestThreadPool (org.elasticsearch.threadpool.TestThreadPool)14 MockTcpTransport (org.elasticsearch.transport.MockTcpTransport)13 Transport (org.elasticsearch.transport.Transport)13 TransportAddress (org.elasticsearch.common.transport.TransportAddress)12 Before (org.junit.Before)12 BigArrays (org.elasticsearch.common.util.BigArrays)11 BoundTransportAddress (org.elasticsearch.common.transport.BoundTransportAddress)10 ThreadPool (org.elasticsearch.threadpool.ThreadPool)10 TransportService (org.elasticsearch.transport.TransportService)10 Logger (org.apache.logging.log4j.Logger)9 TimeValue (org.elasticsearch.common.unit.TimeValue)9 MockBigArrays (org.elasticsearch.common.util.MockBigArrays)9 IOException (java.io.IOException)8 UnknownHostException (java.net.UnknownHostException)8 ArrayList (java.util.ArrayList)8