public class DockerComposeContainer<SELF extends DockerComposeContainer<SELF>> extends FailureDetectingExternalResource implements Startable
| Modifier and Type | Class and Description |
|---|---|
static class |
DockerComposeContainer.RemoveImages |
| 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.util.Optional<ContainerState> |
getContainerByServiceName(java.lang.String serviceName) |
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,
@NonNull WaitStrategy waitStrategy)
Specify the
WaitStrategy to use to determine if the container is ready. |
SELF |
withBuild(boolean build)
Whether to always build images before starting containers.
|
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,
@NonNull 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 |
withOptions(java.lang.String... options)
Adds options to the docker-compose command, e.g.
|
SELF |
withPull(boolean pull)
Whether to pull images first.
|
SELF |
withRemoveImages(DockerComposeContainer.RemoveImages removeImages)
Remove images after containers shutdown.
|
SELF |
withScaledService(java.lang.String serviceBaseName,
int numInstances) |
SELF |
withServices(java.lang.String... services) |
SELF |
withTailChildContainers(boolean tailChildContainers)
Whether to tail child container logs.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getDependencies@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.TestRuleapply 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 FailureDetectingExternalResourcepublic SELF withServices(@NonNull java.lang.String... services)
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 @NonNull WaitStrategy waitStrategy)
public SELF waitingFor(java.lang.String serviceName, @NonNull @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 topublic SELF withBuild(boolean build)
public SELF withOptions(java.lang.String... options)
public SELF withRemoveImages(DockerComposeContainer.RemoveImages removeImages)
public java.util.Optional<ContainerState> getContainerByServiceName(java.lang.String serviceName)