forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more lenient Liquibase ZipPathHandler to work around includeAll n…
…ot working in prod mode Workaround until liquibase/liquibase#3524 is fixed
- Loading branch information
Showing
5 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
.../liquibase/runtime/src/main/java/io/quarkus/liquibase/LiquibaseLenientZipPathHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.quarkus.liquibase; | ||
|
||
import java.io.FileNotFoundException; | ||
|
||
import liquibase.resource.ResourceAccessor; | ||
import liquibase.resource.ZipPathHandler; | ||
|
||
// https://github.com/liquibase/liquibase/issues/3524#issuecomment-1465282155 | ||
public class LiquibaseLenientZipPathHandler extends ZipPathHandler { | ||
|
||
@Override | ||
public int getPriority(String root) { | ||
if (root != null && root.startsWith("jar:") && root.contains("!/")) { | ||
return PRIORITY_SPECIALIZED; | ||
} | ||
return PRIORITY_NOT_APPLICABLE; | ||
} | ||
|
||
@Override | ||
public ResourceAccessor getResourceAccessor(String root) throws FileNotFoundException { | ||
int idx = root.indexOf("!/"); | ||
return super.getResourceAccessor(idx > 0 ? root.substring(0, idx) : root); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ons/liquibase/runtime/src/main/resources/META-INF/services/liquibase.resource.PathHandler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.quarkus.liquibase.LiquibaseLenientZipPathHandler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...tion-tests/liquibase/src/test/java/io/quarkus/it/liquibase/LiquibaseFunctionalityPMT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.quarkus.it.liquibase; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.LogFile; | ||
import io.quarkus.test.QuarkusProdModeTest; | ||
|
||
public class LiquibaseFunctionalityPMT { | ||
|
||
@RegisterExtension | ||
static final QuarkusProdModeTest config = new QuarkusProdModeTest() | ||
.withApplicationRoot(jar -> jar | ||
.addClasses(LiquibaseApp.class, LiquibaseFunctionalityResource.class) | ||
.addAsResource("db") | ||
.addAsResource("application.properties")) | ||
.setApplicationName("liquibase-prodmode-test") | ||
.setLogFileName("liquibase-prodmode-test.log") | ||
.setRun(true); | ||
|
||
@LogFile | ||
private Path logfile; | ||
|
||
@Test | ||
public void test() { | ||
LiquibaseFunctionalityTest.doTestLiquibaseQuarkusFunctionality(true); | ||
} | ||
|
||
@AfterEach | ||
void dumpLog() throws IOException { | ||
System.out.println(Files.readString(logfile)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters