This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 66e003dcdb Migrate to com.mysql:mysql-connector-j for debezium-mysql
66e003dcdb is described below

commit 66e003dcdb5c2cea6a46ec516efc0dfdcf7b17fe
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Tue Aug 6 11:03:33 2024 +0100

    Migrate to com.mysql:mysql-connector-j for debezium-mysql
---
 .../ROOT/pages/reference/extensions/debezium-mysql.adoc      | 12 ++++++------
 extensions/debezium-mysql/deployment/pom.xml                 |  6 ++++++
 extensions/debezium-mysql/runtime/pom.xml                    |  4 ++--
 extensions/debezium-mysql/runtime/src/main/doc/usage.adoc    | 12 ++++++------
 integration-tests/debezium/.gitignore                        |  2 +-
 integration-tests/debezium/README.adoc                       | 11 ++++++-----
 integration-tests/debezium/pom.xml                           |  8 ++++----
 .../debezium/common/it/DebeziumSqlserverResource.java        |  3 ++-
 .../debezium/src/main/resources/application.properties       |  2 ++
 .../common/it/sqlserver/DebeziumSqlserverTestResource.java   |  2 +-
 10 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/docs/modules/ROOT/pages/reference/extensions/debezium-mysql.adoc 
b/docs/modules/ROOT/pages/reference/extensions/debezium-mysql.adoc
index 37dfafdacb..8019b4e9ef 100644
--- a/docs/modules/ROOT/pages/reference/extensions/debezium-mysql.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/debezium-mysql.adoc
@@ -50,18 +50,18 @@ endif::[]
 We cannot add the MySQL JDBC driver as a compile scope dependency of this 
extension because it is GPL2 licensed and it
 would be against the policy of the Apache Software Foundation.
 
-Therefore you have to add the dependency to your project yourself, as long as 
you are able to comply with its license
+Therefore, you have to add the dependency to your project yourself, as long as 
you are able to comply with its license
 terms.
 
-`quarkus-bom` (transitively included by `camel-quarkus-bom` and 
`quarkus-universe-bom`) manages a version
-of `mysql:mysql-connector-java` compatible with Camel Quarkus. So you do not 
need specify the version of the
-driver if you import any of the mentioned BOMs. The following should be 
sufficient for Maven:
+`quarkus-bom` (transitively included by `camel-quarkus-bom` and 
`quarkus-camel-bom`) manages a version
+of `com.mysql:mysql-connector-j` compatible with Camel Quarkus. So you do not 
need specify the version of the
+driver when importing any of the aforementioned BOMs. The following should be 
sufficient for Maven:
 
 [source,xml]
 ----
 <dependency>
-    <groupId>mysql</groupId>
-    <artifactId>mysql-connector-java</artifactId>
+    <groupId>com.mysql</groupId>
+    <artifactId>mysql-connector-j</artifactId>
 </dependency>
 ----
 
diff --git a/extensions/debezium-mysql/deployment/pom.xml 
b/extensions/debezium-mysql/deployment/pom.xml
index 6df177ca66..e950823532 100644
--- a/extensions/debezium-mysql/deployment/pom.xml
+++ b/extensions/debezium-mysql/deployment/pom.xml
@@ -45,6 +45,12 @@
         <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-jdbc-mysql-deployment</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.mysql</groupId>
+                    <artifactId>mysql-connector-j</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
     </dependencies>
 
diff --git a/extensions/debezium-mysql/runtime/pom.xml 
b/extensions/debezium-mysql/runtime/pom.xml
index 030d1fdf75..b96ce7bacc 100644
--- a/extensions/debezium-mysql/runtime/pom.xml
+++ b/extensions/debezium-mysql/runtime/pom.xml
@@ -53,8 +53,8 @@
             <artifactId>quarkus-jdbc-mysql</artifactId>
             <exclusions>
                 <exclusion>
-                    <groupId>mysql</groupId>
-                    <artifactId>mysql-connector-java</artifactId>
+                    <groupId>com.mysql</groupId>
+                    <artifactId>mysql-connector-j</artifactId>
                 </exclusion>
             </exclusions>
         </dependency>
diff --git a/extensions/debezium-mysql/runtime/src/main/doc/usage.adoc 
b/extensions/debezium-mysql/runtime/src/main/doc/usage.adoc
index 1c8adedac5..1a33522361 100644
--- a/extensions/debezium-mysql/runtime/src/main/doc/usage.adoc
+++ b/extensions/debezium-mysql/runtime/src/main/doc/usage.adoc
@@ -1,17 +1,17 @@
 We cannot add the MySQL JDBC driver as a compile scope dependency of this 
