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
b23f68b0
Commit
b23f68b0
authored
Oct 25, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
7e438ca6
81e33dc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
DataSourcePropertiesTests.java
...rk/boot/autoconfigure/jdbc/DataSourcePropertiesTests.java
+17
-0
EmbeddedDatabaseConnection.java
...springframework/boot/jdbc/EmbeddedDatabaseConnection.java
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jdbc/DataSourcePropertiesTests.java
View file @
b23f68b0
...
...
@@ -16,9 +16,12 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
jdbc
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.rules.ExpectedException
;
import
org.springframework.boot.jdbc.EmbeddedDatabaseConnection
;
import
org.springframework.boot.test.context.HidePackagesClassLoader
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -31,6 +34,9 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public
class
DataSourcePropertiesTests
{
@Rule
public
final
ExpectedException
thrown
=
ExpectedException
.
none
();
@Test
public
void
determineDriver
()
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
...
...
@@ -59,6 +65,17 @@ public class DataSourcePropertiesTests {
.
isEqualTo
(
EmbeddedDatabaseConnection
.
H2
.
getUrl
());
}
@Test
public
void
determineUrlWithNoEmbeddedSupport
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
properties
.
setBeanClassLoader
(
new
HidePackagesClassLoader
(
"org.h2"
,
"org.apache.derby"
,
"org.hsqldb"
));
properties
.
afterPropertiesSet
();
this
.
thrown
.
expect
(
DataSourceProperties
.
DataSourceBeanCreationException
.
class
);
this
.
thrown
.
expectMessage
(
"Cannot determine embedded database url"
);
properties
.
determineUrl
();
}
@Test
public
void
determineUrlWithExplicitConfig
()
throws
Exception
{
DataSourceProperties
properties
=
new
DataSourceProperties
();
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java
View file @
b23f68b0
...
...
@@ -106,7 +106,7 @@ public enum EmbeddedDatabaseConnection {
*/
public
String
getUrl
(
String
databaseName
)
{
Assert
.
hasText
(
databaseName
,
"DatabaseName must not be null."
);
return
String
.
format
(
this
.
url
,
databaseName
)
;
return
this
.
url
!=
null
?
String
.
format
(
this
.
url
,
databaseName
)
:
null
;
}
/**
...
...
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