Interface ServerAdapter
-
public interface ServerAdapterAn 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 intPRIORITY_DEFAULTstatic intPRIORITY_RUNTIME_MODULEstatic intPRIORITY_USER_DEFAULT
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidconfigure(java.util.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 intgetDefaultAppStartTimeout()intgetDefaultHttpPort()intgetDefaultHttpsPort()default org.testcontainers.images.builder.ImageFromDockerfilegetDefaultImage(java.io.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.default intgetPriority()default java.util.Optional<java.lang.String>getReadinessPath()Defines the readiness path for the Server which will be used by default when the developer did not specify such value.default voidsetConfigProperties(java.util.Map<java.lang.String,java.lang.String> properties)Sets configuration properties on an already-started runtime.
-
-
-
Field Detail
-
PRIORITY_USER_DEFAULT
static final int PRIORITY_USER_DEFAULT
- See Also:
- Constant Field Values
-
PRIORITY_DEFAULT
static final int PRIORITY_DEFAULT
- See Also:
- Constant Field Values
-
PRIORITY_RUNTIME_MODULE
static final int PRIORITY_RUNTIME_MODULE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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(java.util.Map<java.lang.String,java.lang.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 asGenericContainer.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(java.io.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 java.util.Optional<java.lang.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(java.util.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
LibertyAdapterdetects the presence of a KafkaContainer and will automatically configure the ApplicationContainer to communicate with it by callingGenericContainer.withEnv(String, String)- Parameters:
allContainers- An unmodifiable set of the containers discovered in the test environment
-
-