public class DockerComposeContainer<SELF extends DockerComposeContainer<SELF>> extends FailureDetectingExternalResource implements Startable
Constructor and Description |
---|
DockerComposeContainer(java.io.File... composeFiles) |
DockerComposeContainer(java.io.File composeFile,
java.lang.String identifier)
Deprecated.
|
DockerComposeContainer(java.util.List<java.io.File> composeFiles) |
DockerComposeContainer(java.lang.String identifier,
java.io.File... composeFiles) |
DockerComposeContainer(java.lang.String identifier,
java.util.List<java.io.File> composeFiles) |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description)
Deprecated.
|
protected void |
failed(java.lang.Throwable e,
org.junit.runner.Description description)
Deprecated.
|
void |
finished(org.junit.runner.Description description)
Deprecated.
|
java.lang.String |
getServiceHost(java.lang.String serviceName,
java.lang.Integer servicePort)
Get the host (e.g.
|
java.lang.Integer |
getServicePort(java.lang.String serviceName,
java.lang.Integer servicePort)
Get the port that an exposed service can be found at, from the host machine
(i.e.
|
void |
start() |
void |
starting(org.junit.runner.Description description)
Deprecated.
|
void |
stop() |
protected void |
succeeded(org.junit.runner.Description description)
Deprecated.
|
SELF |
waitingFor(java.lang.String serviceName,
WaitStrategy waitStrategy)
Specify the
WaitStrategy to use to determine if the container is ready. |
SELF |
withEnv(java.util.Map<java.lang.String,java.lang.String> env) |
SELF |
withEnv(java.lang.String key,
java.lang.String value) |
SELF |
withExposedService(java.lang.String serviceName,
int servicePort) |
DockerComposeContainer |
withExposedService(java.lang.String serviceName,
int instance,
int servicePort) |
DockerComposeContainer |
withExposedService(java.lang.String serviceName,
int instance,
int servicePort,
WaitStrategy waitStrategy) |
SELF |
withExposedService(java.lang.String serviceName,
int servicePort,
WaitStrategy waitStrategy) |
SELF |
withLocalCompose(boolean localCompose)
Use a local Docker Compose binary instead of a container.
|
SELF |
withLogConsumer(java.lang.String serviceName,
java.util.function.Consumer<OutputFrame> consumer)
Attach an output consumer at container startup, enabling stdout and stderr to be followed, waited on, etc.
|
SELF |
withPull(boolean pull)
Whether to pull images first.
|
SELF |
withScaledService(java.lang.String serviceBaseName,
int numInstances) |
SELF |
withTailChildContainers(boolean tailChildContainers)
Whether to tail child container logs.
|
@Deprecated public DockerComposeContainer(java.io.File composeFile, java.lang.String identifier)
public DockerComposeContainer(java.io.File... composeFiles)
public DockerComposeContainer(java.util.List<java.io.File> composeFiles)
public DockerComposeContainer(java.lang.String identifier, java.io.File... composeFiles)
public DockerComposeContainer(java.lang.String identifier, java.util.List<java.io.File> composeFiles)
@Deprecated public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
apply
in class FailureDetectingExternalResource
@Deprecated public void starting(org.junit.runner.Description description)
starting
in class FailureDetectingExternalResource
@Deprecated protected void succeeded(org.junit.runner.Description description)
succeeded
in class FailureDetectingExternalResource
@Deprecated protected void failed(java.lang.Throwable e, org.junit.runner.Description description)
failed
in class FailureDetectingExternalResource
@Deprecated public void finished(org.junit.runner.Description description)
finished
in class FailureDetectingExternalResource
public SELF withExposedService(java.lang.String serviceName, int servicePort)
public DockerComposeContainer withExposedService(java.lang.String serviceName, int instance, int servicePort)
public DockerComposeContainer withExposedService(java.lang.String serviceName, int instance, int servicePort, WaitStrategy waitStrategy)
public SELF withExposedService(java.lang.String serviceName, int servicePort, @NonNull WaitStrategy waitStrategy)
public SELF waitingFor(java.lang.String serviceName, @NonNull WaitStrategy waitStrategy)
WaitStrategy
to use to determine if the container is ready.serviceName
- the name of the service to wait forwaitStrategy
- the WaitStrategy to useWait.defaultWaitStrategy()
public java.lang.String getServiceHost(java.lang.String serviceName, java.lang.Integer servicePort)
The service must have been declared using DockerComposeContainer#withExposedService.
serviceName
- the name of the service as set in the docker-compose.yml file.servicePort
- the port exposed by the service container.public java.lang.Integer getServicePort(java.lang.String serviceName, java.lang.Integer servicePort)
The service must have been declared using DockerComposeContainer#withExposedService.
serviceName
- the name of the service as set in the docker-compose.yml file.servicePort
- the port exposed by the service container.public SELF withScaledService(java.lang.String serviceBaseName, int numInstances)
public SELF withEnv(java.lang.String key, java.lang.String value)
public SELF withEnv(java.util.Map<java.lang.String,java.lang.String> env)
public SELF withLocalCompose(boolean localCompose)
public SELF withPull(boolean pull)
public SELF withTailChildContainers(boolean tailChildContainers)
public SELF withLogConsumer(java.lang.String serviceName, java.util.function.Consumer<OutputFrame> consumer)
More than one consumer may be registered.
serviceName
- the name of the service as set in the docker-compose.yml fileconsumer
- consumer that output frames should be sent to