Package no.mnemonic.commons.junit.docker
Class MariaDBDockerResource
java.lang.Object
org.junit.rules.ExternalResource
no.mnemonic.commons.junit.docker.DockerResource
no.mnemonic.commons.junit.docker.MariaDBDockerResource
- All Implemented Interfaces:
org.junit.rules.TestRule
Deprecated.
Use jupiter-docker instead
MariaDBDockerResource is a JUnit resource which can be used to write integration tests against a MariaDB
server executed inside an isolated Docker container. It extends the basic
DockerResource and makes sure that
the container initialization waits until MariaDB is available.
Initialize MariaDBDockerResource in the following way as a ClassRule:
@ClassRule
public static MariaDBDockerResource elastic = MariaDBDockerResource.builder()
.setImageName("mariadb:10.0")
.build();
This resource will by default expose port 3306.
See DockerResource.Builder and MariaDBDockerResource.Builder for more information on the
configuration properties.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.Builder to createMariaDBDockerResourcewhich extendsDockerResource.Builder -
Method Summary
Modifier and TypeMethodDescriptionprotected org.mandas.docker.client.messages.HostConfigadditionalHostConfig(org.mandas.docker.client.messages.HostConfig config) Deprecated.Adds MariaDB specific host configuration to default configuration fromDockerResource.builder()Deprecated.Create builder for MariaDBDockerResource.protected booleanDeprecated.Verifies that MariaDB is reachable by issuing a simple mysqladmin command inside the MariaDB Docker container.protected voidDeprecated.Initializes MariaDB by executing the set up SQL script.voidtruncate()Deprecated.Truncate data stored inside the database by executing the truncate SQL script.Methods inherited from class no.mnemonic.commons.junit.docker.DockerResource
additionalContainerConfig, after, before, getContainerID, getDockerClient, getExposedHost, getExposedHostPortMethods inherited from class org.junit.rules.ExternalResource
apply
-
Method Details
-
truncate
public void truncate()Deprecated.Truncate data stored inside the database by executing the truncate SQL script.- Throws:
IllegalStateException- If SQL script could not be executed
-
builder
Deprecated.Create builder for MariaDBDockerResource.- Returns:
- Builder object
-
additionalHostConfig
protected org.mandas.docker.client.messages.HostConfig additionalHostConfig(org.mandas.docker.client.messages.HostConfig config) Deprecated.Adds MariaDB specific host configuration to default configuration fromDockerResource.- Overrides:
additionalHostConfigin classDockerResource- Parameters:
config- Default configuration as set up by DockerResource- Returns:
- Modified host configuration
-
isContainerReachable
protected boolean isContainerReachable()Deprecated.Verifies that MariaDB is reachable by issuing a simple mysqladmin command inside the MariaDB Docker container.- Overrides:
isContainerReachablein classDockerResource- Returns:
- True if mysqladmin command returns successfully
- Throws:
IllegalStateException- If mysqladmin command could not be executed
-
prepareContainer
protected void prepareContainer()Deprecated.Initializes MariaDB by executing the set up SQL script.- Overrides:
prepareContainerin classDockerResource- Throws:
IllegalStateException- If SQL script could not be executed
-