Class MicrocksContainersEnsemble
java.lang.Object
io.github.microcks.testcontainers.MicrocksContainersEnsemble
- All Implemented Interfaces:
AutoCloseable,org.testcontainers.lifecycle.Startable
public class MicrocksContainersEnsemble
extends Object
implements org.testcontainers.lifecycle.Startable
An abstraction other a set of containers needed for advanced Microcks services (such as Postman runtime support
or Asynchronous features). Use this when a single
MicrocksContainer is not enough.- Author:
- laurent
-
Constructor Summary
ConstructorsConstructorDescriptionMicrocksContainersEnsemble(String image) Build a new MicrocksContainersEnsemble with its base container image name as string.MicrocksContainersEnsemble(org.testcontainers.containers.Network network, String image) Build a new MicrocksContainersEnsemble with a pre-existing network and with its base container full image name.MicrocksContainersEnsemble(org.testcontainers.containers.Network network, org.testcontainers.utility.DockerImageName image) Build a new MicrocksContainersEnsemble with a pre-existing network and with its base container full image name. -
Method Summary
Modifier and TypeMethodDescriptionGet the wrapped Async Minion container to access management methods.Get the main MicrocksContainer to access the endpoints, artifact management and test methods.org.testcontainers.containers.NetworkGet the Docker network used by this ensemble of Microcks containers.org.testcontainers.containers.GenericContainer<?>Get the wrapped Postman runtime container to access management methods.voidstart()voidstop()withAccessToHost(boolean hostAccessible) Set host accessibility on ensemble containers.withAmazonSNSConnection(AmazonServiceConnection connection) Once the Async Feature is enabled, connects to an Amazon SNS service.withAmazonSQSConnection(AmazonServiceConnection connection) Once the Async Feature is enabled, connects to an Amazon SQS service.withAsyncDependsOn(org.testcontainers.lifecycle.Startable... startables) Delays the Async Minion container's creation and start until providedStartables start first.Enable the Async Feature container with default container image (deduced from Microcks main one).withAsyncFeature(String image) Enable the Async Feature container with provided container image.withKafkaConnection(KafkaConnection connection) Once the Async Feature is enabled, connects to a Kafka broker.withMainArtifacts(String... artifacts) Provide paths to artifacts that will be imported as primary or main ones within the Microcks container once it will be started and healthy.Enable the Postman runtime container with default container image.withPostman(String image) Enable the Postman runtime container with provided container image.withSecondaryArtifacts(String... artifacts) Provide paths to artifacts that will be imported as secondary ones within the Microcks container once it will be started and healthy.withSecret(Secret secret) Provide Secret that should be imported in Microcks after startup.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.testcontainers.lifecycle.Startable
close, getDependencies
-
Constructor Details
-
MicrocksContainersEnsemble
Build a new MicrocksContainersEnsemble with its base container image name as string. This image must be compatible with quay.io/microcks/microcks-uber image.- Parameters:
image- The name (with tag/version) of Microcks Uber distribution to use.
-
MicrocksContainersEnsemble
Build a new MicrocksContainersEnsemble with a pre-existing network and with its base container full image name.- Parameters:
network- The network to attach ensemble containers to.image- This image must be compatible with quay.io/microcks/microcks-uber image.
-
MicrocksContainersEnsemble
public MicrocksContainersEnsemble(org.testcontainers.containers.Network network, org.testcontainers.utility.DockerImageName image) Build a new MicrocksContainersEnsemble with a pre-existing network and with its base container full image name.- Parameters:
network- The network to attach ensemble containers to.image- This image must be compatible with quay.io/microcks/microcks-uber image.
-
-
Method Details
-
withPostman
Enable the Postman runtime container with default container image.- Returns:
- self
-
withPostman
Enable the Postman runtime container with provided container image.- Parameters:
image- The name (with tag/version) of Microcks Postman runtime to use.- Returns:
- self
-
withAsyncFeature
Enable the Async Feature container with default container image (deduced from Microcks main one).- Returns:
- self
-
withAsyncFeature
Enable the Async Feature container with provided container image.- Parameters:
image- The name (with tag/version) of Microcks Async Minion Uber distribution to use.- Returns:
- self
-
withKafkaConnection
Once the Async Feature is enabled, connects to a Kafka broker.- Parameters:
connection- Connection details to a Kafka broker.- Returns:
- self
-
withAmazonSQSConnection
Once the Async Feature is enabled, connects to an Amazon SQS service.- Parameters:
connection- Connection details to an Amazon SQS service.- Returns:
- self
-
withAmazonSNSConnection
Once the Async Feature is enabled, connects to an Amazon SNS service.- Parameters:
connection- Connection details to an Amazon SNS service.- Returns:
- self
-
withAccessToHost
Set host accessibility on ensemble containers.- Parameters:
hostAccessible- Host accessibility flag- Returns:
- The ensemble being built
-
withMainArtifacts
Provide paths to artifacts that will be imported as primary or main ones within the Microcks container once it will be started and healthy.- Parameters:
artifacts- A set of paths to artifacts that will be loaded as classpath resources- Returns:
- self
-
withSecondaryArtifacts
Provide paths to artifacts that will be imported as secondary ones within the Microcks container once it will be started and healthy.- Parameters:
artifacts- A set of paths to artifacts that will be loaded as classpath resources- Returns:
- self
-
withSecret
Provide Secret that should be imported in Microcks after startup.- Parameters:
secret- The description of a secret to access remote Git repository, test endpoint or broker.- Returns:
- self
-
withAsyncDependsOn
public MicrocksContainersEnsemble withAsyncDependsOn(org.testcontainers.lifecycle.Startable... startables) Delays the Async Minion container's creation and start until providedStartables start first. Note that the circular dependencies are not supported.- Parameters:
startables- A list ofStartableto depend on- Returns:
- self
-
getNetwork
public org.testcontainers.containers.Network getNetwork()Get the Docker network used by this ensemble of Microcks containers.- Returns:
- The network ensemble containers are attached to.
-
getMicrocksContainer
Get the main MicrocksContainer to access the endpoints, artifact management and test methods.- Returns:
- The main wrapped MicrocksContainer
-
getPostmanContainer
public org.testcontainers.containers.GenericContainer<?> getPostmanContainer()Get the wrapped Postman runtime container to access management methods.- Returns:
- The wrapped Postman runtime container
-
getAsyncMinionContainer
Get the wrapped Async Minion container to access management methods.- Returns:
- The wrapped Async minion container
-
start
public void start()- Specified by:
startin interfaceorg.testcontainers.lifecycle.Startable
-
stop
public void stop()- Specified by:
stopin interfaceorg.testcontainers.lifecycle.Startable
-