spring-jdbc xsd initial commit; includes embedded-database tag
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package org.springframework.jdbc.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
public class JdbcNamespaceIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testCreateEmbeddedDatabase() throws Exception {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/jdbc/config/jdbc-config.xml");
|
||||
DataSource ds = context.getBean("dataSource", DataSource.class);
|
||||
JdbcTemplate t = new JdbcTemplate(ds);
|
||||
assertEquals(1, t.queryForInt("select count(*) from T_TEST"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="HSQL">
|
||||
<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>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user