Package org.jdbi.v3.testing.junit5.tc
Class JdbiTestcontainersExtension
java.lang.Object
org.jdbi.v3.testing.junit5.JdbiExtension
org.jdbi.v3.testing.junit5.tc.JdbiTestcontainersExtension
- All Implemented Interfaces:
- AfterAllCallback,- AfterEachCallback,- BeforeAllCallback,- BeforeEachCallback,- Extension,- ParameterResolver,- TestInstantiationAwareExtension
Support Testcontainer JDBC containers as database for Jdbi tests.
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtensionTestInstantiationAwareExtension.ExtensionContextScope
- 
Method SummaryModifier and TypeMethodDescriptiongetUrl()Returns a JDBC url representing the data source used by this extension.static JdbiTestcontainersExtensioninstance(TestcontainersDatabaseInformation databaseInformation, JdbcDatabaseContainer<?> jdbcDatabaseContainer) Create a newJdbiExtensionthat uses the suppliedJdbcDatabaseContaineras database.static JdbiTestcontainersExtensioninstance(JdbcDatabaseContainer<?> jdbcDatabaseContainer) Create a newJdbiExtensionthat uses the suppliedJdbcDatabaseContaineras database.setShutdownWaitTimeInSeconds(int seconds) Sets the maximum wait time for shutting down the extension.Methods inherited from class org.jdbi.v3.testing.junit5.JdbiExtensionafterAll, afterEach, attach, beforeAll, beforeEach, enableLeakChecker, externalPostgres, getJdbi, getSharedHandle, h2, installPlugins, openHandle, otjEmbeddedPostgres, postgres, resolveParameter, sqlite, supportsParameter, withConfig, withInitializer, withPlugin, withPluginsMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtensiongetTestInstantiationExtensionContextScope
- 
Method Details- 
instanceCreate a newJdbiExtensionthat uses the suppliedJdbcDatabaseContaineras database. This must be a supported container instance.- Parameters:
- jdbcDatabaseContainer- A supported- JdbcDatabaseContainerinstance.
- Returns:
- An initialized JdbiExtensioninstance that uses the database container.
- Throws:
- IllegalArgumentException- If the provided container class is not supported.
 
- 
instancepublic static JdbiTestcontainersExtension instance(TestcontainersDatabaseInformation databaseInformation, JdbcDatabaseContainer<?> jdbcDatabaseContainer) Create a newJdbiExtensionthat uses the suppliedJdbcDatabaseContaineras database.- Parameters:
- databaseInformation- A- TestcontainersDatabaseInformationinstance that describes how to create new test-isolation databases or schemata.
- jdbcDatabaseContainer- A- JdbcDatabaseContainerinstance.
- Returns:
- An initialized JdbiExtensioninstance that uses the database container.
 
- 
setShutdownWaitTimeInSecondsSets the maximum wait time for shutting down the extension.- Since:
- 3.45.0
- See Also:
 
- 
getUrlDescription copied from class:JdbiExtensionReturns a JDBC url representing the data source used by this extension. This url is database-specific and may or may not be used to connect to the data source outside testing code that uses this extension (e.g. theJdbiSqliteExtensionreturns a constant uri for all database instances).- Specified by:
- getUrlin class- JdbiExtension
- Returns:
- A string representing the JDBC URL.
 
 
-