RESOLVED - issue SPR-6668: Small Connection leak in DataSourceInitializer
http://jira.springframework.org/browse/SPR-6668
This commit is contained in:
@@ -23,6 +23,18 @@ public class JdbcNamespaceIntegrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateEmbeddedDatabaseAgain() throws Exception {
|
||||
// If Derby isn't cleaned up properly this will fail...
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"org/springframework/jdbc/config/jdbc-config.xml");
|
||||
try {
|
||||
assertCorrectSetup(context.getBean("derbyDataSource", DataSource.class));
|
||||
} finally {
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateWithResourcePattern() throws Exception {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
|
||||
@@ -2,6 +2,9 @@ package org.springframework.jdbc.datasource.init;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -21,7 +24,12 @@ public class DatabasePopulatorTests {
|
||||
databasePopulator.addScript(resourceLoader.getResource("db-schema-failed-drop-comments.sql"));
|
||||
databasePopulator.addScript(resourceLoader.getResource("db-test-data.sql"));
|
||||
databasePopulator.setIgnoreFailedDrops(true);
|
||||
databasePopulator.populate(db.getConnection());
|
||||
Connection connection = db.getConnection();
|
||||
try {
|
||||
databasePopulator.populate(connection);
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
assertDatabaseCreated(db);
|
||||
db.shutdown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user