Merge pull request #2575 from mposolda/master
KEYCLOAK-2795 Testsuite fails sometimes with NPE in LockServiceFactor…
This commit is contained in:
commit
23e261244c
1 changed files with 5 additions and 4 deletions
|
@ -69,6 +69,7 @@ public class DefaultLiquibaseConnectionProvider implements LiquibaseConnectionPr
|
||||||
|
|
||||||
protected void baseLiquibaseInitialization() {
|
protected void baseLiquibaseInitialization() {
|
||||||
ServiceLocator sl = ServiceLocator.getInstance();
|
ServiceLocator sl = ServiceLocator.getInstance();
|
||||||
|
sl.setResourceAccessor(new ClassLoaderResourceAccessor(getClass().getClassLoader()));
|
||||||
|
|
||||||
if (!System.getProperties().containsKey("liquibase.scan.packages")) {
|
if (!System.getProperties().containsKey("liquibase.scan.packages")) {
|
||||||
if (sl.getPackages().remove("liquibase.core")) {
|
if (sl.getPackages().remove("liquibase.core")) {
|
||||||
|
@ -85,6 +86,10 @@ public class DefaultLiquibaseConnectionProvider implements LiquibaseConnectionPr
|
||||||
|
|
||||||
sl.getPackages().remove("liquibase.ext");
|
sl.getPackages().remove("liquibase.ext");
|
||||||
sl.getPackages().remove("liquibase.sdk");
|
sl.getPackages().remove("liquibase.sdk");
|
||||||
|
|
||||||
|
String lockPackageName = DummyLockService.class.getPackage().getName();
|
||||||
|
logger.debugf("Added package %s to liquibase", lockPackageName);
|
||||||
|
sl.addPackageToScan(lockPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogFactory.setInstance(new LogWrapper());
|
LogFactory.setInstance(new LogWrapper());
|
||||||
|
@ -129,10 +134,6 @@ public class DefaultLiquibaseConnectionProvider implements LiquibaseConnectionPr
|
||||||
String changelog = (database instanceof DB2Database) ? LiquibaseJpaUpdaterProvider.DB2_CHANGELOG : LiquibaseJpaUpdaterProvider.CHANGELOG;
|
String changelog = (database instanceof DB2Database) ? LiquibaseJpaUpdaterProvider.DB2_CHANGELOG : LiquibaseJpaUpdaterProvider.CHANGELOG;
|
||||||
logger.debugf("Using changelog file: %s", changelog);
|
logger.debugf("Using changelog file: %s", changelog);
|
||||||
|
|
||||||
// We wrap liquibase update in CustomLockService provided by DBLockProvider. No need to lock inside liquibase itself.
|
|
||||||
// NOTE: This can't be done in baseLiquibaseInitialization() as liquibase always restarts lock service
|
|
||||||
LockServiceFactory.getInstance().register(new DummyLockService());
|
|
||||||
|
|
||||||
return new Liquibase(changelog, new ClassLoaderResourceAccessor(getClass().getClassLoader()), database);
|
return new Liquibase(changelog, new ClassLoaderResourceAccessor(getClass().getClassLoader()), database);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue