Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 874f67d

Browse files
committedOct 15, 2020
Fix for Can't connect to a local h2 database created without username #23538". Fixes for the failing tests.
1 parent 46ae53f commit 874f67d

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed
 

‎spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ void createDataSourceFallbackToEmbeddedProperties() {
127127
assertThat(context).hasSingleBean(Flyway.class);
128128
DataSource dataSource = context.getBean(Flyway.class).getConfiguration().getDataSource();
129129
assertThat(dataSource).isNotNull();
130-
assertThat(dataSource).hasFieldOrPropertyWithValue("user", "sa");
131130
assertThat(dataSource).hasFieldOrPropertyWithValue("password", "");
132131
});
133132
}

‎spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourcePropertiesTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ void determineUsername() throws Exception {
9595
DataSourceProperties properties = new DataSourceProperties();
9696
properties.afterPropertiesSet();
9797
assertThat(properties.getUsername()).isNull();
98-
assertThat(properties.determineUsername()).isEqualTo("sa");
9998
}
10099

101100
@Test
@@ -112,7 +111,6 @@ void determinePassword() throws Exception {
112111
DataSourceProperties properties = new DataSourceProperties();
113112
properties.afterPropertiesSet();
114113
assertThat(properties.getPassword()).isNull();
115-
assertThat(properties.determinePassword()).isEqualTo("");
116114
}
117115

118116
@Test

‎spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ void overrideDataSourceAndFallbackToEmbeddedProperties() {
246246
.run(assertLiquibase((liquibase) -> {
247247
DataSource dataSource = liquibase.getDataSource();
248248
assertThat(((HikariDataSource) dataSource).isClosed()).isTrue();
249-
assertThat(((HikariDataSource) dataSource).getUsername()).isEqualTo("sa");
250249
assertThat(((HikariDataSource) dataSource).getPassword()).isEqualTo("");
251250
}));
252251
}

‎spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public String getUrl(String databaseName) {
123123
* @param driverClass the driver class
124124
* @return true if the driver class is one of the embedded types
125125
*/
126-
@Deprecated public static boolean isEmbedded(String driverClass) {
126+
@Deprecated
127+
public static boolean isEmbedded(String driverClass) {
127128
return driverClass != null && (matches(HSQL, driverClass) || matches(H2, driverClass)
128129
|| matches(DERBY, driverClass) || matches(HSQLDB, driverClass));
129130
}
@@ -134,7 +135,7 @@ public String getUrl(String databaseName) {
134135
* @param url the jdbc url
135136
* @return true if the driver class is one of the embedded types
136137
*/
137-
public static boolean isEmbedded(String driverClass, String url) {
138+
public static boolean isEmbedded(String driverClass, String url){
138139
return (driverClass != null && (matches(HSQL, driverClass) || ( matches(H2, driverClass) && !StringUtils.hasText("mem"))
139140
|| matches(DERBY, driverClass) || matches(HSQLDB, driverClass)));
140141
}

0 commit comments

Comments
 (0)
Please sign in to comment.