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.Builderbuilder()Provides a builder forMockConnectionInfo.static MockConnectionInfoempty()Provide an emptyMockConnectionInfo.intReturns how many timesConnection.commitTransaction()method is called.Get ID for the connection.Retrieve originalConnection.intReturns how many timesConnection.rollbackTransaction()method is called.intReturns how many timesConnection.beginTransaction()method is called.RetrieveValueStorewhich is associated to the scope of logical connection.voidIncrement commit count.voidIncrement rollback count.voidIncrement transaction count.booleanisClosed()Returns whether connection is closed or not.voidsetClosed(boolean closed) Setbooleanto 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:ConnectionInfoRetrieve originalConnection.- Specified by:
getOriginalConnectionin interfaceConnectionInfo- Returns:
- connection;
nullis returned whenConnectionInfois evaluated before it is associated with an actual connection, for example, duringProxyExecutionListener.beforeMethod(MethodExecutionInfo)forConnectionFactory.create().
-
getConnectionId
Description copied from interface:ConnectionInfoGet ID for the connection.- Specified by:
getConnectionIdin interfaceConnectionInfo- Returns:
- connection ID;
nullis returned whenConnectionInfois 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:ConnectionInfoIncrement transaction count.- Specified by:
incrementTransactionCountin interfaceConnectionInfo
-
incrementCommitCount
public void incrementCommitCount()Description copied from interface:ConnectionInfoIncrement commit count.- Specified by:
incrementCommitCountin interfaceConnectionInfo
-
incrementRollbackCount
public void incrementRollbackCount()Description copied from interface:ConnectionInfoIncrement rollback count.- Specified by:
incrementRollbackCountin interfaceConnectionInfo
-
getTransactionCount
public int getTransactionCount()Description copied from interface:ConnectionInfoReturns how many timesConnection.beginTransaction()method is called.- Specified by:
getTransactionCountin interfaceConnectionInfo- Returns:
- num of beginTransaction() method being called
-
getCommitCount
public int getCommitCount()Description copied from interface:ConnectionInfoReturns how many timesConnection.commitTransaction()method is called.- Specified by:
getCommitCountin interfaceConnectionInfo- Returns:
- num of commitTransaction method being called
-
getRollbackCount
public int getRollbackCount()Description copied from interface:ConnectionInfoReturns how many timesConnection.rollbackTransaction()method is called.- Specified by:
getRollbackCountin interfaceConnectionInfo- Returns:
- num of rollback methods being called
-
isClosed
public boolean isClosed()Description copied from interface:ConnectionInfoReturns whether connection is closed or not.- Specified by:
isClosedin interfaceConnectionInfo- Returns:
trueif connection is closed
-
setClosed
public void setClosed(boolean closed) Description copied from interface:ConnectionInfoSetbooleanto indicate whether the connection is closed or not.- Specified by:
setClosedin interfaceConnectionInfo- Parameters:
closed- settrueifConnectionis closed
-
getValueStore
Description copied from interface:ConnectionInfoRetrieveValueStorewhich is associated to the scope of logical connection.Values can be stored or retrieved from this store while connection is available.
- Specified by:
getValueStorein interfaceConnectionInfo- Returns:
- value store
-