diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java index a4ad58b395..6c1ea235dc 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; * @author Keith Donald * @author Juergen Hoeller * @author Dave Syer + * @author Sam Brannen * @since 3.0 */ public class EmbeddedDatabaseBuilder { @@ -62,8 +63,8 @@ public class EmbeddedDatabaseBuilder { } /** - * Sets the name of the embedded database - * Defaults to 'testdb' if not called. + * Set the name of the embedded database. + *

Defaults to "testdb" if not called. * @param databaseName the database name * @return this, to facilitate method chaining */ @@ -73,8 +74,8 @@ public class EmbeddedDatabaseBuilder { } /** - * Sets the type of embedded database. - * Defaults to HSQL if not called. + * Set the type of embedded database. + *

Defaults to HSQL if not called. * @param databaseType the database type * @return this, to facilitate method chaining */ @@ -84,7 +85,7 @@ public class EmbeddedDatabaseBuilder { } /** - * Adds a SQL script to execute to populate the database. + * Add a SQL script to execute to populate the database. * @param sqlResource the sql resource location * @return this, to facilitate method chaining */ @@ -95,8 +96,8 @@ public class EmbeddedDatabaseBuilder { /** * Add default scripts to execute to populate the database. - * The default scripts are schema.sql to create the db schema and - * data.sql to populate the db with data. + *

The default scripts are schema.sql to create the db + * schema and data.sql to populate the db with data. * @return this, to facilitate method chaining */ public EmbeddedDatabaseBuilder addDefaultScripts() { diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java index f740e88c1b..9c368c7700 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactory.java @@ -204,10 +204,6 @@ public class EmbeddedDatabaseFactory { return this.dataSource.isWrapperFor(iface); } - public Logger getParentLogger() { - return Logger.getLogger(Logger.GLOBAL_LOGGER_NAME); - } - public void shutdown() { shutdownDatabase(); } diff --git a/src/reference/docbook/jdbc.xml b/src/reference/docbook/jdbc.xml index 8d4132daa0..a982cece00 100644 --- a/src/reference/docbook/jdbc.xml +++ b/src/reference/docbook/jdbc.xml @@ -2902,11 +2902,13 @@ SqlTypeValue value = new AbstractSqlTypeValue() { public class DataAccessUnitTestTemplate { + private EmbeddedDatabase db; @Before public void setUp() { - // creates a HSQL in-memory db populated from default scripts classpath:schema.sql and classpath:test-data.sql + // creates an HSQL in-memory database populated from default scripts + // classpath:schema.sql and classpath:data.sql db = new EmbeddedDatabaseBuilder().addDefaultScripts().build(); } @@ -2920,8 +2922,8 @@ public class DataAccessUnitTestTemplate { public void tearDown() { db.shutdown(); } -} - + +} diff --git a/src/reference/docbook/testing.xml b/src/reference/docbook/testing.xml index 1e0602e08e..1af3b663f4 100644 --- a/src/reference/docbook/testing.xml +++ b/src/reference/docbook/testing.xml @@ -416,6 +416,12 @@ AbstractTransactionalTestNGSpringContextTests provide convenience methods which delegate to SimpleJdbcTestUtils internally. + + The spring-jdbc module provides support for + configuring and launching an embedded database which can be used in + integration tests that interact with a database. For details, see and .