Revert "Fix detection logic for embedded databases"
This reverts commit c4a5a34702.
See gh-23721
This commit is contained in:
@@ -325,7 +325,7 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
|
||||
if (StringUtils.hasText(this.username)) {
|
||||
return this.username;
|
||||
}
|
||||
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName(), determineUrl())) {
|
||||
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) {
|
||||
return "sa";
|
||||
}
|
||||
return null;
|
||||
@@ -353,7 +353,7 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
|
||||
if (StringUtils.hasText(this.password)) {
|
||||
return this.password;
|
||||
}
|
||||
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName(), determineUrl())) {
|
||||
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) {
|
||||
return "";
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -98,24 +98,6 @@ class DataSourcePropertiesTests {
|
||||
assertThat(properties.determineUsername()).isEqualTo("sa");
|
||||
}
|
||||
|
||||
@Test
|
||||
void determineUsernameWhenEmpty() throws Exception {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
properties.setUsername("");
|
||||
properties.afterPropertiesSet();
|
||||
assertThat(properties.getUsername());
|
||||
assertThat(properties.determineUsername()).isEqualTo("sa");
|
||||
}
|
||||
|
||||
@Test
|
||||
void determineUsernameWhenNull() throws Exception {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
properties.setUsername(null);
|
||||
properties.afterPropertiesSet();
|
||||
assertThat(properties.getUsername());
|
||||
assertThat(properties.determineUsername()).isEqualTo("sa");
|
||||
}
|
||||
|
||||
@Test
|
||||
void determineUsernameWithExplicitConfig() throws Exception {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
@@ -125,15 +107,6 @@ class DataSourcePropertiesTests {
|
||||
assertThat(properties.determineUsername()).isEqualTo("foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
void determineUsernameWithNonEmbeddedUrl() throws Exception {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
properties.setUrl("jdbc:h2:~/test");
|
||||
properties.afterPropertiesSet();
|
||||
assertThat(properties.getPassword()).isNull();
|
||||
assertThat(properties.determineUsername()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void determinePassword() throws Exception {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
@@ -151,15 +124,6 @@ class DataSourcePropertiesTests {
|
||||
assertThat(properties.determinePassword()).isEqualTo("bar");
|
||||
}
|
||||
|
||||
@Test
|
||||
void determinePasswordWithNonEmbeddedUrl() throws Exception {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
properties.setUrl("jdbc:h2:~/test");
|
||||
properties.afterPropertiesSet();
|
||||
assertThat(properties.getPassword()).isNull();
|
||||
assertThat(properties.determinePassword()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void determineCredentialsForSchemaScripts() {
|
||||
DataSourceProperties properties = new DataSourceProperties();
|
||||
|
||||
Reference in New Issue
Block a user