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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    TestCleaner will call this at the end of the test automatically
    get()
    Lazily starts a container and returns the instance.
    org.jenkinsci.test.acceptance.docker.DockerImage.Starter<T>
    Provides a starter directly, so you can customize it a bit before calling DockerImage.Starter.start().

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DockerContainerHolder

      public DockerContainerHolder()
  • Method Details

    • get

      public T get()
      Lazily starts a container and returns the instance.
      Specified by:
      get in interface jakarta.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 calling DockerImage.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 interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException