Class MockConnection
java.lang.Object
com.yahoo.config.subscription.impl.MockConnection
- All Implemented Interfaces:
Connection,ConnectionPool,AutoCloseable
For unit testing
- Author:
- hmusum
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interface -
Constructor Summary
ConstructorsConstructorDescriptionMockConnection(MockConnection.ResponseHandler responseHandler) MockConnection(MockConnection.ResponseHandler responseHandler, int numSpecs) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intcom.yahoo.jrt.RequestintgetSize()voidinvokeAsync(com.yahoo.jrt.Request request, Duration jrtTimeout, com.yahoo.jrt.RequestWaiter requestWaiter) voidinvokeSync(com.yahoo.jrt.Request request, Duration jrtTimeout) switchConnection(Connection connection) Switches to another (healthy, if possible) Connection instance.
-
Constructor Details
-
MockConnection
public MockConnection() -
MockConnection
-
MockConnection
-
-
Method Details
-
invokeAsync
public void invokeAsync(com.yahoo.jrt.Request request, Duration jrtTimeout, com.yahoo.jrt.RequestWaiter requestWaiter) - Specified by:
invokeAsyncin interfaceConnection
-
invokeSync
- Specified by:
invokeSyncin interfaceConnection
-
getAddress
- Specified by:
getAddressin interfaceConnection
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnectionPool
-
getCurrent
- Specified by:
getCurrentin interfaceConnectionPool
-
switchConnection
Description copied from interface:ConnectionPoolSwitches to another (healthy, if possible) Connection instance.ConnectionPool.getCurrent()will return this instance afterwards, which is also the return value.- Specified by:
switchConnectionin interfaceConnectionPool- Returns:
- a Connection
-
getSize
public int getSize()- Specified by:
getSizein interfaceConnectionPool
-
connections
- Specified by:
connectionsin interfaceConnectionPool
-
getNumberOfRequests
public int getNumberOfRequests() -
getRequest
public com.yahoo.jrt.Request getRequest()
-