Skip to content

Commit

Permalink
Merge pull request spring-projects#19926 from xak2000
Browse files Browse the repository at this point in the history
* pr/19926:
  Polish "Remove unnecessary leading slash in changelog locations"
  Remove unnecessary leading slash in changelog locations

Closes spring-projectsgh-19926
  • Loading branch information
snicoll committed Feb 11, 2020
2 parents b6a408a + ec14e82 commit 4c0c0ae
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -104,10 +104,10 @@ public void whenMultipleLiquibaseBeansArePresentChangeSetsAreCorrectlyReportedFo
.liquibaseBeans().getContexts().get(context.getId()).getLiquibaseBeans();
assertThat(liquibaseBeans.get("liquibase").getChangeSets()).hasSize(1);
assertThat(liquibaseBeans.get("liquibase").getChangeSets().get(0).getChangeLog())
.isEqualTo("classpath:/db/changelog/db.changelog-master.yaml");
.isEqualTo("classpath:db/changelog/db.changelog-master.yaml");
assertThat(liquibaseBeans.get("liquibaseBackup").getChangeSets()).hasSize(1);
assertThat(liquibaseBeans.get("liquibaseBackup").getChangeSets().get(0).getChangeLog())
.isEqualTo("classpath:/db/changelog/db.changelog-master-backup.yaml");
.isEqualTo("classpath:db/changelog/db.changelog-master-backup.yaml");
});
}

Expand Down Expand Up @@ -157,7 +157,7 @@ private DataSource createEmbeddedDatabase() {

private SpringLiquibase createSpringLiquibase(String changeLog, DataSource dataSource) {
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setChangeLog("classpath:/db/changelog/" + changeLog);
liquibase.setChangeLog("classpath:db/changelog/" + changeLog);
liquibase.setShouldRun(true);
liquibase.setDataSource(dataSource);
return liquibase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,7 +36,7 @@ public class LiquibaseProperties {
/**
* Change log configuration path.
*/
private String changeLog = "classpath:/db/changelog/db.changelog-master.yaml";
private String changeLog = "classpath:db/changelog/db.changelog-master.yaml";

/**
* Comma-separated list of runtime contexts to use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@
"name": "liquibase.change-log",
"type": "java.lang.String",
"description": "Change log configuration path.",
"defaultValue": "classpath:/db/changelog/db.changelog-master.yaml",
"defaultValue": "classpath:db/changelog/db.changelog-master.yaml",
"deprecation": {
"replacement": "spring.liquibase.change-log",
"level": "error"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -92,7 +92,7 @@ public void noDataSource() {
public void defaultSpringLiquibase() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.run(assertLiquibase((liquibase) -> {
assertThat(liquibase.getChangeLog()).isEqualTo("classpath:/db/changelog/db.changelog-master.yaml");
assertThat(liquibase.getChangeLog()).isEqualTo("classpath:db/changelog/db.changelog-master.yaml");
assertThat(liquibase.getContexts()).isNull();
assertThat(liquibase.getDefaultSchema()).isNull();
assertThat(liquibase.isDropFirst()).isFalse();
Expand All @@ -102,26 +102,26 @@ public void defaultSpringLiquibase() {
@Test
public void changelogXml() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.liquibase.change-log:classpath:/db/changelog/db.changelog-override.xml")
.withPropertyValues("spring.liquibase.change-log:classpath:db/changelog/db.changelog-override.xml")
.run(assertLiquibase((liquibase) -> assertThat(liquibase.getChangeLog())
.isEqualTo("classpath:/db/changelog/db.changelog-override.xml")));
.isEqualTo("classpath:db/changelog/db.changelog-override.xml")));
}

@Test
public void changelogJson() {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.liquibase.change-log:classpath:/db/changelog/db.changelog-override.json")
.withPropertyValues("spring.liquibase.change-log:classpath:db/changelog/db.changelog-override.json")
.run(assertLiquibase((liquibase) -> assertThat(liquibase.getChangeLog())
.isEqualTo("classpath:/db/changelog/db.changelog-override.json")));
.isEqualTo("classpath:db/changelog/db.changelog-override.json")));
}

@Test
public void changelogSql() {
Assume.javaEight();
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.liquibase.change-log:classpath:/db/changelog/db.changelog-override.sql")
.withPropertyValues("spring.liquibase.change-log:classpath:db/changelog/db.changelog-override.sql")
.run(assertLiquibase((liquibase) -> assertThat(liquibase.getChangeLog())
.isEqualTo("classpath:/db/changelog/db.changelog-override.sql")));
.isEqualTo("classpath:db/changelog/db.changelog-override.sql")));
}

@Test
Expand Down Expand Up @@ -354,7 +354,7 @@ static class LiquibaseUserConfiguration {
@Bean
SpringLiquibase springLiquibase(DataSource dataSource) {
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setChangeLog("classpath:/db/changelog/db.changelog-master.yaml");
liquibase.setChangeLog("classpath:db/changelog/db.changelog-master.yaml");
liquibase.setShouldRun(true);
liquibase.setDataSource(dataSource);
return liquibase;
Expand Down

0 comments on commit 4c0c0ae

Please sign in to comment.