From 7c024edb1bf26ce8fb1a884e9ea862b455878774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez=20Gonzales?= Date: Mon, 21 Oct 2024 19:55:10 -0500 Subject: [PATCH] Declarative R2DBC SPI implementation (#9447) Avoid usage of `com.google.auto.service:auto-service`. --- modules/mariadb/build.gradle | 3 --- .../containers/MariaDBR2DBCDatabaseContainerProvider.java | 2 -- .../org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider | 1 + modules/mssqlserver/build.gradle | 3 --- .../containers/MSSQLR2DBCDatabaseContainerProvider.java | 2 -- .../org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider | 1 + modules/mysql/build.gradle | 3 --- .../containers/MySQLR2DBCDatabaseContainerProvider.java | 2 -- .../org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider | 1 + modules/oracle-free/build.gradle | 3 --- .../oracle/OracleR2DBCDatabaseContainerProvider.java | 2 -- .../org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider | 1 + modules/oracle-xe/build.gradle | 3 --- .../containers/OracleR2DBCDatabaseContainerProvider.java | 2 -- .../org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider | 1 + modules/postgresql/build.gradle | 3 --- .../containers/PostgreSQLR2DBCDatabaseContainerProvider.java | 2 -- .../org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider | 1 + modules/r2dbc/build.gradle | 3 --- .../r2dbc/src/main/java/org/testcontainers/r2dbc/Hidden.java | 2 -- .../META-INF/services/io.r2dbc.spi.ConnectionFactoryProvider | 1 + 21 files changed, 7 insertions(+), 35 deletions(-) create mode 100644 modules/mariadb/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider create mode 100644 modules/mssqlserver/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider create mode 100644 modules/mysql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider create mode 100644 modules/oracle-free/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider create mode 100644 modules/oracle-xe/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider create mode 100644 modules/postgresql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider create mode 100644 modules/r2dbc/src/main/resources/META-INF/services/io.r2dbc.spi.ConnectionFactoryProvider diff --git a/modules/mariadb/build.gradle b/modules/mariadb/build.gradle index fa47370764e..88734091907 100644 --- a/modules/mariadb/build.gradle +++ b/modules/mariadb/build.gradle @@ -1,9 +1,6 @@ description = "Testcontainers :: JDBC :: MariaDB" dependencies { - annotationProcessor 'com.google.auto.service:auto-service:1.1.1' - compileOnly 'com.google.auto.service:auto-service:1.1.1' - api project(':jdbc') compileOnly project(':r2dbc') diff --git a/modules/mariadb/src/main/java/org/testcontainers/containers/MariaDBR2DBCDatabaseContainerProvider.java b/modules/mariadb/src/main/java/org/testcontainers/containers/MariaDBR2DBCDatabaseContainerProvider.java index 6994ab44dff..34635ac239f 100644 --- a/modules/mariadb/src/main/java/org/testcontainers/containers/MariaDBR2DBCDatabaseContainerProvider.java +++ b/modules/mariadb/src/main/java/org/testcontainers/containers/MariaDBR2DBCDatabaseContainerProvider.java @@ -1,6 +1,5 @@ package org.testcontainers.containers; -import com.google.auto.service.AutoService; import io.r2dbc.spi.ConnectionFactoryMetadata; import io.r2dbc.spi.ConnectionFactoryOptions; import org.mariadb.r2dbc.MariadbConnectionFactoryProvider; @@ -9,7 +8,6 @@ import javax.annotation.Nullable; -@AutoService(R2DBCDatabaseContainerProvider.class) public class MariaDBR2DBCDatabaseContainerProvider implements R2DBCDatabaseContainerProvider { static final String DRIVER = MariadbConnectionFactoryProvider.MARIADB_DRIVER; diff --git a/modules/mariadb/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider b/modules/mariadb/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider new file mode 100644 index 00000000000..0c312685de9 --- /dev/null +++ b/modules/mariadb/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider @@ -0,0 +1 @@ +org.testcontainers.containers.MariaDBR2DBCDatabaseContainerProvider diff --git a/modules/mssqlserver/build.gradle b/modules/mssqlserver/build.gradle index 257d8954709..e7541434291 100644 --- a/modules/mssqlserver/build.gradle +++ b/modules/mssqlserver/build.gradle @@ -1,9 +1,6 @@ description = "Testcontainers :: MS SQL Server" dependencies { - annotationProcessor 'com.google.auto.service:auto-service:1.1.1' - compileOnly 'com.google.auto.service:auto-service:1.1.1' - api project(':jdbc') compileOnly project(':r2dbc') diff --git a/modules/mssqlserver/src/main/java/org/testcontainers/containers/MSSQLR2DBCDatabaseContainerProvider.java b/modules/mssqlserver/src/main/java/org/testcontainers/containers/MSSQLR2DBCDatabaseContainerProvider.java index fe7ada669bd..f829ddb8f1f 100644 --- a/modules/mssqlserver/src/main/java/org/testcontainers/containers/MSSQLR2DBCDatabaseContainerProvider.java +++ b/modules/mssqlserver/src/main/java/org/testcontainers/containers/MSSQLR2DBCDatabaseContainerProvider.java @@ -1,6 +1,5 @@ package org.testcontainers.containers; -import com.google.auto.service.AutoService; import io.r2dbc.mssql.MssqlConnectionFactoryProvider; import io.r2dbc.spi.ConnectionFactoryMetadata; import io.r2dbc.spi.ConnectionFactoryOptions; @@ -9,7 +8,6 @@ import javax.annotation.Nullable; -@AutoService(R2DBCDatabaseContainerProvider.class) public class MSSQLR2DBCDatabaseContainerProvider implements R2DBCDatabaseContainerProvider { static final String DRIVER = MssqlConnectionFactoryProvider.MSSQL_DRIVER; diff --git a/modules/mssqlserver/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider b/modules/mssqlserver/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider new file mode 100644 index 00000000000..0ec6b22ddf6 --- /dev/null +++ b/modules/mssqlserver/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider @@ -0,0 +1 @@ +org.testcontainers.containers.MSSQLR2DBCDatabaseContainerProvider diff --git a/modules/mysql/build.gradle b/modules/mysql/build.gradle index beef298197d..d31fbcce266 100644 --- a/modules/mysql/build.gradle +++ b/modules/mysql/build.gradle @@ -1,9 +1,6 @@ description = "Testcontainers :: JDBC :: MySQL" dependencies { - annotationProcessor 'com.google.auto.service:auto-service:1.1.1' - compileOnly 'com.google.auto.service:auto-service:1.1.1' - api project(':jdbc') compileOnly project(':r2dbc') diff --git a/modules/mysql/src/main/java/org/testcontainers/containers/MySQLR2DBCDatabaseContainerProvider.java b/modules/mysql/src/main/java/org/testcontainers/containers/MySQLR2DBCDatabaseContainerProvider.java index bf74e8ec27a..97f7f4a243d 100644 --- a/modules/mysql/src/main/java/org/testcontainers/containers/MySQLR2DBCDatabaseContainerProvider.java +++ b/modules/mysql/src/main/java/org/testcontainers/containers/MySQLR2DBCDatabaseContainerProvider.java @@ -1,6 +1,5 @@ package org.testcontainers.containers; -import com.google.auto.service.AutoService; import io.asyncer.r2dbc.mysql.MySqlConnectionFactoryProvider; import io.r2dbc.spi.ConnectionFactoryMetadata; import io.r2dbc.spi.ConnectionFactoryOptions; @@ -9,7 +8,6 @@ import javax.annotation.Nullable; -@AutoService(R2DBCDatabaseContainerProvider.class) public class MySQLR2DBCDatabaseContainerProvider implements R2DBCDatabaseContainerProvider { static final String DRIVER = MySqlConnectionFactoryProvider.MYSQL_DRIVER; diff --git a/modules/mysql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider b/modules/mysql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider new file mode 100644 index 00000000000..88cab78dc2e --- /dev/null +++ b/modules/mysql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider @@ -0,0 +1 @@ +org.testcontainers.containers.MySQLR2DBCDatabaseContainerProvider diff --git a/modules/oracle-free/build.gradle b/modules/oracle-free/build.gradle index 2765c99fd92..9f1cebf0132 100644 --- a/modules/oracle-free/build.gradle +++ b/modules/oracle-free/build.gradle @@ -1,9 +1,6 @@ description = "Testcontainers :: JDBC :: Oracle Database Free" dependencies { - annotationProcessor 'com.google.auto.service:auto-service:1.1.1' - compileOnly 'com.google.auto.service:auto-service:1.1.1' - api project(':jdbc') compileOnly project(':r2dbc') diff --git a/modules/oracle-free/src/main/java/org/testcontainers/oracle/OracleR2DBCDatabaseContainerProvider.java b/modules/oracle-free/src/main/java/org/testcontainers/oracle/OracleR2DBCDatabaseContainerProvider.java index 6fe809aa214..d8fe1ee7084 100644 --- a/modules/oracle-free/src/main/java/org/testcontainers/oracle/OracleR2DBCDatabaseContainerProvider.java +++ b/modules/oracle-free/src/main/java/org/testcontainers/oracle/OracleR2DBCDatabaseContainerProvider.java @@ -1,13 +1,11 @@ package org.testcontainers.oracle; -import com.google.auto.service.AutoService; import io.r2dbc.spi.ConnectionFactoryMetadata; import io.r2dbc.spi.ConnectionFactoryOptions; import org.jetbrains.annotations.Nullable; import org.testcontainers.r2dbc.R2DBCDatabaseContainer; import org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider; -@AutoService(R2DBCDatabaseContainerProvider.class) public class OracleR2DBCDatabaseContainerProvider implements R2DBCDatabaseContainerProvider { static final String DRIVER = "oracle"; diff --git a/modules/oracle-free/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider b/modules/oracle-free/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider new file mode 100644 index 00000000000..20465a3e57b --- /dev/null +++ b/modules/oracle-free/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider @@ -0,0 +1 @@ +org.testcontainers.oracle.OracleR2DBCDatabaseContainerProvider diff --git a/modules/oracle-xe/build.gradle b/modules/oracle-xe/build.gradle index d3caec05e86..43506725f82 100644 --- a/modules/oracle-xe/build.gradle +++ b/modules/oracle-xe/build.gradle @@ -1,9 +1,6 @@ description = "Testcontainers :: JDBC :: Oracle XE" dependencies { - annotationProcessor 'com.google.auto.service:auto-service:1.1.1' - compileOnly 'com.google.auto.service:auto-service:1.1.1' - api project(':jdbc') compileOnly project(':r2dbc') diff --git a/modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleR2DBCDatabaseContainerProvider.java b/modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleR2DBCDatabaseContainerProvider.java index 4d6a03530c2..35a98fda77d 100644 --- a/modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleR2DBCDatabaseContainerProvider.java +++ b/modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleR2DBCDatabaseContainerProvider.java @@ -1,13 +1,11 @@ package org.testcontainers.containers; -import com.google.auto.service.AutoService; import io.r2dbc.spi.ConnectionFactoryMetadata; import io.r2dbc.spi.ConnectionFactoryOptions; import org.jetbrains.annotations.Nullable; import org.testcontainers.r2dbc.R2DBCDatabaseContainer; import org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider; -@AutoService(R2DBCDatabaseContainerProvider.class) public class OracleR2DBCDatabaseContainerProvider implements R2DBCDatabaseContainerProvider { static final String DRIVER = "oracle"; diff --git a/modules/oracle-xe/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider b/modules/oracle-xe/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider new file mode 100644 index 00000000000..cd1df0b4488 --- /dev/null +++ b/modules/oracle-xe/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider @@ -0,0 +1 @@ +org.testcontainers.containers.OracleR2DBCDatabaseContainerProvider diff --git a/modules/postgresql/build.gradle b/modules/postgresql/build.gradle index 834656a3dac..23ad800186b 100644 --- a/modules/postgresql/build.gradle +++ b/modules/postgresql/build.gradle @@ -1,9 +1,6 @@ description = "Testcontainers :: JDBC :: PostgreSQL" dependencies { - annotationProcessor 'com.google.auto.service:auto-service:1.1.1' - compileOnly 'com.google.auto.service:auto-service:1.1.1' - api project(':jdbc') compileOnly project(':r2dbc') diff --git a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLR2DBCDatabaseContainerProvider.java b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLR2DBCDatabaseContainerProvider.java index 6b4a81c5e40..f1bdf67ee5c 100644 --- a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLR2DBCDatabaseContainerProvider.java +++ b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLR2DBCDatabaseContainerProvider.java @@ -1,6 +1,5 @@ package org.testcontainers.containers; -import com.google.auto.service.AutoService; import io.r2dbc.postgresql.PostgresqlConnectionFactoryProvider; import io.r2dbc.spi.ConnectionFactoryMetadata; import io.r2dbc.spi.ConnectionFactoryOptions; @@ -9,7 +8,6 @@ import javax.annotation.Nullable; -@AutoService(R2DBCDatabaseContainerProvider.class) public final class PostgreSQLR2DBCDatabaseContainerProvider implements R2DBCDatabaseContainerProvider { static final String DRIVER = PostgresqlConnectionFactoryProvider.POSTGRESQL_DRIVER; diff --git a/modules/postgresql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider b/modules/postgresql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider new file mode 100644 index 00000000000..6224c0e6093 --- /dev/null +++ b/modules/postgresql/src/main/resources/META-INF/services/org.testcontainers.r2dbc.R2DBCDatabaseContainerProvider @@ -0,0 +1 @@ +org.testcontainers.containers.PostgreSQLR2DBCDatabaseContainerProvider diff --git a/modules/r2dbc/build.gradle b/modules/r2dbc/build.gradle index a440af1dc97..1415df161fa 100644 --- a/modules/r2dbc/build.gradle +++ b/modules/r2dbc/build.gradle @@ -5,9 +5,6 @@ plugins { description = "Testcontainers :: R2DBC" dependencies { - annotationProcessor 'com.google.auto.service:auto-service:1.1.1' - compileOnly 'com.google.auto.service:auto-service:1.1.1' - api project(':testcontainers') api 'io.r2dbc:r2dbc-spi:0.9.0.RELEASE' diff --git a/modules/r2dbc/src/main/java/org/testcontainers/r2dbc/Hidden.java b/modules/r2dbc/src/main/java/org/testcontainers/r2dbc/Hidden.java index 5d9de2025a0..327ad6ab9ca 100644 --- a/modules/r2dbc/src/main/java/org/testcontainers/r2dbc/Hidden.java +++ b/modules/r2dbc/src/main/java/org/testcontainers/r2dbc/Hidden.java @@ -1,6 +1,5 @@ package org.testcontainers.r2dbc; -import com.google.auto.service.AutoService; import io.r2dbc.spi.ConnectionFactory; import io.r2dbc.spi.ConnectionFactoryOptions; import io.r2dbc.spi.ConnectionFactoryProvider; @@ -10,7 +9,6 @@ */ class Hidden { - @AutoService(ConnectionFactoryProvider.class) public static final class TestcontainersR2DBCConnectionFactoryProvider implements ConnectionFactoryProvider { public static final String DRIVER = "tc"; diff --git a/modules/r2dbc/src/main/resources/META-INF/services/io.r2dbc.spi.ConnectionFactoryProvider b/modules/r2dbc/src/main/resources/META-INF/services/io.r2dbc.spi.ConnectionFactoryProvider new file mode 100644 index 00000000000..23f1702c57a --- /dev/null +++ b/modules/r2dbc/src/main/resources/META-INF/services/io.r2dbc.spi.ConnectionFactoryProvider @@ -0,0 +1 @@ +org.testcontainers.r2dbc.Hidden$TestcontainersR2DBCConnectionFactoryProvider