|
46 | 46 | import org.springframework.context.annotation.Bean; |
47 | 47 | import org.springframework.context.annotation.Configuration; |
48 | 48 | import org.springframework.context.annotation.Primary; |
| 49 | +import org.springframework.jdbc.core.JdbcTemplate; |
49 | 50 | import org.springframework.test.util.ReflectionTestUtils; |
50 | 51 | import org.springframework.util.FileCopyUtils; |
51 | 52 |
|
@@ -143,6 +144,32 @@ public void overrideDefaultSchema() { |
143 | 144 | .isEqualTo("public"))); |
144 | 145 | } |
145 | 146 |
|
| 147 | + @Test |
| 148 | + public void overrideLiquibaseInfrastructure() { |
| 149 | + this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) |
| 150 | + .withPropertyValues("spring.liquibase.liquibase-schema:public", |
| 151 | + "spring.liquibase.liquibase-tablespace:infra", |
| 152 | + "spring.liquibase.database-change-log-table:LIQUI_LOG", |
| 153 | + "spring.liquibase.database-change-log-lock-table:LIQUI_LOCK") |
| 154 | + .run((context) -> { |
| 155 | + SpringLiquibase liquibase = context.getBean(SpringLiquibase.class); |
| 156 | + assertThat(liquibase.getLiquibaseSchema()).isEqualTo("public"); |
| 157 | + assertThat(liquibase.getLiquibaseTablespace()).isEqualTo("infra"); |
| 158 | + assertThat(liquibase.getDatabaseChangeLogTable()) |
| 159 | + .isEqualTo("LIQUI_LOG"); |
| 160 | + assertThat(liquibase.getDatabaseChangeLogLockTable()) |
| 161 | + .isEqualTo("LIQUI_LOCK"); |
| 162 | + JdbcTemplate jdbcTemplate = new JdbcTemplate( |
| 163 | + context.getBean(DataSource.class)); |
| 164 | + assertThat(jdbcTemplate.queryForObject( |
| 165 | + "SELECT COUNT(*) FROM public.LIQUI_LOG", Integer.class)) |
| 166 | + .isEqualTo(1); |
| 167 | + assertThat(jdbcTemplate.queryForObject( |
| 168 | + "SELECT COUNT(*) FROM public.LIQUI_LOCK", Integer.class)) |
| 169 | + .isEqualTo(1); |
| 170 | + }); |
| 171 | + } |
| 172 | + |
146 | 173 | @Test |
147 | 174 | public void overrideDropFirst() { |
148 | 175 | this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) |
|
0 commit comments