Class DockerContainerObjectBuilder<T>
java.lang.Object
org.arquillian.cube.docker.impl.client.containerobject.DockerContainerObjectBuilder<T>
Instantiate container objects. This class is not thread safe.
- Author:
- Ramon Rivas
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDockerContainerObjectBuilder(DockerClientExecutor dockerClientExecutor, CubeController cubeController, CubeRegistry cubeRegistry) -
Method Summary
Modifier and TypeMethodDescriptionbuild()Triggers the building process, builds, creates and starts the docker container associated with the requested container object, creates the container object and returns itonCubeCreated(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.withContainerObjectClass(Class<T> containerObjectClass) Specifies the container object class to be instantiatedwithContainerObjectConfiguration(ContainerObjectConfiguration configuration) Specifies a configuration (can be partial) to be used to override the default configuration set using annotations on the container object.withContainerObjectContainer(Object containerObjectContainer) Specifies an optional object that has a strong reference to the object being created.withEnrichers(Collection<org.jboss.arquillian.test.spi.TestEnricher> enrichers) Specifies the list of enrichers that will be used to enrich the container object.
-
Field Details
-
TEMPORARY_FOLDER_PREFIX
- See Also:
-
TEMPORARY_FOLDER_SUFFIX
- See Also:
-
-
Constructor Details
-
DockerContainerObjectBuilder
public DockerContainerObjectBuilder(DockerClientExecutor dockerClientExecutor, CubeController cubeController, CubeRegistry cubeRegistry)
-
-
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
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
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 fieldsIOException- if there is an I/O error while preparing the docker buildInvocationTargetException- if there is an error while calling the DockerFile archive creation
-