liquibase.integration.spring.SpringLiquibase Java Examples
The following examples show how to use
liquibase.integration.spring.SpringLiquibase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringLiquibaseUtilTest.java From jhipster with Apache License 2.0 | 6 votes |
@Test public void createSpringLiquibaseFromLiquibaseProperties() { DataSource liquibaseDatasource = null; LiquibaseProperties liquibaseProperties = new LiquibaseProperties(); liquibaseProperties.setUrl("jdbc:h2:mem:liquibase"); liquibaseProperties.setUser("sa"); DataSource normalDataSource = null; DataSourceProperties dataSourceProperties = new DataSourceProperties(); dataSourceProperties.setPassword("password"); SpringLiquibase liquibase = SpringLiquibaseUtil.createSpringLiquibase(liquibaseDatasource, liquibaseProperties, normalDataSource, dataSourceProperties); assertThat(liquibase) .asInstanceOf(type(DataSourceClosingSpringLiquibase.class)) .extracting(SpringLiquibase::getDataSource) .asInstanceOf(type(HikariDataSource.class)) .hasFieldOrPropertyWithValue("jdbcUrl", "jdbc:h2:mem:liquibase") .hasFieldOrPropertyWithValue("username", "sa") .hasFieldOrPropertyWithValue("password", "password"); }
Example #2
Source File: Utils.java From radman with MIT License | 5 votes |
static SpringLiquibase buildLiquibase(DataSource dataSource, LiquibaseProperties properties) { SpringLiquibase liquibase = new SpringLiquibase(); liquibase.setDataSource(dataSource); liquibase.setChangeLog(properties.getChangeLog()); liquibase.setContexts(properties.getContexts()); liquibase.setDefaultSchema(properties.getDefaultSchema()); liquibase.setDropFirst(properties.isDropFirst()); liquibase.setShouldRun(properties.isEnabled()); liquibase.setLabels(properties.getLabels()); liquibase.setChangeLogParameters(properties.getParameters()); liquibase.setRollbackFile(properties.getRollbackFile()); return liquibase; }
Example #3
Source File: RepositoryConfig.java From elucidate-server with MIT License | 5 votes |
@Bean(name = "liquibaseMigrations") public SpringLiquibase liquibaseMigrations() throws PropertyVetoException { SpringLiquibase liquibase = new SpringLiquibase(); liquibase.setDataSource(dataSource()); liquibase.setChangeLog("classpath:database/liquibase-changelog.xml"); return liquibase; }
Example #4
Source File: SpringLiquibaseUtilTest.java From jhipster with Apache License 2.0 | 5 votes |
@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); }
Example #5
Source File: SpringLiquibaseUtilTest.java From jhipster with Apache License 2.0 | 5 votes |
@Test public void createSpringLiquibaseFromNormalDataSource() { DataSource liquibaseDatasource = null; LiquibaseProperties liquibaseProperties = new LiquibaseProperties(); DataSource normalDataSource = DataSourceBuilder.create().url("jdbc:h2:mem:normal").username("sa").build(); DataSourceProperties dataSourceProperties = null; SpringLiquibase liquibase = SpringLiquibaseUtil.createSpringLiquibase(liquibaseDatasource, liquibaseProperties, normalDataSource, dataSourceProperties); assertThat(liquibase).isNotInstanceOf(DataSourceClosingSpringLiquibase.class) .extracting(SpringLiquibase::getDataSource).isEqualTo(normalDataSource) .asInstanceOf(type(HikariDataSource.class)) .hasFieldOrPropertyWithValue("jdbcUrl", "jdbc:h2:mem:normal") .hasFieldOrPropertyWithValue("username", "sa") .hasFieldOrPropertyWithValue("password", null); }
Example #6
Source File: DITestingConfiguration.java From waltz with Apache License 2.0 | 5 votes |
@Bean public SpringLiquibase springLiquibase(DataSource dataSource, DSLContext dsl) throws SQLException { dsl.createSchemaIfNotExists("test").execute(); SpringLiquibase liquibase = new SpringLiquibase(); // we want to drop the database if it was created before to have immutable version liquibase.setDropFirst(true); liquibase.setDataSource(dataSource); liquibase.setDefaultSchema("test"); liquibase.setChangeLog("file:../waltz-data/src/main/ddl/liquibase/db.changelog-master.xml"); return liquibase; }
Example #7
Source File: ScoreDefaultDatasourceContext.java From score with Apache License 2.0 | 5 votes |
@Bean SpringLiquibase liquibase() { SpringLiquibase springLiquibase = new SpringLiquibase(); springLiquibase.setDataSource(dataSource()); springLiquibase.setChangeLog("classpath:/META-INF/database/score.changes.xml"); return springLiquibase; }
Example #8
Source File: RadmanDbConfiguration.java From radman with MIT License | 4 votes |
@Bean SpringLiquibase liquibase() { return buildLiquibase(radmanDataSource(), liquibaseProperties()); }
Example #9
Source File: SwaggerConfigTest.java From spring-postgresql-demo with Apache License 2.0 | 4 votes |
@BeforeClass public static void switchOffLiquibase() { SpringLiquibase liquibase = new SpringLiquibase(); liquibase.setShouldRun(false); }
Example #10
Source File: DatabaseConfiguration.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Inject @Bean public SpringLiquibase persistenceChangelog(DataSource dataSource) { return getLiquibaseTemplate(dataSource, PERSISTENCE_CHANGE_LOG); }
Example #11
Source File: DatabaseConfiguration.java From multiapps-controller with Apache License 2.0 | 4 votes |
private SpringLiquibase getLiquibaseTemplate(DataSource dataSource, String changeLog) { SpringLiquibase springLiquibase = new SpringLiquibase(); springLiquibase.setDataSource(dataSource); springLiquibase.setChangeLog(changeLog); return springLiquibase; }
Example #12
Source File: DatabaseConfiguration.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Inject @Bean @DependsOn("persistenceChangelog") public SpringLiquibase coreChangelog(DataSource dataSource) { return getLiquibaseTemplate(dataSource, CORE_CHANGE_LOG); }