Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
1080b990
Commit
1080b990
authored
Jul 19, 2016
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Restore DataSourceProperties get...() methods"
This reverts commit
037e6974
. See gh-6406
parent
93ceb980
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
88 deletions
+20
-88
DataSourceProperties.java
...amework/boot/autoconfigure/jdbc/DataSourceProperties.java
+12
-20
DataSourcePropertiesTests.java
...rk/boot/autoconfigure/jdbc/DataSourcePropertiesTests.java
+8
-68
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java
View file @
1080b990
...
@@ -181,14 +181,12 @@ public class DataSourceProperties
...
@@ -181,14 +181,12 @@ public class DataSourceProperties
}
}
/**
/**
*
Determine the driver to use based on this configuration and the environment
.
*
Return the configured driver or {@code null} if none was configured
.
* @return the
driver to use
* @return the
configured driver
* @see #determineDriverClassName()
* @see #determineDriverClassName()
* @deprecated as for 1.4 in favor of {@link #determineDriverClassName()}
*/
*/
@Deprecated
public
String
getDriverClassName
()
{
public
String
getDriverClassName
()
{
return
determineDriverClassName
()
;
return
this
.
driverClassName
;
}
}
public
void
setDriverClassName
(
String
driverClassName
)
{
public
void
setDriverClassName
(
String
driverClassName
)
{
...
@@ -238,14 +236,12 @@ public class DataSourceProperties
...
@@ -238,14 +236,12 @@ public class DataSourceProperties
}
}
/**
/**
*
Determine the url to use based on this configuration and the environment
.
*
Return the configured url or {@code null} if none was configured
.
* @return the
url to use
* @return the
configured url
* @see #determineUrl()
* @see #determineUrl()
* @deprecated as of 1.4 in favor of {@link #determineUrl()}
*/
*/
@Deprecated
public
String
getUrl
()
{
public
String
getUrl
()
{
return
determineUrl
()
;
return
this
.
url
;
}
}
public
void
setUrl
(
String
url
)
{
public
void
setUrl
(
String
url
)
{
...
@@ -270,14 +266,12 @@ public class DataSourceProperties
...
@@ -270,14 +266,12 @@ public class DataSourceProperties
}
}
/**
/**
*
Determine the username to use based on this configuration and the environment
.
*
Return the configured username or {@code null} if none was configured
.
* @return the
username to us
e
* @return the
configured usernam
e
* @see #determineUsername()
* @see #determineUsername()
* @deprecated as of 1.4 in favor of {@link #determineUsername()}
*/
*/
@Deprecated
public
String
getUsername
()
{
public
String
getUsername
()
{
return
determineUsername
()
;
return
this
.
username
;
}
}
public
void
setUsername
(
String
username
)
{
public
void
setUsername
(
String
username
)
{
...
@@ -300,14 +294,12 @@ public class DataSourceProperties
...
@@ -300,14 +294,12 @@ public class DataSourceProperties
}
}
/**
/**
*
Determine the password to use based on this configuration and the environment
.
*
Return the configured password or {@code null} if none was configured
.
* @return the
password to use
* @return the
configured password
* @see #determinePassword()
* @see #determinePassword()
* @deprecated as of 1.4 in favor of {@link #determinePassword()}
*/
*/
@Deprecated
public
String
getPassword
()
{
public
String
getPassword
()
{
return
determinePassword
()
;
return
this
.
password
;
}
}
public
void
setPassword
(
String
password
)
{
public
void
setPassword
(
String
password
)
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourcePropertiesTests.java
View file @
1080b990
...
@@ -29,134 +29,74 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -29,134 +29,74 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
*/
public
class
DataSourcePropertiesTests
{
public
class
DataSourcePropertiesTests
{
@Test
@Deprecated
public
void
getDriver
()
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
assertThat
(
properties
.
getDriverClassName
()).
isEqualTo
(
"com.mysql.jdbc.Driver"
);
}
@Test
@Test
public
void
determineDriver
()
{
public
void
determineDriver
()
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
assertThat
(
properties
.
getDriverClassName
()).
isNull
();
assertThat
(
properties
.
determineDriverClassName
())
assertThat
(
properties
.
determineDriverClassName
())
.
isEqualTo
(
"com.mysql.jdbc.Driver"
);
.
isEqualTo
(
"com.mysql.jdbc.Driver"
);
}
}
@Test
@Deprecated
public
void
getDriverWithExplicitConfig
()
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
properties
.
setDriverClassName
(
"org.hsqldb.jdbcDriver"
);
assertThat
(
properties
.
getDriverClassName
()).
isEqualTo
(
"org.hsqldb.jdbcDriver"
);
}
@Test
@Test
public
void
determineDriverWithExplicitConfig
()
{
public
void
determineDriverWithExplicitConfig
()
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
properties
.
setDriverClassName
(
"org.hsqldb.jdbcDriver"
);
properties
.
setDriverClassName
(
"org.hsqldb.jdbcDriver"
);
assertThat
(
properties
.
getDriverClassName
()).
isEqualTo
(
"org.hsqldb.jdbcDriver"
);
assertThat
(
properties
.
determineDriverClassName
())
assertThat
(
properties
.
determineDriverClassName
())
.
isEqualTo
(
"org.hsqldb.jdbcDriver"
);
.
isEqualTo
(
"org.hsqldb.jdbcDriver"
);
}
}
@Test
@Deprecated
public
void
getUrl
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUrl
()).
isEqualTo
(
EmbeddedDatabaseConnection
.
H2
.
getUrl
());
}
@Test
@Test
public
void
determineUrl
()
throws
Exception
{
public
void
determineUrl
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
afterPropertiesSet
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUrl
()).
isNull
();
assertThat
(
properties
.
determineUrl
())
assertThat
(
properties
.
determineUrl
())
.
isEqualTo
(
EmbeddedDatabaseConnection
.
H2
.
getUrl
());
.
isEqualTo
(
EmbeddedDatabaseConnection
.
H2
.
getUrl
());
}
}
@Test
@Deprecated
public
void
getUrlWithExplicitConfig
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUrl
()).
isEqualTo
(
"jdbc:mysql://mydb"
);
}
@Test
@Test
public
void
determineUrlWithExplicitConfig
()
throws
Exception
{
public
void
determineUrlWithExplicitConfig
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
properties
.
setUrl
(
"jdbc:mysql://mydb"
);
properties
.
afterPropertiesSet
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUrl
()).
isEqualTo
(
"jdbc:mysql://mydb"
);
assertThat
(
properties
.
determineUrl
()).
isEqualTo
(
"jdbc:mysql://mydb"
);
assertThat
(
properties
.
determineUrl
()).
isEqualTo
(
"jdbc:mysql://mydb"
);
}
}
@Test
@Deprecated
public
void
getUsername
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUsername
()).
isEqualTo
(
"sa"
);
}
@Test
@Test
public
void
determineUsername
()
throws
Exception
{
public
void
determineUsername
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
afterPropertiesSet
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUsername
()).
isNull
();
assertThat
(
properties
.
determineUsername
()).
isEqualTo
(
"sa"
);
assertThat
(
properties
.
determineUsername
()).
isEqualTo
(
"sa"
);
}
}
@Test
@Deprecated
public
void
getUsernameWithExplicitConfig
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUsername
(
"foo"
);
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUsername
()).
isEqualTo
(
"foo"
);
}
@Test
@Test
public
void
determineUsernameWithExplicitConfig
()
throws
Exception
{
public
void
determineUsernameWithExplicitConfig
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setUsername
(
"foo"
);
properties
.
setUsername
(
"foo"
);
properties
.
afterPropertiesSet
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getUsername
()).
isEqualTo
(
"foo"
);
assertThat
(
properties
.
determineUsername
()).
isEqualTo
(
"foo"
);
assertThat
(
properties
.
determineUsername
()).
isEqualTo
(
"foo"
);
}
}
@Test
@Deprecated
public
void
getPassword
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getPassword
()).
isEqualTo
(
""
);
}
@Test
@Test
public
void
determinePassword
()
throws
Exception
{
public
void
determinePassword
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
afterPropertiesSet
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getPassword
()).
isNull
();
assertThat
(
properties
.
determinePassword
()).
isEqualTo
(
""
);
assertThat
(
properties
.
determinePassword
()).
isEqualTo
(
""
);
}
}
@Test
@Deprecated
public
void
getPasswordWithExplicitConfig
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setPassword
(
"bar"
);
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getPassword
()).
isEqualTo
(
"bar"
);
}
@Test
@Test
public
void
determinePasswordWithExplicitConfig
()
throws
Exception
{
public
void
determinePasswordWithExplicitConfig
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setPassword
(
"bar"
);
properties
.
setPassword
(
"bar"
);
properties
.
afterPropertiesSet
();
properties
.
afterPropertiesSet
();
assertThat
(
properties
.
getPassword
()).
isEqualTo
(
"bar"
);
assertThat
(
properties
.
determinePassword
()).
isEqualTo
(
"bar"
);
assertThat
(
properties
.
determinePassword
()).
isEqualTo
(
"bar"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment