diff --git a/pom.xml b/pom.xml index 6e2034f..0800fd2 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ 2024-03-28T07:01:34Z 1.8 - 4.28.0 + 4.29.2 8.4.0 3.3.3 3.6.0 diff --git a/src/test/java/liquibase/ext/percona/VerifyLiquibaseCoreTest.java b/src/test/java/liquibase/ext/percona/VerifyLiquibaseCoreTest.java new file mode 100644 index 0000000..2cedf0c --- /dev/null +++ b/src/test/java/liquibase/ext/percona/VerifyLiquibaseCoreTest.java @@ -0,0 +1,52 @@ +package liquibase.ext.percona; + +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import liquibase.util.LiquibaseUtil; + +class VerifyLiquibaseCoreTest { + + @Test + void liquibaseUtilVersion() { + assertEquals("4.29.2", LiquibaseUtil.getBuildVersion()); + assertEquals("3683", LiquibaseUtil.getBuildNumber()); + assertEquals("2024-08-29 16:45+0000", LiquibaseUtil.getBuildTime()); + assertEquals("4.29.2", LiquibaseUtil.getBuildVersionInfo()); + } + + @Test + void liquibaseCoreJar() throws URISyntaxException, IOException, InterruptedException { + URL liquibaseCoreLocation = LiquibaseUtil.class.getProtectionDomain().getCodeSource().getLocation(); + assertTrue(liquibaseCoreLocation.toString().endsWith("liquibase-core-4.29.2.jar"), "Unexpected file path: " + liquibaseCoreLocation); + Path liquibaseCore = Paths.get(liquibaseCoreLocation.toURI()); + assertTrue(Files.exists(liquibaseCore), "File doesn't exist: " + liquibaseCore); + + Process process = new ProcessBuilder("md5sum", liquibaseCore.toString()).start(); + String md5sum = IOUtils.toString(process.getInputStream(), StandardCharsets.UTF_8).substring(0, 32); + process.waitFor(10, TimeUnit.SECONDS); + + String md5sumCentral = IOUtils.toString(URI.create("https://repo.maven.apache.org/maven2/org/liquibase/liquibase-core/4.29.2/liquibase-core-4.29.2.jar.md5"), + StandardCharsets.UTF_8); + + assertAll( + () -> assertEquals(2884238L, Files.size(liquibaseCore), "Unexpected file size"), + () -> assertEquals("82d2385a0349310b2c6c994b6d5add13", md5sum, "Unexpected checksum"), + () -> assertEquals(md5sumCentral, md5sum) + ); + } +}