File tree 2 files changed +14
-8
lines changed
org.springframework.jdbc/src/test
java/org/springframework/jdbc/config
resources/org/springframework/jdbc/config
2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -14,18 +14,24 @@ public class JdbcNamespaceIntegrationTest {
14
14
public void testCreateEmbeddedDatabase () throws Exception {
15
15
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext (
16
16
"org/springframework/jdbc/config/jdbc-config.xml" );
17
- assertCorrectSetup (context .getBean ("dataSource" , DataSource .class ));
18
- assertCorrectSetup (context .getBean ("h2DataSource" , DataSource .class ));
19
- assertCorrectSetup (context .getBean ("derbyDataSource" , DataSource .class ));
20
- context .close ();
17
+ try {
18
+ assertCorrectSetup (context .getBean ("dataSource" , DataSource .class ));
19
+ assertCorrectSetup (context .getBean ("h2DataSource" , DataSource .class ));
20
+ assertCorrectSetup (context .getBean ("derbyDataSource" , DataSource .class ));
21
+ } finally {
22
+ context .close ();
23
+ }
21
24
}
22
25
23
26
@ Test
24
27
public void testCreateWithResourcePattern () throws Exception {
25
28
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext (
26
29
"org/springframework/jdbc/config/jdbc-config-pattern.xml" );
27
- assertCorrectSetup (context .getBean ("dataSource" , DataSource .class ));
28
- context .close ();
30
+ try {
31
+ assertCorrectSetup (context .getBean ("dataSource" , DataSource .class ));
32
+ } finally {
33
+ context .close ();
34
+ }
29
35
}
30
36
31
37
private void assertCorrectSetup (DataSource dataSource ) {
Original file line number Diff line number Diff line change 5
5
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
6
6
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd" >
7
7
8
- <jdbc : embedded-database id =" dataSource" >
8
+ <jdbc : embedded-database id =" dataSource" type = " HSQL " >
9
9
<jdbc : script location =" classpath:org/springframework/jdbc/config/db-schema.sql" />
10
- <jdbc : script location =" classpath:org/springframework/jdbc/config/*-data.sql" />
10
+ <jdbc : script location =" classpath* :org/springframework/jdbc/config/*-data.sql" />
11
11
</jdbc : embedded-database >
12
12
13
13
</beans >
You can’t perform that action at this time.
0 commit comments