Interface ServerAdapter


public interface ServerAdapter
An adapter for application runtimes can use to define information including:
  • Default HTTP port
  • Default HTTPS port
  • Default startup timeout
  • Default Dockerfile
  • Default readiness path
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    configure(Set<org.testcontainers.containers.GenericContainer<?>> allContainers)
    An optional hook that may be implemented for the purposes of auto-wiring multiple containers the the test environment together.
    default int
     
    int
     
    int
     
    default org.testcontainers.images.builder.ImageFromDockerfile
    Returns a default Docker image using the current ServerAdapter as the base later and the provided appFile in addition to any other vendor-speicific items layerd on top.
    default int
     
    default Optional<String>
    Defines the readiness path for the Server which will be used by default when the developer did not specify such value.
    default void
    Sets configuration properties on an already-started runtime.
  • Field Details

  • Method Details

    • getPriority

      default int getPriority()
    • getDefaultHttpPort

      int getDefaultHttpPort()
      Returns:
      The default HTTP port for this runtime
    • getDefaultHttpsPort

      int getDefaultHttpsPort()
      Returns:
      The default HTTPS port for this runtime
    • getDefaultAppStartTimeout

      default int getDefaultAppStartTimeout()
      Returns:
      The default amount of time (in seconds) to wait for a runtime to start before assuming that application start has failed and aborting the start process. Implementation note: It is reccomended to increase the default app start timeout when running in remote CI environments such as TravisCI by checking for the CI=true env var.
    • setConfigProperties

      default void setConfigProperties(Map<String,String> properties)
      Sets configuration properties on an already-started runtime. If the runtime has not been started yet, it may be more efficient to use other means of setting properties, such as GenericContainer.withEnv(String,String) in the case of Testcontainers. Calling this method will override any previously set properties using this method
      Parameters:
      properties - A map of key/value pairs that should be set on the runtime
    • getDefaultImage

      default org.testcontainers.images.builder.ImageFromDockerfile getDefaultImage(File appFile)
      Returns a default Docker image using the current ServerAdapter as the base later and the provided appFile in addition to any other vendor-speicific items layerd on top.
      Parameters:
      appFile - The application file to include in the resulting Docker image
      Returns:
      The default docker image including the supplied appFile
    • getReadinessPath

      default Optional<String> getReadinessPath()
      Defines the readiness path for the Server which will be used by default when the developer did not specify such value.
      Returns:
      the readiness path to be used by default, or an empty Optional if no default value is provided.
    • configure

      default void configure(Set<org.testcontainers.containers.GenericContainer<?>> allContainers)
      An optional hook that may be implemented for the purposes of auto-wiring multiple containers the the test environment together.

      For example, the LibertyAdapter detects the presence of a KafkaContainer and will automatically configure the ApplicationContainer to communicate with it by calling GenericContainer.withEnv(String, String)

      Parameters:
      allContainers - An unmodifiable set of the containers discovered in the test environment