public final class MockTransportService
extends org.elasticsearch.transport.TransportService
Modifier and Type | Class and Description |
---|---|
static class |
MockTransportService.ClearableTransport
The delegate transport instances defined in this class mock various kinds of disruption types.
|
static class |
MockTransportService.DelegateTransport
A pure delegate transport.
|
static class |
MockTransportService.TestPlugin |
static class |
MockTransportService.Tracer |
org.elasticsearch.transport.TransportService.Adapter, org.elasticsearch.transport.TransportService.ContextRestoreResponseHandler<T extends org.elasticsearch.transport.TransportResponse>, org.elasticsearch.transport.TransportService.HandshakeResponse
Constructor and Description |
---|
MockTransportService(org.elasticsearch.common.settings.Settings settings,
org.elasticsearch.transport.Transport transport,
org.elasticsearch.threadpool.ThreadPool threadPool,
org.elasticsearch.transport.TransportInterceptor interceptor,
org.elasticsearch.common.settings.ClusterSettings clusterSettings)
Build the service.
|
MockTransportService(org.elasticsearch.common.settings.Settings settings,
org.elasticsearch.transport.Transport transport,
org.elasticsearch.threadpool.ThreadPool threadPool,
org.elasticsearch.transport.TransportInterceptor interceptor,
java.util.function.Function<org.elasticsearch.common.transport.BoundTransportAddress,org.elasticsearch.cluster.node.DiscoveryNode> localNodeFactory,
org.elasticsearch.common.settings.ClusterSettings clusterSettings)
Build the service.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addDelegate(org.elasticsearch.common.transport.TransportAddress transportAddress,
MockTransportService.DelegateTransport transport)
Adds a new delegate transport that is used for communication with the given transport address.
|
boolean |
addDelegate(org.elasticsearch.transport.TransportService transportService,
MockTransportService.DelegateTransport transport)
Adds a new delegate transport that is used for communication with the given transport service.
|
void |
addFailToSendNoConnectRule(org.elasticsearch.common.transport.TransportAddress transportAddress)
Adds a rule that will cause every send request to fail, and each new connect since the rule
is added to fail as well.
|
void |
addFailToSendNoConnectRule(org.elasticsearch.common.transport.TransportAddress transportAddress,
java.util.Set<java.lang.String> blockedActions)
Adds a rule that will cause matching operations to throw ConnectTransportExceptions
|
void |
addFailToSendNoConnectRule(org.elasticsearch.common.transport.TransportAddress transportAddress,
java.lang.String... blockedActions)
Adds a rule that will cause matching operations to throw ConnectTransportExceptions
|
void |
addFailToSendNoConnectRule(org.elasticsearch.transport.TransportService transportService)
Adds a rule that will cause every send request to fail, and each new connect since the rule
is added to fail as well.
|
void |
addFailToSendNoConnectRule(org.elasticsearch.transport.TransportService transportService,
java.util.Set<java.lang.String> blockedActions)
Adds a rule that will cause matching operations to throw ConnectTransportExceptions
|
void |
addFailToSendNoConnectRule(org.elasticsearch.transport.TransportService transportService,
java.lang.String... blockedActions)
Adds a rule that will cause matching operations to throw ConnectTransportExceptions
|
void |
addTracer(MockTransportService.Tracer tracer) |
void |
addUnresponsiveRule(org.elasticsearch.common.transport.TransportAddress transportAddress)
Adds a rule that will cause ignores each send request, simulating an unresponsive node
and failing to connect once the rule was added.
|
void |
addUnresponsiveRule(org.elasticsearch.common.transport.TransportAddress transportAddress,
org.elasticsearch.common.unit.TimeValue duration)
Adds a rule that will cause ignores each send request, simulating an unresponsive node
and failing to connect once the rule was added.
|
void |
addUnresponsiveRule(org.elasticsearch.transport.TransportService transportService)
Adds a rule that will cause ignores each send request, simulating an unresponsive node
and failing to connect once the rule was added.
|
void |
addUnresponsiveRule(org.elasticsearch.transport.TransportService transportService,
org.elasticsearch.common.unit.TimeValue duration)
Adds a rule that will cause ignores each send request, simulating an unresponsive node
and failing to connect once the rule was added.
|
void |
clearAllRules()
Clears all the registered rules.
|
void |
clearRule(org.elasticsearch.common.transport.TransportAddress transportAddress)
Clears the rule associated with the provided transport address.
|
void |
clearRule(org.elasticsearch.transport.TransportService transportService)
Clears the rule associated with the provided transport service.
|
void |
clearTracers() |
protected org.elasticsearch.transport.TransportService.Adapter |
createAdapter() |
static MockTransportService |
createNewService(org.elasticsearch.common.settings.Settings settings,
org.elasticsearch.transport.Transport transport,
org.elasticsearch.Version version,
org.elasticsearch.threadpool.ThreadPool threadPool,
org.elasticsearch.common.settings.ClusterSettings clusterSettings) |
static MockTransportService |
createNewService(org.elasticsearch.common.settings.Settings settings,
org.elasticsearch.Version version,
org.elasticsearch.threadpool.ThreadPool threadPool,
org.elasticsearch.common.settings.ClusterSettings clusterSettings) |
protected org.elasticsearch.tasks.TaskManager |
createTaskManager() |
protected void |
doClose() |
static org.elasticsearch.common.transport.TransportAddress[] |
extractTransportAddresses(org.elasticsearch.transport.TransportService transportService) |
org.elasticsearch.cluster.node.DiscoveryNode |
getLocalDiscoNode() |
org.elasticsearch.transport.Transport |
getOriginalTransport() |
org.elasticsearch.transport.Transport.Connection |
openConnection(org.elasticsearch.cluster.node.DiscoveryNode node,
org.elasticsearch.transport.ConnectionProfile profile) |
org.elasticsearch.transport.Transport |
original()
Returns the original Transport service wrapped by this mock transport service.
|
boolean |
removeTracer(MockTransportService.Tracer tracer) |
acceptIncomingRequests, addConnectionListener, addressesFromString, boundAddress, connectToNode, connectToNode, disconnectFromNode, doStart, doStop, getConnection, getLocalAddresses, getLocalNode, getRemoteClusterService, getRequestHandler, getTaskManager, getThreadPool, handshake, handshake, info, nodeConnected, registerRequestHandler, registerRequestHandler, removeConnectionListener, sendChildRequest, sendChildRequest, sendChildRequest, sendRequest, sendRequest, sendRequest, stats, submitRequest, submitRequest
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
public MockTransportService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.transport.Transport transport, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.transport.TransportInterceptor interceptor, @Nullable org.elasticsearch.common.settings.ClusterSettings clusterSettings)
clusterSettings
- if non null the the TransportService will register with the ClusterSettings
for settings
updates for TransportService.TRACE_LOG_EXCLUDE_SETTING
and TransportService.TRACE_LOG_INCLUDE_SETTING
.public MockTransportService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.transport.Transport transport, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.transport.TransportInterceptor interceptor, java.util.function.Function<org.elasticsearch.common.transport.BoundTransportAddress,org.elasticsearch.cluster.node.DiscoveryNode> localNodeFactory, @Nullable org.elasticsearch.common.settings.ClusterSettings clusterSettings)
clusterSettings
- if non null the the TransportService will register with the ClusterSettings
for settings
updates for TransportService.TRACE_LOG_EXCLUDE_SETTING
and TransportService.TRACE_LOG_INCLUDE_SETTING
.public static MockTransportService createNewService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.Version version, org.elasticsearch.threadpool.ThreadPool threadPool, @Nullable org.elasticsearch.common.settings.ClusterSettings clusterSettings)
public static MockTransportService createNewService(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.transport.Transport transport, org.elasticsearch.Version version, org.elasticsearch.threadpool.ThreadPool threadPool, @Nullable org.elasticsearch.common.settings.ClusterSettings clusterSettings)
public static org.elasticsearch.common.transport.TransportAddress[] extractTransportAddresses(org.elasticsearch.transport.TransportService transportService)
protected org.elasticsearch.tasks.TaskManager createTaskManager()
createTaskManager
in class org.elasticsearch.transport.TransportService
public void clearAllRules()
public void clearRule(org.elasticsearch.transport.TransportService transportService)
public void clearRule(org.elasticsearch.common.transport.TransportAddress transportAddress)
public org.elasticsearch.transport.Transport original()
public void addFailToSendNoConnectRule(org.elasticsearch.transport.TransportService transportService)
public void addFailToSendNoConnectRule(org.elasticsearch.common.transport.TransportAddress transportAddress)
public void addFailToSendNoConnectRule(org.elasticsearch.transport.TransportService transportService, java.lang.String... blockedActions)
public void addFailToSendNoConnectRule(org.elasticsearch.common.transport.TransportAddress transportAddress, java.lang.String... blockedActions)
public void addFailToSendNoConnectRule(org.elasticsearch.transport.TransportService transportService, java.util.Set<java.lang.String> blockedActions)
public void addFailToSendNoConnectRule(org.elasticsearch.common.transport.TransportAddress transportAddress, java.util.Set<java.lang.String> blockedActions)
public void addUnresponsiveRule(org.elasticsearch.transport.TransportService transportService)
public void addUnresponsiveRule(org.elasticsearch.common.transport.TransportAddress transportAddress)
public void addUnresponsiveRule(org.elasticsearch.transport.TransportService transportService, org.elasticsearch.common.unit.TimeValue duration)
duration
- the amount of time to delay sending and connecting.public void addUnresponsiveRule(org.elasticsearch.common.transport.TransportAddress transportAddress, org.elasticsearch.common.unit.TimeValue duration)
duration
- the amount of time to delay sending and connecting.public boolean addDelegate(org.elasticsearch.transport.TransportService transportService, MockTransportService.DelegateTransport transport)
public boolean addDelegate(org.elasticsearch.common.transport.TransportAddress transportAddress, MockTransportService.DelegateTransport transport)
public void addTracer(MockTransportService.Tracer tracer)
public boolean removeTracer(MockTransportService.Tracer tracer)
public void clearTracers()
protected org.elasticsearch.transport.TransportService.Adapter createAdapter()
createAdapter
in class org.elasticsearch.transport.TransportService
public org.elasticsearch.transport.Transport getOriginalTransport()
public org.elasticsearch.transport.Transport.Connection openConnection(org.elasticsearch.cluster.node.DiscoveryNode node, org.elasticsearch.transport.ConnectionProfile profile) throws java.io.IOException
openConnection
in class org.elasticsearch.transport.TransportService
java.io.IOException
protected void doClose() throws java.io.IOException
doClose
in class org.elasticsearch.transport.TransportService
java.io.IOException
public org.elasticsearch.cluster.node.DiscoveryNode getLocalDiscoNode()