Commit 08279c88 authored by Vladyslav Kiriushkin's avatar Vladyslav Kiriushkin Committed by Stephane Nicoll

Add liquibase test rollback on update property

See gh-13159
parent b839c98d
...@@ -129,6 +129,7 @@ public class LiquibaseAutoConfiguration { ...@@ -129,6 +129,7 @@ public class LiquibaseAutoConfiguration {
liquibase.setLabels(this.properties.getLabels()); liquibase.setLabels(this.properties.getLabels());
liquibase.setChangeLogParameters(this.properties.getParameters()); liquibase.setChangeLogParameters(this.properties.getParameters());
liquibase.setRollbackFile(this.properties.getRollbackFile()); liquibase.setRollbackFile(this.properties.getRollbackFile());
liquibase.setTestRollbackOnUpdate(this.properties.isTestRollbackOnUpdate());
return liquibase; return liquibase;
} }
......
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -94,6 +94,11 @@ public class LiquibaseProperties { ...@@ -94,6 +94,11 @@ public class LiquibaseProperties {
*/ */
private File rollbackFile; private File rollbackFile;
/**
* Whether rollback should be tested before update is performed.
*/
private boolean testRollbackOnUpdate;
public String getChangeLog() { public String getChangeLog() {
return this.changeLog; return this.changeLog;
} }
...@@ -191,4 +196,11 @@ public class LiquibaseProperties { ...@@ -191,4 +196,11 @@ public class LiquibaseProperties {
this.rollbackFile = rollbackFile; this.rollbackFile = rollbackFile;
} }
public boolean isTestRollbackOnUpdate() {
return this.testRollbackOnUpdate;
}
public void setTestRollbackOnUpdate(boolean testRollbackOnUpdate) {
this.testRollbackOnUpdate = testRollbackOnUpdate;
}
} }
...@@ -238,6 +238,17 @@ public class LiquibaseAutoConfigurationTests { ...@@ -238,6 +238,17 @@ public class LiquibaseAutoConfigurationTests {
}); });
} }
@Test
public void testRollbackOnUpdate() throws IOException {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues(
"spring.liquibase.test-rollback-on-update:true")
.run((context) -> {
SpringLiquibase liquibase = context.getBean(SpringLiquibase.class);
assertThat(liquibase.isTestRollbackOnUpdate());
});
}
@Test @Test
public void liquibaseDataSource() { public void liquibaseDataSource() {
this.contextRunner.withUserConfiguration(LiquibaseDataSourceConfiguration.class, this.contextRunner.withUserConfiguration(LiquibaseDataSourceConfiguration.class,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment