diff --git a/pom.xml b/pom.xml index 4bb3a9b983ac7..424dadf78c2d0 100644 --- a/pom.xml +++ b/pom.xml @@ -71,7 +71,7 @@ 2.3.1 4.0.6 0.14.0 - 1.20.5 + 2.0.3 3.4.1 2.9.0 3.1.3 diff --git a/presto-clickhouse/pom.xml b/presto-clickhouse/pom.xml index f6ece72d07bd9..b143e209efa5c 100644 --- a/presto-clickhouse/pom.xml +++ b/presto-clickhouse/pom.xml @@ -196,13 +196,13 @@ org.testcontainers - clickhouse + testcontainers-clickhouse test org.testcontainers - jdbc + testcontainers-jdbc test diff --git a/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/ClickHouseQueryRunner.java b/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/ClickHouseQueryRunner.java index a0519c2f6855b..1f5847ba8efdc 100755 --- a/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/ClickHouseQueryRunner.java +++ b/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/ClickHouseQueryRunner.java @@ -60,6 +60,8 @@ public static DistributedQueryRunner createClickHouseQueryRunner( connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties)); connectorProperties.putIfAbsent("clickhouse.connection-url", server.getJdbcUrl()); + connectorProperties.putIfAbsent("clickhouse.connection-user", server.getClickHouseContainer().getUsername()); + connectorProperties.putIfAbsent("clickhouse.connection-password", server.getClickHouseContainer().getPassword()); connectorProperties.putIfAbsent("clickhouse.allow-drop-table", String.valueOf(true)); connectorProperties.putIfAbsent("clickhouse.map-string-as-varchar", String.valueOf(true)); diff --git a/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/TestingClickHouseServer.java b/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/TestingClickHouseServer.java index 87dbb916f1179..1a1c80c312782 100755 --- a/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/TestingClickHouseServer.java +++ b/presto-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/TestingClickHouseServer.java @@ -13,16 +13,13 @@ */ package com.facebook.presto.plugin.clickhouse; -import org.testcontainers.containers.ClickHouseContainer; +import org.testcontainers.clickhouse.ClickHouseContainer; import java.io.Closeable; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; -import static java.lang.String.format; -import static org.testcontainers.containers.ClickHouseContainer.HTTP_PORT; - public class TestingClickHouseServer implements Closeable { @@ -44,7 +41,10 @@ public ClickHouseContainer getClickHouseContainer() } public void execute(String sql) { - try (Connection connection = DriverManager.getConnection(getJdbcUrl()); + try (Connection connection = DriverManager.getConnection( + getJdbcUrl(), + dockerContainer.getUsername(), + dockerContainer.getPassword()); Statement statement = connection.createStatement()) { statement.execute(sql); } @@ -55,10 +55,7 @@ public void execute(String sql) public String getJdbcUrl() { - String s = format("jdbc:clickhouse://%s:%s/", dockerContainer.getContainerIpAddress(), - dockerContainer.getMappedPort(HTTP_PORT)); - return format("jdbc:clickhouse://%s:%s/", dockerContainer.getContainerIpAddress(), - dockerContainer.getMappedPort(HTTP_PORT)); + return dockerContainer.getJdbcUrl(); } @Override diff --git a/presto-elasticsearch/pom.xml b/presto-elasticsearch/pom.xml index 3f12d301702bd..b5ec354e6d18a 100644 --- a/presto-elasticsearch/pom.xml +++ b/presto-elasticsearch/pom.xml @@ -247,7 +247,7 @@ org.testcontainers - elasticsearch + testcontainers-elasticsearch test diff --git a/presto-main/pom.xml b/presto-main/pom.xml index 7c65fc1e81e85..e240226195fa3 100644 --- a/presto-main/pom.xml +++ b/presto-main/pom.xml @@ -472,10 +472,10 @@ org.testcontainers - postgresql + testcontainers-postgresql test - + com.github.luben zstd-jni diff --git a/presto-main/src/test/java/com/facebook/presto/server/security/oauth2/TestingHydraIdentityProvider.java b/presto-main/src/test/java/com/facebook/presto/server/security/oauth2/TestingHydraIdentityProvider.java index 0daa570a29842..9c7c39cfeb149 100644 --- a/presto-main/src/test/java/com/facebook/presto/server/security/oauth2/TestingHydraIdentityProvider.java +++ b/presto-main/src/test/java/com/facebook/presto/server/security/oauth2/TestingHydraIdentityProvider.java @@ -44,10 +44,10 @@ import org.testcontainers.containers.FixedHostPortGenericContainer; import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.Network; -import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.containers.wait.strategy.WaitAllStrategy; +import org.testcontainers.postgresql.PostgreSQLContainer; import org.testcontainers.utility.MountableFile; import java.io.Closeable; @@ -75,7 +75,7 @@ public class TestingHydraIdentityProvider private final Network network = Network.newNetwork(); - private final PostgreSQLContainer databaseContainer = new PostgreSQLContainer<>() + private final PostgreSQLContainer databaseContainer = new PostgreSQLContainer("postgres:14") .withNetwork(network) .withNetworkAliases("database") .withUsername("hydra") diff --git a/presto-mysql/pom.xml b/presto-mysql/pom.xml index 7de5616087742..364df14a756e9 100644 --- a/presto-mysql/pom.xml +++ b/presto-mysql/pom.xml @@ -166,7 +166,7 @@ org.testcontainers - mysql + testcontainers-mysql test diff --git a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestCredentialPassthrough.java b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestCredentialPassthrough.java index 1c42cb88d3913..364d21e588ea3 100644 --- a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestCredentialPassthrough.java +++ b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestCredentialPassthrough.java @@ -18,7 +18,7 @@ import com.facebook.presto.testing.QueryRunner; import com.facebook.presto.tests.DistributedQueryRunner; import com.google.common.collect.ImmutableMap; -import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.mysql.MySQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -40,13 +40,13 @@ public class TestCredentialPassthrough private static final String TEST_USER = "testuser"; private static final String TEST_PASSWORD = "testpass"; - private final MySQLContainer mysqlContainer; + private final MySQLContainer mysqlContainer; private final QueryRunner mySqlQueryRunner; public TestCredentialPassthrough() throws Exception { - mysqlContainer = new MySQLContainer<>("mysql:8.0") + mysqlContainer = new MySQLContainer("mysql:8.0") .withDatabaseName(TEST_SCHEMA) .withUsername(TEST_USER) .withPassword(TEST_PASSWORD); @@ -77,7 +77,7 @@ public void testCredentialPassthrough() mySqlQueryRunner.execute(getSession(mysqlContainer), "CREATE TABLE test_create (a bigint, b double, c varchar)"); } - public static QueryRunner createQueryRunner(MySQLContainer mysqlContainer) + public static QueryRunner createQueryRunner(MySQLContainer mysqlContainer) throws Exception { DistributedQueryRunner queryRunner = null; @@ -99,7 +99,7 @@ public static QueryRunner createQueryRunner(MySQLContainer mysqlContainer) } } - private static Session getSession(MySQLContainer mysqlContainer) + private static Session getSession(MySQLContainer mysqlContainer) { Map extraCredentials = ImmutableMap.of("mysql.user", mysqlContainer.getUsername(), "mysql.password", mysqlContainer.getPassword()); return testSessionBuilder() @@ -116,7 +116,7 @@ private static Session getSession(MySQLContainer mysqlContainer) .build(); } - private static String getConnectionUrl(MySQLContainer mysqlContainer) + private static String getConnectionUrl(MySQLContainer mysqlContainer) { String jdbcUrlWithoutDatabase = removeDatabaseFromJdbcUrl(mysqlContainer.getJdbcUrl()); return format("%s?useSSL=false&allowPublicKeyRetrieval=true", jdbcUrlWithoutDatabase.split("\\?")[0]); diff --git a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlDistributedQueries.java b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlDistributedQueries.java index 9cec5920c9be1..1d2470e1b2135 100644 --- a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlDistributedQueries.java +++ b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlDistributedQueries.java @@ -18,7 +18,7 @@ import com.facebook.presto.tests.AbstractTestDistributedQueries; import com.google.common.collect.ImmutableMap; import io.airlift.tpch.TpchTable; -import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.mysql.MySQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Optional; import org.testng.annotations.Test; @@ -33,11 +33,11 @@ public class TestMySqlDistributedQueries extends AbstractTestDistributedQueries { - private final MySQLContainer mysqlContainer; + private final MySQLContainer mysqlContainer; public TestMySqlDistributedQueries() { - this.mysqlContainer = new MySQLContainer<>("mysql:8.0") + this.mysqlContainer = new MySQLContainer("mysql:8.0") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationMixedCaseTest.java b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationMixedCaseTest.java index 26f8d6f277e99..0a56bf282ddba 100644 --- a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationMixedCaseTest.java +++ b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationMixedCaseTest.java @@ -19,7 +19,7 @@ import com.facebook.presto.tests.AbstractTestQueryFramework; import com.google.common.collect.ImmutableMap; import io.airlift.tpch.TpchTable; -import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.mysql.MySQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -40,12 +40,12 @@ public class TestMySqlIntegrationMixedCaseTest extends AbstractTestQueryFramework { - private final MySQLContainer mysqlContainer; + private final MySQLContainer mysqlContainer; public TestMySqlIntegrationMixedCaseTest() throws Exception { - this.mysqlContainer = new MySQLContainer<>("mysql:8.0") + this.mysqlContainer = new MySQLContainer("mysql:8.0") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationSmokeTest.java b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationSmokeTest.java index ec32ea5594b30..4a3de5895fdf0 100644 --- a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationSmokeTest.java +++ b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlIntegrationSmokeTest.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.intellij.lang.annotations.Language; -import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.mysql.MySQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -48,12 +48,12 @@ public class TestMySqlIntegrationSmokeTest extends AbstractTestIntegrationSmokeTest { - private final MySQLContainer mysqlContainer; + private final MySQLContainer mysqlContainer; public TestMySqlIntegrationSmokeTest() throws Exception { - this.mysqlContainer = new MySQLContainer<>("mysql:8.0") + this.mysqlContainer = new MySQLContainer("mysql:8.0") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlTypeMapping.java b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlTypeMapping.java index 9adc4bfe1169f..5541156aa874a 100644 --- a/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlTypeMapping.java +++ b/presto-mysql/src/test/java/com/facebook/presto/plugin/mysql/TestMySqlTypeMapping.java @@ -26,7 +26,7 @@ import com.facebook.presto.tests.sql.PrestoSqlExecutor; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.mysql.MySQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -66,11 +66,11 @@ public class TestMySqlTypeMapping { private static final String CHARACTER_SET_UTF8 = "CHARACTER SET utf8"; - private final MySQLContainer mysqlContainer; + private final MySQLContainer mysqlContainer; public TestMySqlTypeMapping() { - this.mysqlContainer = new MySQLContainer<>("mysql:8.0") + this.mysqlContainer = new MySQLContainer("mysql:8.0") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-postgresql/pom.xml b/presto-postgresql/pom.xml index 45940a4f9ae65..128891cbdfd42 100644 --- a/presto-postgresql/pom.xml +++ b/presto-postgresql/pom.xml @@ -175,7 +175,7 @@ org.testcontainers - postgresql + testcontainers-postgresql test diff --git a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/PostgreSqlQueryRunner.java b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/PostgreSqlQueryRunner.java index 4e33184bd8b61..66e08547b005b 100644 --- a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/PostgreSqlQueryRunner.java +++ b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/PostgreSqlQueryRunner.java @@ -19,7 +19,7 @@ import com.facebook.presto.tpch.TpchPlugin; import com.google.common.collect.ImmutableMap; import io.airlift.tpch.TpchTable; -import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.postgresql.PostgreSQLContainer; import java.sql.Connection; import java.sql.DriverManager; @@ -93,7 +93,7 @@ private static void createSchema(String url, String schema, String username, Str } } - public static Properties createJdbcProperties(PostgreSQLContainer container) + public static Properties createJdbcProperties(PostgreSQLContainer container) { Properties properties = new Properties(); properties.setProperty("user", container.getUsername()); diff --git a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseInsensitiveMapping.java b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseInsensitiveMapping.java index 31eebf582d999..745abe74a3f22 100644 --- a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseInsensitiveMapping.java +++ b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseInsensitiveMapping.java @@ -18,7 +18,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.postgresql.PostgreSQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -37,11 +37,11 @@ public class TestPostgreSqlCaseInsensitiveMapping extends AbstractTestQueryFramework { - private final PostgreSQLContainer postgresContainer; + private final PostgreSQLContainer postgresContainer; public TestPostgreSqlCaseInsensitiveMapping() { - this.postgresContainer = new PostgreSQLContainer<>("postgres:14") + this.postgresContainer = new PostgreSQLContainer("postgres:14") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseSensitiveMapping.java b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseSensitiveMapping.java index bdceefb6fdba2..a93514aaa18d5 100644 --- a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseSensitiveMapping.java +++ b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlCaseSensitiveMapping.java @@ -17,7 +17,7 @@ import com.facebook.presto.tests.AbstractTestQueryFramework; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.postgresql.PostgreSQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -31,11 +31,11 @@ public class TestPostgreSqlCaseSensitiveMapping extends AbstractTestQueryFramework { - private final PostgreSQLContainer postgresContainer; + private final PostgreSQLContainer postgresContainer; public TestPostgreSqlCaseSensitiveMapping() { - this.postgresContainer = new PostgreSQLContainer<>("postgres:14") + this.postgresContainer = new PostgreSQLContainer("postgres:14") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlDistributedQueries.java b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlDistributedQueries.java index 215944f1a94be..127acf3d0fa80 100644 --- a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlDistributedQueries.java +++ b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlDistributedQueries.java @@ -17,7 +17,7 @@ import com.facebook.presto.tests.AbstractTestDistributedQueries; import com.google.common.collect.ImmutableMap; import io.airlift.tpch.TpchTable; -import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.postgresql.PostgreSQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -27,11 +27,11 @@ public class TestPostgreSqlDistributedQueries extends AbstractTestDistributedQueries { - private final PostgreSQLContainer postgresContainer; + private PostgreSQLContainer postgresContainer; public TestPostgreSqlDistributedQueries() { - this.postgresContainer = new PostgreSQLContainer<>("postgres:14") + this.postgresContainer = new PostgreSQLContainer("postgres:14") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlIntegrationSmokeTest.java b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlIntegrationSmokeTest.java index 5d33801ab9492..39e4a24ed58da 100644 --- a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlIntegrationSmokeTest.java +++ b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlIntegrationSmokeTest.java @@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.intellij.lang.annotations.Language; -import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.postgresql.PostgreSQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -42,11 +42,11 @@ public class TestPostgreSqlIntegrationSmokeTest extends AbstractTestIntegrationSmokeTest { - private final PostgreSQLContainer postgresContainer; + private PostgreSQLContainer postgresContainer; public TestPostgreSqlIntegrationSmokeTest() { - this.postgresContainer = new PostgreSQLContainer<>("postgres:14") + this.postgresContainer = new PostgreSQLContainer("postgres:14") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlTypeMapping.java b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlTypeMapping.java index f5c901c745699..21a9999e8d242 100644 --- a/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlTypeMapping.java +++ b/presto-postgresql/src/test/java/com/facebook/presto/plugin/postgresql/TestPostgreSqlTypeMapping.java @@ -26,7 +26,7 @@ import com.facebook.presto.tests.sql.PrestoSqlExecutor; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.postgresql.PostgreSQLContainer; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -70,12 +70,12 @@ public class TestPostgreSqlTypeMapping extends AbstractTestQueryFramework { - private final PostgreSQLContainer postgresContainer; + private final PostgreSQLContainer postgresContainer; public TestPostgreSqlTypeMapping() throws Exception { - this.postgresContainer = new PostgreSQLContainer<>("postgres:14") + this.postgresContainer = new PostgreSQLContainer("postgres:14") .withDatabaseName("tpch") .withUsername("testuser") .withPassword("testpass"); diff --git a/presto-singlestore/pom.xml b/presto-singlestore/pom.xml index a99c620ec2d04..4f1f017b9e164 100644 --- a/presto-singlestore/pom.xml +++ b/presto-singlestore/pom.xml @@ -107,7 +107,7 @@ org.testcontainers - jdbc + testcontainers-jdbc test