Class DockerDatabaseWrapper
- java.lang.Object
-
- liquibase.extension.testing.testsystem.wrapper.DatabaseWrapper
-
- liquibase.extension.testing.testsystem.wrapper.DockerDatabaseWrapper
-
public class DockerDatabaseWrapper extends DatabaseWrapper
Implementation ofDatabaseWrapper
for databases that are managed via docker inJdbcDatabaseContainer
s.
-
-
Field Summary
Fields Modifier and Type Field Description static String
TEST_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 String
describe()
Describes the configuration of this wrapper.org.testcontainers.containers.JdbcDatabaseContainer
getContainer()
String
getUrl()
String
getUsername()
protected void
mapPorts(org.testcontainers.containers.JdbcDatabaseContainer container)
protected Runnable
requireLicense()
If the container requires the user accepting a license, return a Runnable which will accept it.void
start()
Start the database if possible and ensure it can be connected to.void
stop()
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:DatabaseWrapper
Describes the configuration of this wrapper. Used in outputting to user how this connection is configured.- Specified by:
describe
in classDatabaseWrapper
-
start
public void start() throws Exception
Description copied from class:DatabaseWrapper
Start 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:
start
in 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 Exception
Description copied from class:DatabaseWrapper
Stop the database if possible. If the database is managed externally, do not actually stop it.- Specified by:
stop
in classDatabaseWrapper
- Throws:
Exception
-
getUrl
public String getUrl()
- Specified by:
getUrl
in classDatabaseWrapper
-
getContainer
public org.testcontainers.containers.JdbcDatabaseContainer getContainer()
-
getUsername
public String getUsername()
- Specified by:
getUsername
in classDatabaseWrapper
-
-