From eecdf38158e362580539250a54719a2937fcba07 Mon Sep 17 00:00:00 2001 From: exceptionfactory Date: Tue, 10 May 2022 14:25:00 -0500 Subject: [PATCH] NIFI-10014 Upgraded Registry Test JDBC Drivers - Upgraded MySQL from 8.0.15 to 8.0.29 - Upgraded MariabDB from 2.4.1 to 3.0.4 - Upgraded PostgreSQL from 42.2.19 to 42.3.5 - Removed unsupported database version references from project README.md - Added MariaDB 10.3 to list of Registry examples Signed-off-by: Pierre Villard This closes #6033. --- README.md | 32 ++++--------------- .../nifi-registry-test/pom.xml | 6 ++-- .../registry/db/MariaDBDataSourceFactory.java | 4 +-- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index a1120dfa38..706d37bffe 100644 --- a/README.md +++ b/README.md @@ -280,31 +280,13 @@ If no profile is specified then an H2 DataSource will be used by default and no Assuming Docker is running on the system where the build is running, then the following commands can be run: -| Target Database | Build Command | -| --------------- | ------------- | -| All supported | `mvn verify -Ptest-all-dbs` | -| H2 (default) | `mvn verify` | -| PostgreSQL 9.x | `mvn verify -Dspring.profiles.active=postgres` | -| PostgreSQL 10.x | `mvn verify -Dspring.profiles.active=postgres-10` | -| MySQL 5.6 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-56` | -| MySQL 5.7 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-57` | -| MySQL 8 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-8` | - - When one of the Testcontainer profiles is activated, the test output should show logs that indicate a container has been started, such as the following: - - 2019-05-15 16:14:45.078 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Creating container for image: mysql:5.7 - 2019-05-15 16:14:45.145 INFO 66091 --- [ main] o.t.utility.RegistryAuthLocator : Credentials not found for host (index.docker.io) when using credential helper/store (docker-credential-osxkeychain) - 2019-05-15 16:14:45.646 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Starting container with ID: ca85c8c5a1990d2a898fad04c5897ddcdb3a9405e695cc11259f50f2ebe67c5f - 2019-05-15 16:14:46.437 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Container mysql:5.7 is starting: ca85c8c5a1990d2a898fad04c5897ddcdb3a9405e695cc11259f50f2ebe67c5f - 2019-05-15 16:14:46.479 INFO 66091 --- [ main] 🐳 [mysql:5.7] : Waiting for database connection to become available at jdbc:mysql://localhost:33051/test?useSSL=false&allowPublicKeyRetrieval=true using query 'SELECT 1' - -The Flyway connection should also indicate the given database: - - 2019-05-15 16:15:02.114 INFO 66091 --- [ main] o.a.n.r.db.CustomFlywayConfiguration : Determined database type is MYSQL - 2019-05-15 16:15:02.115 INFO 66091 --- [ main] o.a.n.r.db.CustomFlywayConfiguration : Setting migration locations to [classpath:db/migration/common, classpath:db/migration/mysql] - 2019-05-15 16:15:02.373 INFO 66091 --- [ main] o.a.n.r.d.CustomFlywayMigrationStrategy : First time initializing database... - 2019-05-15 16:15:02.380 INFO 66091 --- [ main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 5.2.1 by Boxfuse - 2019-05-15 16:15:02.403 INFO 66091 --- [ main] o.f.c.internal.database.DatabaseFactory : Database: jdbc:mysql://localhost:33051/test (MySQL 5.7) +| Target Database | Build Command | +|-----------------|--------------------------------------------------------------------| +| All supported | `mvn verify -Ptest-all-dbs` | +| H2 (default) | `mvn verify` | +| MariaDB 10.3 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mariadb-10-3` | +| MySQL 8 | `mvn verify -Pcontrib-check -Dspring.profiles.active=mysql-8` | +| PostgreSQL 10 | `mvn verify -Dspring.profiles.active=postgres-10` | For a full list of the available DataSource factories, consult the `nifi-registry-test` module. diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml b/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml index 4a35dc29d4..3cc53dbeff 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/pom.xml @@ -57,17 +57,17 @@ mysql mysql-connector-java - 8.0.15 + 8.0.29 org.mariadb.jdbc mariadb-java-client - 2.4.1 + 3.0.4 org.postgresql postgresql - 42.2.19 + 42.3.5 junit diff --git a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDBDataSourceFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDBDataSourceFactory.java index 913394765a..f71779ecc3 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDBDataSourceFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDBDataSourceFactory.java @@ -22,7 +22,6 @@ import org.testcontainers.delegate.DatabaseDelegate; import org.testcontainers.jdbc.JdbcDatabaseDelegate; import javax.annotation.PostConstruct; -import javax.script.ScriptException; import javax.sql.DataSource; import java.sql.SQLException; @@ -38,7 +37,6 @@ public abstract class MariaDBDataSourceFactory extends TestDataSourceFactory { dataSource.setUrl(container.getJdbcUrl()); dataSource.setUser(container.getUsername()); dataSource.setPassword(container.getPassword()); - dataSource.setDatabaseName(container.getDatabaseName()); return dataSource; } catch (SQLException e) { throw new RuntimeException("Unable to create MariaDB DataSource", e); @@ -46,7 +44,7 @@ public abstract class MariaDBDataSourceFactory extends TestDataSourceFactory { } @PostConstruct - public void initDatabase() throws SQLException, ScriptException { + public void initDatabase() { DatabaseDelegate databaseDelegate = new JdbcDatabaseDelegate(mariaDBContainer(), ""); databaseDelegate.execute("DROP DATABASE test; CREATE DATABASE test;", "", 0, false, true); }