[TEST] add NamedWriteableRegistry argument to AbstractSimpleTransportTests#build method

This commit is contained in:
javanna 2015-08-06 12:56:28 +02:00 committed by Luca Cavanna
parent 63d18d5e05
commit 6f13171d50
3 changed files with 8 additions and 7 deletions

View File

@ -22,6 +22,7 @@ package org.elasticsearch.transport;
import com.google.common.collect.ImmutableMap;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Settings;
@ -59,7 +60,7 @@ public abstract class AbstractSimpleTransportTests extends ESTestCase {
protected DiscoveryNode nodeB;
protected MockTransportService serviceB;
protected abstract MockTransportService build(Settings settings, Version version);
protected abstract MockTransportService build(Settings settings, Version version, NamedWriteableRegistry namedWriteableRegistry);
@Override
@Before
@ -68,12 +69,12 @@ public abstract class AbstractSimpleTransportTests extends ESTestCase {
threadPool = new ThreadPool(getClass().getName());
serviceA = build(
Settings.builder().put("name", "TS_A", TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(),
version0
version0, new NamedWriteableRegistry()
);
nodeA = new DiscoveryNode("TS_A", "TS_A", serviceA.boundAddress().publishAddress(), ImmutableMap.<String, String>of(), version0);
serviceB = build(
Settings.builder().put("name", "TS_B", TransportService.SETTING_TRACE_LOG_INCLUDE, "", TransportService.SETTING_TRACE_LOG_EXCLUDE, "NOTHING").build(),
version1
version1, new NamedWriteableRegistry()
);
nodeB = new DiscoveryNode("TS_B", "TS_B", serviceB.boundAddress().publishAddress(), ImmutableMap.<String, String>of(), version1);

View File

@ -28,8 +28,8 @@ import org.elasticsearch.transport.AbstractSimpleTransportTests;
public class SimpleLocalTransportTests extends AbstractSimpleTransportTests {
@Override
protected MockTransportService build(Settings settings, Version version) {
MockTransportService transportService = new MockTransportService(Settings.EMPTY, new LocalTransport(settings, threadPool, version, new NamedWriteableRegistry()), threadPool);
protected MockTransportService build(Settings settings, Version version, NamedWriteableRegistry namedWriteableRegistry) {
MockTransportService transportService = new MockTransportService(Settings.EMPTY, new LocalTransport(settings, threadPool, version, namedWriteableRegistry), threadPool);
transportService.start();
return transportService;
}

View File

@ -34,11 +34,11 @@ import org.junit.Test;
public class SimpleNettyTransportTests extends AbstractSimpleTransportTests {
@Override
protected MockTransportService build(Settings settings, Version version) {
protected MockTransportService build(Settings settings, Version version, NamedWriteableRegistry namedWriteableRegistry) {
int startPort = 11000 + randomIntBetween(0, 255);
int endPort = startPort + 10;
settings = Settings.builder().put(settings).put("transport.tcp.port", startPort + "-" + endPort).build();
MockTransportService transportService = new MockTransportService(settings, new NettyTransport(settings, threadPool, new NetworkService(settings), BigArrays.NON_RECYCLING_INSTANCE, version, new NamedWriteableRegistry()), threadPool);
MockTransportService transportService = new MockTransportService(settings, new NettyTransport(settings, threadPool, new NetworkService(settings), BigArrays.NON_RECYCLING_INSTANCE, version, namedWriteableRegistry), threadPool);
transportService.start();
return transportService;
}