Class DockerContainerObjectBuilder<T>

java.lang.Object
org.arquillian.cube.docker.impl.client.containerobject.DockerContainerObjectBuilder<T>

public class DockerContainerObjectBuilder<T> extends Object
Instantiate container objects. This class is not thread safe.
Author:
Ramon Rivas
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • withContainerObjectContainer

      public DockerContainerObjectBuilder<T> withContainerObjectContainer(Object containerObjectContainer)
      Specifies an optional object that has a strong reference to the object being created. If set, a reference to it is stored as part of the metadata of the container object. This object is expected to control the lifecycle of the container object
      Parameters:
      containerObjectContainer - the container object's container
      Returns:
      the current builder instance
      See Also:
    • withContainerObjectClass

      public DockerContainerObjectBuilder<T> withContainerObjectClass(Class<T> containerObjectClass)
      Specifies the container object class to be instantiated
      Parameters:
      containerObjectClass - container object class to be instantiated
      Returns:
      the current builder instance
    • withContainerObjectConfiguration

      public DockerContainerObjectBuilder<T> withContainerObjectConfiguration(ContainerObjectConfiguration configuration)
      Specifies a configuration (can be partial) to be used to override the default configuration set using annotations on the container object. The received configuration will be merged with the configuration extracted from the container object, and the resulting configuration will be used to build the docker container.

      Currently only supports instances of CubeContainerObjectConfiguration

      Parameters:
      configuration - partial configuration to override default container object cube configuration
      Returns:
      the current builder instance
      See Also:
    • withEnrichers

      public DockerContainerObjectBuilder<T> withEnrichers(Collection<org.jboss.arquillian.test.spi.TestEnricher> enrichers)
      Specifies the list of enrichers that will be used to enrich the container object.
      Parameters:
      enrichers - list of enrichers that will be used to enrich the container object
      Returns:
      the current builder instance
    • onCubeCreated

      public DockerContainerObjectBuilder<T> onCubeCreated(Consumer<DockerCube> cubeCreatedCallback)
      Specifies a consumer that will be executed after the cube object is created and after cube is created or started by the cube controller. Callers must use this callback to register anything necesary for the controller to work and also if they want to keep an instance of the created cube.
      Parameters:
      cubeCreatedCallback - consumer that will be called when the cube instance is created
      Returns:
      the current builder instance
    • build

      Triggers the building process, builds, creates and starts the docker container associated with the requested container object, creates the container object and returns it
      Returns:
      the created container object
      Throws:
      IllegalAccessException - if there is an error accessing the container object fields
      IOException - if there is an I/O error while preparing the docker build
      InvocationTargetException - if there is an error while calling the DockerFile archive creation