Class DockerContainerHolder<T extends org.jenkinsci.test.acceptance.docker.DockerContainer>
- java.lang.Object
-
- org.jenkinsci.test.acceptance.docker.DockerContainerHolder<T>
-
- All Implemented Interfaces:
jakarta.inject.Provider<T>
,Closeable
,AutoCloseable
,AutoCleaned
- Direct Known Subclasses:
MailhogProvider
@TestScope public class DockerContainerHolder<T extends org.jenkinsci.test.acceptance.docker.DockerContainer> extends Object implements jakarta.inject.Provider<T>, AutoCleaned
Inject this object to automate the cleanup of a running container at the end of the test case.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description DockerContainerHolder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
TestCleaner
will call this at the end of the test automaticallyT
get()
Lazily starts a container and returns the instance.org.jenkinsci.test.acceptance.docker.DockerImage.Starter<T>
starter()
Provides a starter directly, so you can customize it a bit before callingDockerImage.Starter.start()
.
-
-
-
Method Detail
-
get
public T get()
Lazily starts a container and returns the instance.- Specified by:
get
in interfacejakarta.inject.Provider<T extends org.jenkinsci.test.acceptance.docker.DockerContainer>
-
starter
public org.jenkinsci.test.acceptance.docker.DockerImage.Starter<T> starter() throws IOException, InterruptedException
Provides a starter directly, so you can customize it a bit before callingDockerImage.Starter.start()
.- Throws:
IOException
InterruptedException
-
close
public void close() throws IOException
TestCleaner
will call this at the end of the test automatically- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-