Class TestcontainersSupport

java.lang.Object
com.xebialabs.xlrelease.TestcontainersSupport

public class TestcontainersSupport extends Object
Manages Testcontainers database lifecycle for integration tests.

A singleton container is started per JVM fork and reused across all integration test classes within that fork. The container is automatically cleaned up when the JVM exits.

Supported databases: postgresql (default), mysql, mysql8, oracle, oracle21, mssql.

Activated by the system property xl.testcontainers.db which is set by the Gradle build via the -Pdb=<name> flag (defaulting to postgresql).

  • Field Details

  • Constructor Details

    • TestcontainersSupport

      public TestcontainersSupport()
  • Method Details

    • initialize

      public static void initialize()
      Initializes the Testcontainers database if the xl.testcontainers.db system property is set. This method is idempotent - it only starts the container once per JVM.

      After the container starts, this method sets the following system properties so that the worker isolation code in XLReleaseIntegrationTest and the Spring context can connect to the containerized database:

      • xl.database.db-driver-classname
      • xl.database.db-url
      • xl.reporting.db-driver-classname
      • xl.reporting.db-url
      • xl.database.adminUser
      • xl.database.adminPassword
      • xl.repository.configuration