Add support for test containers jdbc url

See gh-19044
pull/19159/head
Leo Li 5 years ago committed by Stephane Nicoll
parent 7af7909c42
commit 7b1b18cd77

@ -196,6 +196,18 @@ public enum DatabaseDriver {
return Arrays.asList("informix-sqli", "informix-direct"); return Arrays.asList("informix-sqli", "informix-direct");
} }
},
/**
* Testcontainers.
*/
TESTCONTAINERS(null, "org.testcontainers.jdbc.ContainerDatabaseDriver") {
@Override
protected Collection<String> getUrlPrefixes() {
return Collections.singleton("tc");
}
}; };
private final String productName; private final String productName;

@ -44,9 +44,9 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
class DatabaseDriverClassNameTests { class DatabaseDriverClassNameTests {
private static final Set<DatabaseDriver> EXCLUDED_DRIVERS = Collections private static final Set<DatabaseDriver> EXCLUDED_DRIVERS = Collections.unmodifiableSet(
.unmodifiableSet(EnumSet.of(DatabaseDriver.UNKNOWN, DatabaseDriver.DB2_AS400, DatabaseDriver.INFORMIX, EnumSet.of(DatabaseDriver.UNKNOWN, DatabaseDriver.DB2_AS400, DatabaseDriver.INFORMIX, DatabaseDriver.HANA,
DatabaseDriver.HANA, DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT)); DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT, DatabaseDriver.TESTCONTAINERS));
@ParameterizedTest(name = "{0} {2}") @ParameterizedTest(name = "{0} {2}")
@MethodSource @MethodSource

@ -112,6 +112,8 @@ class DatabaseDriverTests {
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-sqli://localhost:1533/sample")) assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-sqli://localhost:1533/sample"))
.isEqualTo(DatabaseDriver.INFORMIX); .isEqualTo(DatabaseDriver.INFORMIX);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-direct://sample")).isEqualTo(DatabaseDriver.INFORMIX); assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-direct://sample")).isEqualTo(DatabaseDriver.INFORMIX);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:tc:sample://localhost:3306/sample"))
.isEqualTo(DatabaseDriver.TESTCONTAINERS);
} }
} }

Loading…
Cancel
Save