From 48e1f4f5f1df052f795e4c938c180a95ded69739 Mon Sep 17 00:00:00 2001 From: "angelo.andreussi" Date: Fri, 11 Aug 2023 10:15:02 +0200 Subject: [PATCH 1/2] bump liquibase-core to 4.13 and first modifications to java client --- .../eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java | 2 +- pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java b/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java index a6b6664bba3..0272235e3cc 100644 --- a/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java +++ b/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java @@ -240,7 +240,7 @@ protected static void executeMasters(Connection connection, String schema, File if (!Strings.isNullOrEmpty(schema)) { database.setDefaultSchemaName(schema); } - Liquibase liquibase = new Liquibase(masterChangelog.getAbsolutePath(), new FileSystemResourceAccessor(), database); + Liquibase liquibase = new Liquibase(masterChangelog.getAbsolutePath(), new FileSystemResourceAccessor("/"), database); liquibase.update(ctx); LOG.debug("\t\tExecuting liquibase script: {}... DONE!", masterChangelog.getAbsolutePath()); diff --git a/pom.xml b/pom.xml index fd786871f15..b2e75d1921f 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,7 @@ 1.3.4 0.7.10 4.13.2 - 3.6.3 + 4.13.0 2.17.1 0.0.2 1.2.11 @@ -2646,7 +2646,7 @@ org.hibernate hibernate-jpamodelgen - 5.5.4.Final + 5.6.5.Final From 5e5c731ae71650a51f90148d7c315771c8dbdade Mon Sep 17 00:00:00 2001 From: "angelo.andreussi" Date: Fri, 11 Aug 2023 17:11:16 +0200 Subject: [PATCH 2/2] bump liquibase-core to 4.18 and modifications to java client --- .../liquibase/KapuaLiquibaseClient.java | 25 ++++++++++--------- pom.xml | 11 ++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java b/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java index 0272235e3cc..2af051a97d1 100644 --- a/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java +++ b/commons/src/main/java/org/eclipse/kapua/commons/liquibase/KapuaLiquibaseClient.java @@ -19,7 +19,7 @@ import liquibase.database.DatabaseFactory; import liquibase.database.jvm.JdbcConnection; import liquibase.exception.LiquibaseException; -import liquibase.resource.FileSystemResourceAccessor; +import liquibase.resource.DirectoryResourceAccessor; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.SystemUtils; @@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.net.URL; @@ -72,8 +73,8 @@ public class KapuaLiquibaseClient { * Constructor. * * @param jdbcUrl The JDBC connection string. - * @param username The username to connect to to the database. - * @param password The password to connect to to the database. + * @param username The username to connect to the database. + * @param password The password to connect to the database. * @since 1.0.0 */ public KapuaLiquibaseClient(String jdbcUrl, String username, String password) { @@ -84,8 +85,8 @@ public KapuaLiquibaseClient(String jdbcUrl, String username, String password) { * Constructor. * * @param jdbcUrl The JDBC connection string. - * @param username The username to connect to to the database. - * @param password The password to connect to to the database. + * @param username The username to connect to the database. + * @param password The password to connect to the database. * @param schema The {@link java.util.Optional} schema name. * @since 1.0.0 * @deprecated Since 1.2.0. Removed usage of {@link Optional} as parameter. @@ -99,8 +100,8 @@ public KapuaLiquibaseClient(String jdbcUrl, String username, String password, Op * Constructor. * * @param jdbcUrl The JDBC connection string. - * @param username The username to connect to to the database. - * @param password The password to connect to to the database. + * @param username The username to connect to the database. + * @param password The password to connect to the database. * @param schema The schema name. * @since 1.2.0 */ @@ -172,9 +173,9 @@ public void forceReleaseChangelogLock() { LOG.info("Trying to release changelog lock..."); try (Connection connection = DriverManager.getConnection(jdbcUrl, username, password)) { Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection)); - Liquibase liquibase = new Liquibase((String) null, new FileSystemResourceAccessor(), database); + Liquibase liquibase = new Liquibase((String) null, new DirectoryResourceAccessor(new File("/")), database); liquibase.forceReleaseLocks(); - } catch (LiquibaseException | SQLException e) { + } catch (LiquibaseException | SQLException | FileNotFoundException e) { LOG.error("Running release changelog lock... ERROR! Error: {}", e.getMessage(), e); throw new RuntimeException(e); // TODO: throw an appropriate exception! } @@ -210,7 +211,7 @@ protected static synchronized File loadChangelogs() throws IOException { return changelogTempDirectory; } - protected static void executeMasters(Connection connection, String schema, File changelogDir, List contexts) throws LiquibaseException { + protected static void executeMasters(Connection connection, String schema, File changelogDir, List contexts) throws LiquibaseException, FileNotFoundException { // Find and execute all master scripts LOG.info("Executing pre master files..."); executeMasters(connection, schema, changelogDir, "-master.pre.xml", contexts); @@ -225,7 +226,7 @@ protected static void executeMasters(Connection connection, String schema, File LOG.info("Executing post master files... DONE!"); } - protected static void executeMasters(Connection connection, String schema, File changelogTempDirectory, String preMaster, List contexts) throws LiquibaseException { + protected static void executeMasters(Connection connection, String schema, File changelogTempDirectory, String preMaster, List contexts) throws LiquibaseException, FileNotFoundException { List masterChangelogs = Arrays.asList(changelogTempDirectory.listFiles((dir, name) -> name.endsWith(preMaster))); LOG.info("\tMaster Liquibase files found: {}", masterChangelogs.size()); @@ -240,7 +241,7 @@ protected static void executeMasters(Connection connection, String schema, File if (!Strings.isNullOrEmpty(schema)) { database.setDefaultSchemaName(schema); } - Liquibase liquibase = new Liquibase(masterChangelog.getAbsolutePath(), new FileSystemResourceAccessor("/"), database); + Liquibase liquibase = new Liquibase(masterChangelog.getAbsolutePath(), new DirectoryResourceAccessor(new File("/")), database); liquibase.update(ctx); LOG.debug("\t\tExecuting liquibase script: {}... DONE!", masterChangelog.getAbsolutePath()); diff --git a/pom.xml b/pom.xml index b2e75d1921f..c5ad402542f 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,7 @@ 1.3.4 0.7.10 4.13.2 - 4.13.0 + 4.18.0 2.17.1 0.0.2 1.2.11 @@ -1713,10 +1713,10 @@ liquibase-core ${liquibase.version} - + - ch.qos.logback - logback-classic + javax.xml.bind + jaxb-api @@ -2229,7 +2229,6 @@ log4j-over-slf4j ${slf4j.version} - @@ -2646,7 +2645,7 @@ org.hibernate hibernate-jpamodelgen - 5.6.5.Final + 5.5.4.Final