Skip to content

External Integration Tests

Jin Kwon edited this page Jul 7, 2026 · 6 revisions

External Integration Tests

External integration tests run ExternalIT against a database reachable through an ordinary JDBC URL. They are intended for users and contributors who want to check this library against a real server/driver pair outside the in-memory test suite.

What ExternalIT Does

AbstractExternalIT currently exercises selected top-level metadata methods:

Test method Metadata call Artifacts
catalogs() Context.getCatalogs() target/{prefix}-catalogs.xml, target/{prefix}-catalogs.json
schemas() Context.getSchemas() or Context.getSchemas(catalog, null) target/{prefix}-schemas.xml, target/{prefix}-schemas.json
tables() Context.getTables(catalog, null, "%", null) target/{prefix}-tables.xml, target/{prefix}-tables.json

The filename prefix is derived from database product/version and JDBC driver name/version. Avoid Maven's clean phase when you want to keep previously generated artifacts under target/.

Profiles

External tests are enabled by combining failsafe with one external profile.

Profile Test sources Driver
external-mysql5 src/test/java-external-mysql5 mysql:mysql-connector-java:8.0.33
external-mysql8 src/test/java-external-mysql8 com.mysql:mysql-connector-j:${version.mysql-connector-j}

Each profile provides a concrete ExternalIT class extending the shared abstract external test.

Required System Properties

ExternalIT is enabled only when these properties are non-blank:

Property Meaning
url JDBC URL.
user JDBC user.
password JDBC password.

Optional:

Property Meaning
catalog Catalog/database name used by catalog-scoped metadata calls where supported.

Running Against A MySQL 8 Server

Use the external-mysql8 profile and pass JDBC connection properties.

./mvnw \
  -Pfailsafe,external-mysql8 \
  -Dit.test=ExternalIT \
  -Durl='jdbc:mysql://127.0.0.1:3308/metadata_bind?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC' \
  -Duser='root' \
  -Dpassword='metadata_bind' \
  test-compile failsafe:integration-test

Running Against A MySQL 5 Server

Use the external-mysql5 profile for the legacy MySQL profile.

./mvnw \
  -Pfailsafe,external-mysql5 \
  -Dit.test=ExternalIT \
  -Durl='jdbc:mysql://127.0.0.1:3306/metadata_bind?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC' \
  -Duser='root' \
  -Dpassword='metadata_bind' \
  test-compile failsafe:integration-test

Catalog-Scoped Runs

Pass catalog when you want catalog-scoped metadata calls to use a specific database/catalog.

./mvnw \
  -Pfailsafe,external-mysql8 \
  -Dit.test=ExternalIT \
  -Durl='jdbc:mysql://127.0.0.1:3308/metadata_bind?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC' \
  -Duser='root' \
  -Dpassword='metadata_bind' \
  -Dcatalog='metadata_bind' \
  test-compile failsafe:integration-test

Clone this wiki locally