public final class MockConnectionInfo extends Object implements ConnectionInfo
ConnectionInfo
for testing.Modifier and Type | Class and Description |
---|---|
static class |
MockConnectionInfo.Builder |
Modifier and Type | Method and Description |
---|---|
static MockConnectionInfo.Builder |
builder()
Provides a builder for
MockConnectionInfo . |
static MockConnectionInfo |
empty()
Provide an empty
MockConnectionInfo . |
int |
getCommitCount()
Returns how many times
Connection.commitTransaction() method is called. |
String |
getConnectionId()
Get ID for the connection.
|
io.r2dbc.spi.Connection |
getOriginalConnection()
Retrieve original
Connection . |
int |
getRollbackCount()
Returns how many times
Connection.rollbackTransaction() method is called. |
int |
getTransactionCount()
Returns how many times
Connection.beginTransaction() method is called. |
ValueStore |
getValueStore()
Retrieve
ValueStore which is associated to the scope of logical connection. |
void |
incrementCommitCount()
Increment commit count.
|
void |
incrementRollbackCount()
Increment rollback count.
|
void |
incrementTransactionCount()
Increment transaction count.
|
boolean |
isClosed()
Returns whether connection is closed or not.
|
void |
setClosed(boolean closed)
Set
boolean to indicate whether the connection is closed or not. |
public static MockConnectionInfo.Builder builder()
MockConnectionInfo
.public static MockConnectionInfo empty()
MockConnectionInfo
.MockConnectionInfo
.public io.r2dbc.spi.Connection getOriginalConnection()
ConnectionInfo
Connection
.getOriginalConnection
in interface ConnectionInfo
public String getConnectionId()
ConnectionInfo
getConnectionId
in interface ConnectionInfo
ConnectionIdManager
public void incrementTransactionCount()
ConnectionInfo
incrementTransactionCount
in interface ConnectionInfo
public void incrementCommitCount()
ConnectionInfo
incrementCommitCount
in interface ConnectionInfo
public void incrementRollbackCount()
ConnectionInfo
incrementRollbackCount
in interface ConnectionInfo
public int getTransactionCount()
ConnectionInfo
Connection.beginTransaction()
method is called.getTransactionCount
in interface ConnectionInfo
public int getCommitCount()
ConnectionInfo
Connection.commitTransaction()
method is called.getCommitCount
in interface ConnectionInfo
public int getRollbackCount()
ConnectionInfo
Connection.rollbackTransaction()
method is called.getRollbackCount
in interface ConnectionInfo
public boolean isClosed()
ConnectionInfo
isClosed
in interface ConnectionInfo
true
if connection is closedpublic void setClosed(boolean closed)
ConnectionInfo
boolean
to indicate whether the connection is closed or not.setClosed
in interface ConnectionInfo
closed
- set true
if Connection
is closedpublic ValueStore getValueStore()
ConnectionInfo
ValueStore
which is associated to the scope of logical connection.
Values can be stored or retrieved from this store while connection is available.
getValueStore
in interface ConnectionInfo
Copyright © 2024. All rights reserved.