derby embedded db support initial commit; shutdown use case needs work
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
create table T_TEST (NAME varchar(50) not null);
|
||||
Reference in New Issue
Block a user