Class FlinkImageBuilder

java.lang.Object
org.apache.flink.connector.testframe.container.FlinkImageBuilder

public class FlinkImageBuilder extends Object
A builder class for constructing Docker image based on flink-dist.
  • Constructor Details

    • FlinkImageBuilder

      public FlinkImageBuilder()
  • Method Details

    • setTempDirectory

      public FlinkImageBuilder setTempDirectory(Path tempDirectory)
      Sets temporary path for holding temp files when building the image.

      Note that this parameter is required, because the builder doesn't have lifecycle management, and it is the caller's responsibility to create and remove the temp directory.

    • setFlinkHome

      public FlinkImageBuilder setFlinkHome(String flinkHome)
      Sets flink home.
      Parameters:
      flinkHome - The flink home.
      Returns:
      The flink home.
    • setImageNamePrefix

      public FlinkImageBuilder setImageNamePrefix(String imageNamePrefix)
      Sets the prefix name of building image.

      If the name is not specified, DEFAULT_IMAGE_NAME_BUILD_PREFIX will be used.

    • setFlinkDistPath

      public FlinkImageBuilder setFlinkDistPath(Path flinkDist)
      Sets the path of flink-dist directory.

      If path is not specified, the dist directory under current project will be used.

    • setJavaVersion

      public FlinkImageBuilder setJavaVersion(String javaVersion)
      Sets JDK version in the image.

      This version string will be used as the tag of openjdk image. If version is not specified, the JDK version of the current JVM will be used.

      See Also:
    • setConfiguration

      public FlinkImageBuilder setConfiguration(org.apache.flink.configuration.Configuration conf)
      Sets Flink configuration. This configuration will be used for generating config.yaml for configuring JobManager and TaskManager.
    • setLogProperties

      public FlinkImageBuilder setLogProperties(Properties logProperties)
      Sets log4j properties.

      Containers will use "log4j-console.properties" under flink-dist as the base configuration of loggers. Properties specified by this method will be appended to the config file, or overwrite the property if already exists in the base config file.

    • copyFile

      public FlinkImageBuilder copyFile(Path localPath, Path containerPath)
      Copies file into the image.
    • setTimeout

      public FlinkImageBuilder setTimeout(Duration timeout)
      Sets timeout for building the image.
    • asJobManager

      public FlinkImageBuilder asJobManager()
      Use this image for building a JobManager.
    • asTaskManager

      public FlinkImageBuilder asTaskManager()
      Use this image for building a TaskManager.
    • useCustomStartupCommand

      public FlinkImageBuilder useCustomStartupCommand(String command)
      Use a custom command for starting up the container.
    • setBaseImage

      public FlinkImageBuilder setBaseImage(String baseImage)
      Sets base image.
      Parameters:
      baseImage - The base image.
      Returns:
      A reference to this Builder.
    • build

      public org.testcontainers.images.builder.ImageFromDockerfile build() throws ImageBuildException
      Build the image.
      Throws:
      ImageBuildException