Class ConfigurableNginxContainer

  • All Implemented Interfaces:
    AutoCloseable, org.junit.rules.TestRule, org.testcontainers.containers.Container, org.testcontainers.containers.ContainerState, org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.containers.wait.strategy.WaitStrategyTarget, org.testcontainers.lifecycle.Startable

    public class ConfigurableNginxContainer
    extends org.testcontainers.containers.NginxContainer
    A configurable subclass of the NginxContainer.
    Author:
    Kai Moritz
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.testcontainers.containers.GenericContainer

        org.testcontainers.containers.GenericContainer.AbstractWaitStrategy
      • Nested classes/interfaces inherited from interface org.testcontainers.containers.Container

        org.testcontainers.containers.Container.ExecResult
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_NGINX_PORT  
      • Fields inherited from class org.testcontainers.containers.GenericContainer

        CONTAINER_RUNNING_TIMEOUT_SEC, containerId, containerName, dependencies, dockerClient, dockerDaemonInfo, INTERNAL_HOST_HOSTNAME, waitStrategy
      • Fields inherited from interface org.testcontainers.containers.ContainerState

        STATE_HEALTHY
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigurableNginxContainer()
      Creates an instance with a default-configuration, that matches the static configuration of the base-class NginxContainer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void configure()  
      Map<String,​String> getGlobalDirectives()  
      ConfigurableNginxContainer withConfiguration​(String path)  
      ConfigurableNginxContainer withGlobalDirective​(String key, String value)
      Adds a global directive to the configuration-map.
      • Methods inherited from class org.testcontainers.containers.NginxContainer

        getBaseUrl, getLivenessCheckPorts, setCustomContent, withCustomContent
      • Methods inherited from class org.testcontainers.containers.GenericContainer

        addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, containerIsCreated, containerIsStarted, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, failed, fetchDockerDaemonInfo, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerDaemonInfo, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, toString, waitingFor, waitUntilContainerStarted, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectory
      • Methods inherited from interface org.testcontainers.containers.Container

        addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBind
      • Methods inherited from interface org.testcontainers.containers.ContainerState

        copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning
      • Methods inherited from interface org.testcontainers.containers.traits.LinkableContainer

        getContainerName
      • Methods inherited from interface org.testcontainers.lifecycle.Startable

        close
    • Constructor Detail

      • ConfigurableNginxContainer

        public ConfigurableNginxContainer()
        Creates an instance with a default-configuration, that matches the static configuration of the base-class NginxContainer
    • Method Detail

      • withGlobalDirective

        public ConfigurableNginxContainer withGlobalDirective​(String key,
                                                              String value)
        Adds a global directive to the configuration-map.

        This method can only be used to add global directives. Global directives are all directives, that are marked with the context Main in the {@link http://nginx.org/en/docs/ngx_core_module.html Nginx-documentation}, for example daemon, user and env.

        If you need to modify contexts, like server or http, you have to pass in a complete configuration.

        Parameters:
        key - The key of the directive
        value - The value of the directive (the ; is added automatically)
        Returns:
        this instance, to enable a fluid API.
      • configure

        protected void configure()
        Overrides:
        configure in class org.testcontainers.containers.GenericContainer