org.testcontainers.containers.TimescaleDBContainerProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of postgresql Show documentation
Show all versions of postgresql Show documentation
Isolated container management for Java code testing
package org.testcontainers.containers;
import org.testcontainers.jdbc.ConnectionUrl;
import org.testcontainers.utility.DockerImageName;
/**
* Factory for TimescaleDB containers, which are a special flavour of PostgreSQL.
*
* @see https://docs.timescale.com/latest/introduction
*/
public class TimescaleDBContainerProvider extends JdbcDatabaseContainerProvider {
private static final String NAME = "timescaledb";
private static final String DEFAULT_TAG = "2.1.0-pg11";
private static final DockerImageName DEFAULT_IMAGE = DockerImageName
.parse("timescale/timescaledb")
.asCompatibleSubstituteFor("postgres");
public static final String USER_PARAM = "user";
public static final String PASSWORD_PARAM = "password";
@Override
public boolean supports(String databaseType) {
return databaseType.equals(NAME);
}
@Override
public JdbcDatabaseContainer newInstance() {
return newInstance(DEFAULT_TAG);
}
@Override
public JdbcDatabaseContainer newInstance(String tag) {
return new PostgreSQLContainer(DEFAULT_IMAGE.withTag(tag));
}
@Override
public JdbcDatabaseContainer newInstance(ConnectionUrl connectionUrl) {
return newInstanceFromConnectionUrl(connectionUrl, USER_PARAM, PASSWORD_PARAM);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy