@Test public void createSpringLiquibaseFromLiquibaseDataSource() { DataSource liquibaseDatasource = DataSourceBuilder.create().url("jdbc:h2:mem:liquibase").username("sa").build(); LiquibaseProperties liquibaseProperties = null; DataSource normalDataSource = null; DataSourceProperties dataSourceProperties = null; SpringLiquibase liquibase = SpringLiquibaseUtil.createSpringLiquibase(liquibaseDatasource, liquibaseProperties, normalDataSource, dataSourceProperties); assertThat(liquibase).isNotInstanceOf(DataSourceClosingSpringLiquibase.class) .extracting(SpringLiquibase::getDataSource).isEqualTo(liquibaseDatasource) .asInstanceOf(type(HikariDataSource.class)) .hasFieldOrPropertyWithValue("jdbcUrl", "jdbc:h2:mem:liquibase") .hasFieldOrPropertyWithValue("username", "sa") .hasFieldOrPropertyWithValue("password", null); }
public static SpringLiquibase createSpringLiquibase(DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties) { SpringLiquibase liquibase; DataSource liquibaseDataSource = getDataSource(liquibaseDatasource, liquibaseProperties, dataSource); if (liquibaseDataSource != null) { liquibase = new SpringLiquibase(); liquibase.setDataSource(liquibaseDataSource); return liquibase; } liquibase = new DataSourceClosingSpringLiquibase(); liquibase.setDataSource(createNewDataSource(liquibaseProperties, dataSourceProperties)); return liquibase; }
SpringLiquibaseUtil { public static SpringLiquibase createSpringLiquibase(DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties) { SpringLiquibase liquibase; DataSource liquibaseDataSource = getDataSource(liquibaseDatasource, liquibaseProperties, dataSource); if (liquibaseDataSource != null) { liquibase = new SpringLiquibase(); liquibase.setDataSource(liquibaseDataSource); return liquibase; } liquibase = new DataSourceClosingSpringLiquibase(); liquibase.setDataSource(createNewDataSource(liquibaseProperties, dataSourceProperties)); return liquibase; } }
SpringLiquibaseUtil { public static SpringLiquibase createSpringLiquibase(DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties) { SpringLiquibase liquibase; DataSource liquibaseDataSource = getDataSource(liquibaseDatasource, liquibaseProperties, dataSource); if (liquibaseDataSource != null) { liquibase = new SpringLiquibase(); liquibase.setDataSource(liquibaseDataSource); return liquibase; } liquibase = new DataSourceClosingSpringLiquibase(); liquibase.setDataSource(createNewDataSource(liquibaseProperties, dataSourceProperties)); return liquibase; } private  SpringLiquibaseUtil(); }
SpringLiquibaseUtil { public static SpringLiquibase createSpringLiquibase(DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties) { SpringLiquibase liquibase; DataSource liquibaseDataSource = getDataSource(liquibaseDatasource, liquibaseProperties, dataSource); if (liquibaseDataSource != null) { liquibase = new SpringLiquibase(); liquibase.setDataSource(liquibaseDataSource); return liquibase; } liquibase = new DataSourceClosingSpringLiquibase(); liquibase.setDataSource(createNewDataSource(liquibaseProperties, dataSourceProperties)); return liquibase; } private  SpringLiquibaseUtil(); static SpringLiquibase createSpringLiquibase(DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties); static AsyncSpringLiquibase createAsyncSpringLiquibase(Environment env, Executor executor, DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties); }
SpringLiquibaseUtil { public static SpringLiquibase createSpringLiquibase(DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties) { SpringLiquibase liquibase; DataSource liquibaseDataSource = getDataSource(liquibaseDatasource, liquibaseProperties, dataSource); if (liquibaseDataSource != null) { liquibase = new SpringLiquibase(); liquibase.setDataSource(liquibaseDataSource); return liquibase; } liquibase = new DataSourceClosingSpringLiquibase(); liquibase.setDataSource(createNewDataSource(liquibaseProperties, dataSourceProperties)); return liquibase; } private  SpringLiquibaseUtil(); static SpringLiquibase createSpringLiquibase(DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties); static AsyncSpringLiquibase createAsyncSpringLiquibase(Environment env, Executor executor, DataSource liquibaseDatasource, LiquibaseProperties liquibaseProperties, DataSource dataSource, DataSourceProperties dataSourceProperties);  }