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 Details

    • MicrocksContainersEnsemble

      public MicrocksContainersEnsemble(String image)
      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

      public 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.
      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

      public MicrocksContainersEnsemble withPostman()
      Enable the Postman runtime container with default container image.
      Returns:
      self
    • withPostman

      public MicrocksContainersEnsemble withPostman(String image)
      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

      public MicrocksContainersEnsemble withAsyncFeature()
      Enable the Async Feature container with default container image (deduced from Microcks main one).
      Returns:
      self
    • withAsyncFeature

      public MicrocksContainersEnsemble withAsyncFeature(String image)
      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

      public MicrocksContainersEnsemble withKafkaConnection(KafkaConnection connection)
      Once the Async Feature is enabled, connects to a Kafka broker.
      Parameters:
      connection - Connection details to a Kafka broker.
      Returns:
      self
    • withAmazonSQSConnection

      public MicrocksContainersEnsemble withAmazonSQSConnection(AmazonServiceConnection connection)
      Once the Async Feature is enabled, connects to an Amazon SQS service.
      Parameters:
      connection - Connection details to an Amazon SQS service.
      Returns:
      self
    • withAmazonSNSConnection

      public MicrocksContainersEnsemble withAmazonSNSConnection(AmazonServiceConnection connection)
      Once the Async Feature is enabled, connects to an Amazon SNS service.
      Parameters:
      connection - Connection details to an Amazon SNS service.
      Returns:
      self
    • withAccessToHost

      public MicrocksContainersEnsemble withAccessToHost(boolean hostAccessible)
      Set host accessibility on ensemble containers.
      Parameters:
      hostAccessible - Host accessibility flag
      Returns:
      The ensemble being built
    • withMainArtifacts

      public MicrocksContainersEnsemble 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.
      Parameters:
      artifacts - A set of paths to artifacts that will be loaded as classpath resources
      Returns:
      self
    • withSecondaryArtifacts

      public MicrocksContainersEnsemble 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.
      Parameters:
      artifacts - A set of paths to artifacts that will be loaded as classpath resources
      Returns:
      self
    • withSecret

      public MicrocksContainersEnsemble withSecret(Secret secret)
      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 provided Startables start first. Note that the circular dependencies are not supported.
      Parameters:
      startables - A list of Startable to 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

      public MicrocksContainer 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

      public MicrocksAsyncMinionContainer getAsyncMinionContainer()
      Get the wrapped Async Minion container to access management methods.
      Returns:
      The wrapped Async minion container
    • start

      public void start()
      Specified by:
      start in interface org.testcontainers.lifecycle.Startable
    • stop

      public void stop()
      Specified by:
      stop in interface org.testcontainers.lifecycle.Startable