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 public class MariaDBDockerResource extends DockerResource
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.
  • 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

      public static MariaDBDockerResource.Builder 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 from DockerResource.
      Overrides:
      additionalHostConfig in class DockerResource
      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:
      isContainerReachable in class DockerResource
      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:
      prepareContainer in class DockerResource
      Throws:
      IllegalStateException - If SQL script could not be executed