Package org.elasticsearch.test.transport
Class CapturingTransport
java.lang.Object
org.elasticsearch.test.transport.StubbableTransport
org.elasticsearch.test.transport.MockTransport
org.elasticsearch.test.transport.CapturingTransport
- All Implemented Interfaces:
Closeable
,AutoCloseable
,LifecycleComponent
,org.elasticsearch.core.Releasable
,Transport
A transport class that doesn't send anything but rather captures all requests for inspection from tests
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.test.transport.StubbableTransport
StubbableTransport.OpenConnectionBehavior, StubbableTransport.RequestHandlingBehavior<Request extends TransportRequest>, StubbableTransport.SendRequestBehavior, StubbableTransport.WrappedConnection
Nested classes/interfaces inherited from interface org.elasticsearch.transport.Transport
Transport.Connection, Transport.RequestHandlers, Transport.ResponseContext<T extends TransportResponse>, Transport.ResponseHandlers
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionreturns all requests captured so far.returns all requests captured so far, grouped by target node.void
clear()
clears captured requestsReturns all requests captured so far.Returns all requests captured so far, grouped by target node.protected void
onSendRequest
(long requestId, String action, TransportRequest request, DiscoveryNode node) Methods inherited from class org.elasticsearch.test.transport.MockTransport
createConnection, createTransportService, getTransportResponseHandler, handleError, handleLocalError, handleRemoteError, handleResponse, setMessageListener, writeableRegistry
Methods inherited from class org.elasticsearch.test.transport.StubbableTransport
addLifecycleListener, addressesFromString, boundAddress, boundRemoteIngressAddress, close, getDefaultSeedAddresses, getRequestHandlers, getResponseHandlers, getStats, getVersion, lifecycleState, newNetworkBytesStream, openConnection, profileBoundAddresses, setDefaultConnectBehavior, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, start, stop
Methods inherited from interface org.elasticsearch.core.Releasable
close
Methods inherited from interface org.elasticsearch.transport.Transport
addressesFromString, boundAddress, boundRemoteIngressAddress, getDefaultSeedAddresses, getRequestHandlers, getResponseHandlers, getStats, getVersion, isSecure, newNetworkBytesStream, openConnection, profileBoundAddresses, registerRequestHandler, setMessageListener, setSlowLogThreshold
-
Constructor Details
-
CapturingTransport
public CapturingTransport()
-
-
Method Details
-
capturedRequests
returns all requests captured so far. Doesn't clear the captured request list. Seeclear()
-
getCapturedRequestsAndClear
Returns all requests captured so far. This method does clear the captured requests list. If you do not want the captured requests list cleared, usecapturedRequests()
.- Returns:
- the captured requests
-
capturedRequestsByTargetNode
returns all requests captured so far, grouped by target node. Doesn't clear the captured request list. Seeclear()
-
getCapturedRequestsByTargetNodeAndClear
public Map<String,List<CapturingTransport.CapturedRequest>> getCapturedRequestsByTargetNodeAndClear()Returns all requests captured so far, grouped by target node. This method does clear the captured request list. If you do not want the captured requests list cleared, usecapturedRequestsByTargetNode()
.- Returns:
- the captured requests grouped by target node
-
clear
public void clear()clears captured requests -
onSendRequest
protected void onSendRequest(long requestId, String action, TransportRequest request, DiscoveryNode node) - Overrides:
onSendRequest
in classMockTransport
-