use of org.testcontainers.utility.DockerImageName in project drill by apache.
the class TestJdbcPluginWithPostgres method initPostgres.
@BeforeClass
public static void initPostgres() throws Exception {
startCluster(ClusterFixture.builder(dirTestWatcher));
String postgresDBName = "drill_postgres_test";
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
DockerImageName imageName = DockerImageName.parse(DOCKER_IMAGE_POSTGRES_X86);
jdbcContainer = new PostgreSQLContainer<>(imageName).withUsername("postgres").withPassword("password").withDatabaseName(postgresDBName).withInitScript("postgres-test-data.sql");
jdbcContainer.start();
JdbcStorageConfig jdbcStorageConfig = new JdbcStorageConfig("org.postgresql.Driver", jdbcContainer.getJdbcUrl(), jdbcContainer.getUsername(), jdbcContainer.getPassword(), true, false, null, null, 100000);
jdbcStorageConfig.setEnabled(true);
cluster.defineStoragePlugin("pg", jdbcStorageConfig);
}
use of org.testcontainers.utility.DockerImageName in project drill by apache.
the class TestJdbcWriterWithMySQL method initMysql.
@BeforeClass
public static void initMysql() throws Exception {
startCluster(ClusterFixture.builder(dirTestWatcher));
dirTestWatcher.copyResourceToRoot(Paths.get(""));
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
String osName = System.getProperty("os.name").toLowerCase();
String mysqlDBName = "drill_mysql_test";
DockerImageName imageName;
if (osName.startsWith("linux") && "aarch64".equals(System.getProperty("os.arch"))) {
imageName = DockerImageName.parse(DOCKER_IMAGE_MARIADB).asCompatibleSubstituteFor("mysql");
} else {
imageName = DockerImageName.parse(DOCKER_IMAGE_MYSQL);
}
jdbcContainer = new MySQLContainer<>(imageName).withExposedPorts(3306).withConfigurationOverride("mysql_config_override").withUsername("mysqlUser").withPassword("mysqlPass").withDatabaseName(mysqlDBName).withUrlParam("serverTimezone", "UTC").withUrlParam("useJDBCCompliantTimezoneShift", "true").withInitScript("mysql-test-data.sql");
jdbcContainer.start();
if (osName.startsWith("linux")) {
JdbcDatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(jdbcContainer, "");
ScriptUtils.runInitScript(databaseDelegate, "mysql-test-data-linux.sql");
}
String jdbcUrl = jdbcContainer.getJdbcUrl();
logger.debug("JDBC URL: {}", jdbcUrl);
JdbcStorageConfig jdbcStorageConfig = new JdbcStorageConfig("com.mysql.cj.jdbc.Driver", jdbcUrl, jdbcContainer.getUsername(), jdbcContainer.getPassword(), false, true, null, null, 10000);
jdbcStorageConfig.setEnabled(true);
cluster.defineStoragePlugin("mysql", jdbcStorageConfig);
JdbcStorageConfig jdbcStorageConfigNoWrite = new JdbcStorageConfig("com.mysql.cj.jdbc.Driver", jdbcUrl, jdbcContainer.getUsername(), jdbcContainer.getPassword(), false, false, null, null, 10000);
jdbcStorageConfigNoWrite.setEnabled(true);
cluster.defineStoragePlugin("mysql_no_write", jdbcStorageConfigNoWrite);
if (osName.startsWith("linux")) {
// adds storage plugin with case insensitive table names
JdbcStorageConfig jdbcCaseSensitiveStorageConfig = new JdbcStorageConfig("com.mysql.cj.jdbc.Driver", jdbcUrl, jdbcContainer.getUsername(), jdbcContainer.getPassword(), true, true, null, null, 10000);
jdbcCaseSensitiveStorageConfig.setEnabled(true);
cluster.defineStoragePlugin("mysqlCaseInsensitive", jdbcCaseSensitiveStorageConfig);
}
}
use of org.testcontainers.utility.DockerImageName in project drill by apache.
the class TestJdbcWriterWithPostgres method initPostgres.
@BeforeClass
public static void initPostgres() throws Exception {
startCluster(ClusterFixture.builder(dirTestWatcher));
dirTestWatcher.copyResourceToRoot(Paths.get(""));
String postgresDBName = "drill_postgres_test";
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
DockerImageName imageName = DockerImageName.parse(DOCKER_IMAGE_POSTGRES_X86);
jdbcContainer = new PostgreSQLContainer<>(imageName).withUsername("postgres").withPassword("password").withDatabaseName(postgresDBName).withInitScript("postgres-test-data.sql");
jdbcContainer.start();
JdbcStorageConfig jdbcStorageConfig = new JdbcStorageConfig("org.postgresql.Driver", jdbcContainer.getJdbcUrl(), jdbcContainer.getUsername(), jdbcContainer.getPassword(), true, true, null, null, 10000);
jdbcStorageConfig.setEnabled(true);
cluster.defineStoragePlugin("pg", jdbcStorageConfig);
JdbcStorageConfig unWritableJdbcStorageConfig = new JdbcStorageConfig("org.postgresql.Driver", jdbcContainer.getJdbcUrl(), jdbcContainer.getUsername(), jdbcContainer.getPassword(), true, false, null, null, 10000);
unWritableJdbcStorageConfig.setEnabled(true);
cluster.defineStoragePlugin("pg_unwritable", unWritableJdbcStorageConfig);
}
use of org.testcontainers.utility.DockerImageName in project cayenne by apache.
the class TestContainerProvider method startContainer.
public JdbcDatabaseContainer<?> startContainer(String version) {
DockerImageName dockerImageName = DockerImageName.parse(getDockerImage());
if (version != null) {
dockerImageName = dockerImageName.withTag(version);
}
JdbcDatabaseContainer<?> container = createContainer(dockerImageName);
container.start();
return container;
}
use of org.testcontainers.utility.DockerImageName in project drill by apache.
the class TestJdbcPluginWithClickhouse method initClickhouse.
@BeforeClass
public static void initClickhouse() throws Exception {
startCluster(ClusterFixture.builder(dirTestWatcher));
String osName = System.getProperty("os.name").toLowerCase();
DockerImageName imageName;
if (osName.startsWith("linux") && "aarch64".equals(System.getProperty("os.arch"))) {
imageName = DockerImageName.parse(DOCKER_IMAGE_CLICKHOUSE_ARM).asCompatibleSubstituteFor("yandex/clickhouse-server");
} else {
imageName = DockerImageName.parse(DOCKER_IMAGE_CLICKHOUSE_X86);
}
jdbcContainer = new ClickHouseContainer(imageName).withInitScript("clickhouse-test-data.sql");
jdbcContainer.start();
JdbcStorageConfig jdbcStorageConfig = new JdbcStorageConfig("ru.yandex.clickhouse.ClickHouseDriver", jdbcContainer.getJdbcUrl(), jdbcContainer.getUsername(), null, true, false, null, null, 0);
jdbcStorageConfig.setEnabled(true);
cluster.defineStoragePlugin("clickhouse", jdbcStorageConfig);
}
Aggregations