derby embedded db support initial commit; shutdown use case needs work

This commit is contained in:
Keith Donald
2009-05-16 15:05:28 +00:00
parent 662dbaaed8
commit eee52f8804
14 changed files with 136 additions and 8 deletions

View File

@@ -15,7 +15,9 @@ public class JdbcNamespaceIntegrationTest {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/jdbc/config/jdbc-config.xml");
assertCorrectSetup(context.getBean("dataSource", DataSource.class));
assertCorrectSetup(context.getBean("h2dataSource", DataSource.class));
assertCorrectSetup(context.getBean("h2DataSource", DataSource.class));
assertCorrectSetup(context.getBean("derbyDataSource", DataSource.class));
context.close();
}
private void assertCorrectSetup(DataSource dataSource) {

View File

@@ -1,8 +1,11 @@
package org.springframework.jdbc.datasource.embedded;
import static org.junit.Assert.*;
import static org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType.DERBY;
import static org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType.H2;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -28,6 +31,15 @@ public class EmbeddedDatabaseBuilderTests {
assertDatabaseCreatedAndShutdown(db);
}
@Test
@Ignore
public void testBuildDerby() {
// TODO this fails when the whole suite runs b/c tables are not cleaned up
EmbeddedDatabaseBuilder builder = EmbeddedDatabaseBuilder.relativeTo(getClass());
EmbeddedDatabase db = builder.type(DERBY).script("db-schema-derby.sql").script("db-test-data.sql").build();
assertDatabaseCreatedAndShutdown(db);
}
@Test
public void testBuildNoSuchScript() {
try {

View File

@@ -10,9 +10,14 @@
<jdbc:script location="classpath:org/springframework/jdbc/datasource/embedded/db-test-data.sql"/>
</jdbc:embedded-database>
<jdbc:embedded-database id="h2dataSource" type="H2">
<jdbc:embedded-database id="h2DataSource" type="H2">
<jdbc:script location="classpath:org/springframework/jdbc/datasource/embedded/db-schema.sql"/>
<jdbc:script location="classpath:org/springframework/jdbc/datasource/embedded/db-test-data.sql"/>
</jdbc:embedded-database>
<jdbc:embedded-database id="derbyDataSource" type="DERBY">
<jdbc:script location="classpath:org/springframework/jdbc/datasource/embedded/db-schema-derby.sql"/>
<jdbc:script location="classpath:org/springframework/jdbc/datasource/embedded/db-test-data.sql"/>
</jdbc:embedded-database>
</beans>

View File

@@ -0,0 +1 @@
create table T_TEST (NAME varchar(50) not null);