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
c94f0822
Commit
c94f0822
authored
Dec 14, 2017
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bean names in tests
See gh-11224
parent
27922ae3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
CompleteTwoDataSourcesExampleTests.java
...amework/boot/jdbc/CompleteTwoDataSourcesExampleTests.java
+3
-3
SimpleTwoDataSourcesExampleTests.java
...framework/boot/jdbc/SimpleTwoDataSourcesExampleTests.java
+6
-6
No files found.
spring-boot-project/spring-boot-docs/src/test/java/org/springframework/boot/jdbc/CompleteTwoDataSourcesExampleTests.java
View file @
c94f0822
...
@@ -48,12 +48,12 @@ public class CompleteTwoDataSourcesExampleTests {
...
@@ -48,12 +48,12 @@ public class CompleteTwoDataSourcesExampleTests {
public
void
validateConfiguration
()
throws
SQLException
{
public
void
validateConfiguration
()
throws
SQLException
{
assertThat
(
this
.
context
.
getBeansOfType
(
DataSource
.
class
)).
hasSize
(
2
);
assertThat
(
this
.
context
.
getBeansOfType
(
DataSource
.
class
)).
hasSize
(
2
);
DataSource
dataSource
=
this
.
context
.
getBean
(
DataSource
.
class
);
DataSource
dataSource
=
this
.
context
.
getBean
(
DataSource
.
class
);
assertThat
(
this
.
context
.
getBean
(
"f
oo
DataSource"
)).
isSameAs
(
dataSource
);
assertThat
(
this
.
context
.
getBean
(
"f
irst
DataSource"
)).
isSameAs
(
dataSource
);
assertThat
(
dataSource
.
getConnection
().
getMetaData
().
getURL
())
assertThat
(
dataSource
.
getConnection
().
getMetaData
().
getURL
())
.
startsWith
(
"jdbc:h2:mem:"
);
.
startsWith
(
"jdbc:h2:mem:"
);
DataSource
barDataSource
=
this
.
context
.
getBean
(
"bar
DataSource"
,
DataSource
secondDataSource
=
this
.
context
.
getBean
(
"second
DataSource"
,
DataSource
.
class
);
DataSource
.
class
);
assertThat
(
bar
DataSource
.
getConnection
().
getMetaData
().
getURL
())
assertThat
(
second
DataSource
.
getConnection
().
getMetaData
().
getURL
())
.
startsWith
(
"jdbc:h2:mem:"
);
.
startsWith
(
"jdbc:h2:mem:"
);
}
}
...
...
spring-boot-project/spring-boot-docs/src/test/java/org/springframework/boot/jdbc/SimpleTwoDataSourcesExampleTests.java
View file @
c94f0822
...
@@ -38,8 +38,8 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -38,8 +38,8 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Stephane Nicoll
* @author Stephane Nicoll
*/
*/
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
properties
=
{
"app.datasource.
bar
.url=jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1"
,
@SpringBootTest
(
properties
=
{
"app.datasource.
second
.url=jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1"
,
"app.datasource.
bar
.max-total=42"
})
"app.datasource.
second
.max-total=42"
})
@Import
(
SimpleTwoDataSourcesExample
.
SimpleDataSourcesConfiguration
.
class
)
@Import
(
SimpleTwoDataSourcesExample
.
SimpleDataSourcesConfiguration
.
class
)
public
class
SimpleTwoDataSourcesExampleTests
{
public
class
SimpleTwoDataSourcesExampleTests
{
...
@@ -50,13 +50,13 @@ public class SimpleTwoDataSourcesExampleTests {
...
@@ -50,13 +50,13 @@ public class SimpleTwoDataSourcesExampleTests {
public
void
validateConfiguration
()
throws
SQLException
{
public
void
validateConfiguration
()
throws
SQLException
{
assertThat
(
this
.
context
.
getBeansOfType
(
DataSource
.
class
)).
hasSize
(
2
);
assertThat
(
this
.
context
.
getBeansOfType
(
DataSource
.
class
)).
hasSize
(
2
);
DataSource
dataSource
=
this
.
context
.
getBean
(
DataSource
.
class
);
DataSource
dataSource
=
this
.
context
.
getBean
(
DataSource
.
class
);
assertThat
(
this
.
context
.
getBean
(
"f
oo
DataSource"
)).
isSameAs
(
dataSource
);
assertThat
(
this
.
context
.
getBean
(
"f
irst
DataSource"
)).
isSameAs
(
dataSource
);
assertThat
(
dataSource
.
getConnection
().
getMetaData
().
getURL
())
assertThat
(
dataSource
.
getConnection
().
getMetaData
().
getURL
())
.
startsWith
(
"jdbc:h2:mem:"
);
.
startsWith
(
"jdbc:h2:mem:"
);
BasicDataSource
barDataSource
=
this
.
context
.
getBean
(
"bar
DataSource"
,
BasicDataSource
secondDataSource
=
this
.
context
.
getBean
(
"second
DataSource"
,
BasicDataSource
.
class
);
BasicDataSource
.
class
);
assertThat
(
bar
DataSource
.
getUrl
()).
isEqualTo
(
"jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1"
);
assertThat
(
second
DataSource
.
getUrl
()).
isEqualTo
(
"jdbc:h2:mem:bar;DB_CLOSE_DELAY=-1"
);
assertThat
(
bar
DataSource
.
getMaxTotal
()).
isEqualTo
(
42
);
assertThat
(
second
DataSource
.
getMaxTotal
()).
isEqualTo
(
42
);
}
}
}
}
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