Class MockConnectionInfo
java.lang.Object
io.r2dbc.proxy.test.MockConnectionInfo
- All Implemented Interfaces:
ConnectionInfo
Mock implementation of
ConnectionInfo
for testing.- Author:
- Tadaya Tsuyukubo
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic MockConnectionInfo.Builder
builder()
Provides a builder forMockConnectionInfo
.static MockConnectionInfo
empty()
Provide an emptyMockConnectionInfo
.int
Returns how many timesConnection.commitTransaction()
method is called.Get ID for the connection.Retrieve originalConnection
.int
Returns how many timesConnection.rollbackTransaction()
method is called.int
Returns how many timesConnection.beginTransaction()
method is called.RetrieveValueStore
which is associated to the scope of logical connection.void
Increment commit count.void
Increment rollback count.void
Increment transaction count.boolean
isClosed()
Returns whether connection is closed or not.void
setClosed
(boolean closed) Setboolean
to indicate whether the connection is closed or not.
-
Method Details
-
builder
Provides a builder forMockConnectionInfo
.- Returns:
- builder
-
empty
Provide an emptyMockConnectionInfo
.- Returns:
- a
MockConnectionInfo
.
-
getOriginalConnection
Description copied from interface:ConnectionInfo
Retrieve originalConnection
.- Specified by:
getOriginalConnection
in interfaceConnectionInfo
- Returns:
- connection;
null
is returned whenConnectionInfo
is evaluated before it is associated with an actual connection, for example, duringProxyExecutionListener.beforeMethod(MethodExecutionInfo)
forConnectionFactory.create()
.
-
getConnectionId
Description copied from interface:ConnectionInfo
Get ID for the connection.- Specified by:
getConnectionId
in interfaceConnectionInfo
- Returns:
- connection ID;
null
is returned whenConnectionInfo
is evaluated before it is associated with an actual connection, for example, duringProxyExecutionListener.beforeMethod(MethodExecutionInfo)
forConnectionFactory.create()
. - See Also:
-
incrementTransactionCount
public void incrementTransactionCount()Description copied from interface:ConnectionInfo
Increment transaction count.- Specified by:
incrementTransactionCount
in interfaceConnectionInfo
-
incrementCommitCount
public void incrementCommitCount()Description copied from interface:ConnectionInfo
Increment commit count.- Specified by:
incrementCommitCount
in interfaceConnectionInfo
-
incrementRollbackCount
public void incrementRollbackCount()Description copied from interface:ConnectionInfo
Increment rollback count.- Specified by:
incrementRollbackCount
in interfaceConnectionInfo
-
getTransactionCount
public int getTransactionCount()Description copied from interface:ConnectionInfo
Returns how many timesConnection.beginTransaction()
method is called.- Specified by:
getTransactionCount
in interfaceConnectionInfo
- Returns:
- num of beginTransaction() method being called
-
getCommitCount
public int getCommitCount()Description copied from interface:ConnectionInfo
Returns how many timesConnection.commitTransaction()
method is called.- Specified by:
getCommitCount
in interfaceConnectionInfo
- Returns:
- num of commitTransaction method being called
-
getRollbackCount
public int getRollbackCount()Description copied from interface:ConnectionInfo
Returns how many timesConnection.rollbackTransaction()
method is called.- Specified by:
getRollbackCount
in interfaceConnectionInfo
- Returns:
- num of rollback methods being called
-
isClosed
public boolean isClosed()Description copied from interface:ConnectionInfo
Returns whether connection is closed or not.- Specified by:
isClosed
in interfaceConnectionInfo
- Returns:
true
if connection is closed
-
setClosed
public void setClosed(boolean closed) Description copied from interface:ConnectionInfo
Setboolean
to indicate whether the connection is closed or not.- Specified by:
setClosed
in interfaceConnectionInfo
- Parameters:
closed
- settrue
ifConnection
is closed
-
getValueStore
Description copied from interface:ConnectionInfo
RetrieveValueStore
which is associated to the scope of logical connection.Values can be stored or retrieved from this store while connection is available.
- Specified by:
getValueStore
in interfaceConnectionInfo
- Returns:
- value store
-