Class OfficeFloorDockerUtil


  • public class OfficeFloorDockerUtil
    extends java.lang.Object
    Docker wrapper for running third party services (typically for testing).
    Author:
    Daniel Sagenschneider
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static DockerContainerInstance ensureContainerAvailable​(java.lang.String containerName, java.lang.String imageName, java.util.function.Function<com.github.dockerjava.api.DockerClient,​com.github.dockerjava.api.command.CreateContainerCmd> createContainer)
      Ensures the docker container is available.
      static DockerNetworkInstance ensureNetworkAvailable​(java.lang.String networkName)
      Ensures the docker network is available.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OfficeFloorDockerUtil

        public OfficeFloorDockerUtil()
    • Method Detail

      • ensureNetworkAvailable

        public static DockerNetworkInstance ensureNetworkAvailable​(java.lang.String networkName)
                                                            throws java.lang.Exception
        Ensures the docker network is available.
        Parameters:
        networkName - Network name.
        Returns:
        DockerNetworkInstance of manage docker network.
        Throws:
        java.lang.Exception - If fails to ensure docker network available.
      • ensureContainerAvailable

        public static DockerContainerInstance ensureContainerAvailable​(java.lang.String containerName,
                                                                       java.lang.String imageName,
                                                                       java.util.function.Function<com.github.dockerjava.api.DockerClient,​com.github.dockerjava.api.command.CreateContainerCmd> createContainer)
                                                                throws java.lang.Exception
        Ensures the docker container is available.
        Parameters:
        containerName - Name of docker container.
        imageName - Name of the docker image.
        createContainer - Factory for the CreateContainerCmd if container not running.
        Returns:
        DockerContainerInstance to manage running docker container.
        Throws:
        java.lang.Exception - If fails to ensure docker container available.