Skip to content

Commit

Permalink
Verify liquibase core 4.29.2
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Sep 29, 2024
1 parent 8f3a98b commit 2cd9ff9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<project.build.outputTimestamp>2024-03-28T07:01:34Z</project.build.outputTimestamp>

<java.version>1.8</java.version>
<liquibase.version>4.28.0</liquibase.version>
<liquibase.version>4.29.2</liquibase.version>
<mysql.connector.version>8.4.0</mysql.connector.version>
<mariadb.connector.version>3.3.3</mariadb.connector.version>
<percona.toolkit.version>3.6.0</percona.toolkit.version>
Expand Down
52 changes: 52 additions & 0 deletions src/test/java/liquibase/ext/percona/VerifyLiquibaseCoreTest.java
Original file line number Diff line number Diff line change
@@ -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)
);
}
}

0 comments on commit 2cd9ff9

Please sign in to comment.