extension because it is GPL2 licensed and it
 would be against the policy of the Apache Software Foundation.
 
-Therefore you have to add the dependency to your project yourself, as long as 
you are able to comply with its license
+Therefore, you have to add the dependency to your project yourself, as long as 
you are able to comply with its license
 terms.
 
-`quarkus-bom` (transitively included by `camel-quarkus-bom` and 
`quarkus-universe-bom`) manages a version
-of `mysql:mysql-connector-java` compatible with Camel Quarkus. So you do not 
need specify the version of the
-driver if you import any of the mentioned BOMs. The following should be 
sufficient for Maven:
+`quarkus-bom` (transitively included by `camel-quarkus-bom` and 
`quarkus-camel-bom`) manages a version
+of `com.mysql:mysql-connector-j` compatible with Camel Quarkus. So you do not 
need specify the version of the
+driver when importing any of the aforementioned BOMs. The following should be 
sufficient for Maven:
 
 [source,xml]
 ----
 <dependency>
-    <groupId>mysql</groupId>
-    <artifactId>mysql-connector-java</artifactId>
+    <groupId>com.mysql</groupId>
+    <artifactId>mysql-connector-j</artifactId>
 </dependency>
 ----
diff --git a/integration-tests/debezium/.gitignore 
b/integration-tests/debezium/.gitignore
index 4ab462c685..aa6567a223 100644
--- a/integration-tests/debezium/.gitignore
+++ b/integration-tests/debezium/.gitignore
@@ -1,2 +1,2 @@
-libs/mysql-connector-java*.jar
+libs/mysql-connector-j*.jar
 src/test/resources/*-license-*
\ No newline at end of file
diff --git a/integration-tests/debezium/README.adoc 
b/integration-tests/debezium/README.adoc
index c94ac0c83a..a3c7e34e36 100644
--- a/integration-tests/debezium/README.adoc
+++ b/integration-tests/debezium/README.adoc
@@ -1,8 +1,9 @@
 == MySQL
 
-To run the MySQL Debezium integration tests you have to store the driver jar 
under
-`libs/mysql-connector-java-8.0.22.jar` in the current Maven module. The path 
can be changed by setting the
-`mysql.driver.file` property on the command line.
+To run the MySQL Debezium integration tests you need to have 
`com.msql:mysql-connector-j` installed in you local `.m2` repository directory.
+If it is not present, then you can 
https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/[download] and 
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html[install] 
it manually.
+
+The path can be changed by adding 
`-Dmysql.driver.file=/path/to/mysql-connector-j.jar` to the command line.
 
 == MS SQL Server
 
@@ -14,11 +15,11 @@ Therefore, to execute the MS SQL Server integration tests 
you need to accept the
 https://go.microsoft.com/fwlink/?linkid=857698[EULA] by creating file 
`integration-tests/debezium/src/test/resources/container-license-acceptance.txt`
 with content `mcr.microsoft.com/mssql/server:2017-CU12`
 in the current Maven module.
 
-On a Unix-like system, you can run
+On a Unix-like system, you can run.
 
 [source,shell]
 ----
-$ echo "mcr.microsoft.com/mssql/server:2017-CU12" > 
integration-tests/debezium/src/test/resources/container-license-acceptance.txt
+echo "mcr.microsoft.com/mssql/server:2017-CU12" > 
integration-tests/debezium/src/test/resources/container-license-acceptance.txt
 ----
 
 For more details see 
https://www.testcontainers.org/modules/databases/mssqlserver/
\ No newline at end of file
diff --git a/integration-tests/debezium/pom.xml 
b/integration-tests/debezium/pom.xml
index df0d520b2a..0463e98cc7 100644
--- a/integration-tests/debezium/pom.xml
+++ b/integration-tests/debezium/pom.xml
@@ -34,7 +34,7 @@
         <sqlserver.EULA.accepted>true</sqlserver.EULA.accepted>
         <!-- You need to download the driver yourself. We cannot add a compile 
scope dependency for legal reasons. -->
         <!-- See 
https://camel.apache.org/camel-quarkus/latest/extensions/debezium-mysql.html#_usage
 for more details -->
-        
<mysql.driver.file>libs/mysql-connector-java-8.0.22.jar</mysql.driver.file>
+        
<mysql.driver.file>${settings.localRepository}/com/mysql/mysql-connector-j/${debezium-mysql-connector-version}/mysql-connector-j-${debezium-mysql-connector-version}.jar</mysql.driver.file>
         <!-- You are required to accept an EULA for SQL container image. We 
cannot do it by default for legal reasons. -->
         <!-- See 
https://camel.apache.org/camel-quarkus/latest/extensions/debezium-sqlserver.html#_integration-testing
 for more details -->
         
<sqlserver.EULA>src/test/resources/container-license-acceptance.txt</sqlserver.EULA>
@@ -168,10 +168,10 @@
                     <artifactId>camel-quarkus-debezium-mysql</artifactId>
                 </dependency>
                 <dependency>
-                    <groupId>mysql</groupId>
-                    <artifactId>mysql-connector-java</artifactId>
+                    <groupId>com.mysql</groupId>
+                    <artifactId>mysql-connector-j</artifactId>
                     <scope>system</scope>
-                    
<systemPath>${project.basedir}/${mysql.driver.file}</systemPath>
+                    <systemPath>${mysql.driver.file}</systemPath>
                 </dependency>
             </dependencies>
         </profile>
diff --git 
a/integration-tests/debezium/src/main/java/org/apache/camel/quarkus/component/debezium/common/it/DebeziumSqlserverResource.java
 
b/integration-tests/debezium/src/main/java/org/apache/camel/quarkus/component/debezium/common/it/DebeziumSqlserverResource.java
index 0dea0ad424..29133cfa24 100644
--- 
a/integration-tests/debezium/src/main/java/org/apache/camel/quarkus/component/debezium/common/it/DebeziumSqlserverResource.java
+++ 
b/integration-tests/debezium/src/main/java/org/apache/camel/quarkus/component/debezium/common/it/DebeziumSqlserverResource.java
@@ -23,6 +23,7 @@ import jakarta.ws.rs.GET;
 import jakarta.ws.rs.Path;
 import jakarta.ws.rs.Produces;
 import jakarta.ws.rs.core.MediaType;
+import org.apache.camel.util.ObjectHelper;
 import org.eclipse.microprofile.config.Config;
 import org.eclipse.microprofile.config.inject.ConfigProperty;
 
@@ -58,7 +59,7 @@ public class DebeziumSqlserverResource extends 
AbstractDebeziumResource {
     public String receive() {
         Record record = super.receiveAsRecord();
         //mssql return empty String instead of nulls, which leads to different 
status code 200 vs 204
-        if (record == null || ("d".equals(record.getOperation()) && 
"".equals(record.getValue()))) {
+        if (record == null || ("d".equals(record.getOperation()) && 
ObjectHelper.isEmpty(record.getValue()))) {
             return null;
         }
         return record.getValue();
diff --git 
a/integration-tests/debezium/src/main/resources/application.properties 
b/integration-tests/debezium/src/main/resources/application.properties
index 6be700d35f..d73890ff58 100644
--- a/integration-tests/debezium/src/main/resources/application.properties
+++ b/integration-tests/debezium/src/main/resources/application.properties
@@ -15,5 +15,7 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
+quarkus.devservices.enabled=false
+
 #sql docker container's security is enabled
 quarkus.ssl.native=true
diff --git 
a/integration-tests/debezium/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/sqlserver/DebeziumSqlserverTestResource.java
 
b/integration-tests/debezium/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/sqlserver/DebeziumSqlserverTestResource.java
index 1bbc9e0920..33929932b3 100644
--- 
a/integration-tests/debezium/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/sqlserver/DebeziumSqlserverTestResource.java
+++ 
b/integration-tests/debezium/src/test/java/org/apache/camel/quarkus/component/debezium/common/it/sqlserver/DebeziumSqlserverTestResource.java
@@ -59,7 +59,7 @@ public class DebeziumSqlserverTestResource extends 
AbstractDebeziumTestResource<
         URL eulaUrl = 
Thread.currentThread().getContextClassLoader().getResource("container-license-acceptance.txt");
         if (eulaUrl == null) {
             LOG.warn(
-                    "Ms SQL EAULA is not accepted. Container won't start. See 
https://camel.apache.org/camel-quarkus/latest/extensions/debezium-sqlserver.html#_usage
 for more details.");
+                    "MS SQL EULA is not accepted. Container won't start. See 
https://camel.apache.org/camel-quarkus/latest/extensions/debezium-sqlserver.html#_usage
 for more details.");
             return Collections.emptyMap();
         }
 

Reply via email to