Class DockerDatabaseWrapper
- java.lang.Object
-
- liquibase.extension.testing.testsystem.wrapper.DatabaseWrapper
-
- liquibase.extension.testing.testsystem.wrapper.DockerDatabaseWrapper
-
public class DockerDatabaseWrapper extends DatabaseWrapper
Implementation ofDatabaseWrapperfor databases that are managed via docker inJdbcDatabaseContainers.
-
-
Field Summary
Fields Modifier and Type Field Description static StringTEST_SYSTEM_LABEL
-
Constructor Summary
Constructors Constructor Description DockerDatabaseWrapper(org.testcontainers.containers.JdbcDatabaseContainer container, TestSystem testSystem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdescribe()Describes the configuration of this wrapper.org.testcontainers.containers.JdbcDatabaseContainergetContainer()StringgetUrl()StringgetUsername()protected voidmapPorts(org.testcontainers.containers.JdbcDatabaseContainer container)protected RunnablerequireLicense()If the container requires the user accepting a license, return a Runnable which will accept it.voidstart()Start the database if possible and ensure it can be connected to.voidstop()Stop the database if possible.
-
-
-
Field Detail
-
TEST_SYSTEM_LABEL
public static final String TEST_SYSTEM_LABEL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DockerDatabaseWrapper
public DockerDatabaseWrapper(org.testcontainers.containers.JdbcDatabaseContainer container, TestSystem testSystem)
-
-
Method Detail
-
describe
public String describe()
Description copied from class:DatabaseWrapperDescribes the configuration of this wrapper. Used in outputting to user how this connection is configured.- Specified by:
describein classDatabaseWrapper
-
start
public void start() throws ExceptionDescription copied from class:DatabaseWrapperStart the database if possible and ensure it can be connected to. If the database is managed externally, just ensure it can be connected to.- Specified by:
startin classDatabaseWrapper- Throws:
Exception
-
requireLicense
protected Runnable requireLicense()
If the container requires the user accepting a license, return a Runnable which will accept it.- Returns:
- a non-null value if
start()should call the Runnable if the user accepted the license.
-
mapPorts
protected void mapPorts(org.testcontainers.containers.JdbcDatabaseContainer container)
-
stop
public void stop() throws ExceptionDescription copied from class:DatabaseWrapperStop the database if possible. If the database is managed externally, do not actually stop it.- Specified by:
stopin classDatabaseWrapper- Throws:
Exception
-
getUrl
public String getUrl()
- Specified by:
getUrlin classDatabaseWrapper
-
getContainer
public org.testcontainers.containers.JdbcDatabaseContainer getContainer()
-
getUsername
public String getUsername()
- Specified by:
getUsernamein classDatabaseWrapper
-
-