This ConnectionProvider wraps a delegate
ConnectionProvider and wraps all acquired Connection
references in MockConnection.
Disclaimer
The general idea of mocking a JDBC connection with this jOOQ API is to provide quick workarounds, injection points, etc. using a very simple JDBC abstraction. It is NOT RECOMMENDED to emulate an entire database (including complex state transitions, transactions, locking, etc.) using this mock API. Once you have this requirement, please consider using an actual database instead for integration testing (e.g. using https://www.testcontainers.org), rather than implementing your test database inside of a MockDataProvider.
| Modifier and Type | Class and Description |
|---|---|
| private class | MockConnectionProvider.MockConnectionWrapper
Deprecated
as a consequence of
MockConnection being deprecated.
|
| Modifier and Type | Field and Description |
|---|---|
| private final ConnectionProvider | |
| private final MockDataProvider |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final Connection | acquire()
Implements org. |
| public final void | release(Connection
A connection that was previously obtained from
connection)acquire(). This is never null.Implements org. |
| delegate | back to summary |
|---|---|
| private final ConnectionProvider delegate | |
| provider | back to summary |
|---|---|
| private final MockDataProvider provider | |
| MockConnectionProvider | back to summary |
|---|---|
| public MockConnectionProvider(ConnectionProvider delegate, MockDataProvider provider) | |
| acquire | back to summary |
|---|---|
| public final Connection acquire() Implements org. Doc from org. Acquire a connection from the connection lifecycle handler.
This method is called by jOOQ exactly once per execution lifecycle, i.e.
per
jOOQ will guarantee that every acquired connection is released through
| |
| release | back to summary |
|---|---|
| public final void release(Connection connection) Implements org. Doc from org. Release a connection to the connection lifecycle handler. jOOQ will guarantee that every acquired connection is released exactly once.
| |
Deprecated
as a consequence of MockConnection being deprecated. See corresponding docs for further information.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Connection |
| Access | Constructor and Description |
|---|---|
| public |
| connection | back to summary |
|---|---|
| pack-priv final Connection connection | |
| MockConnectionWrapper | back to summary |
|---|---|
| public MockConnectionWrapper(Connection connection) | |