Clean up database tests in spring-test

This commit is contained in:
Sam Brannen
2015-07-26 20:54:27 +02:00
parent aae0bd2fb4
commit 5b8b1dd378
31 changed files with 175 additions and 347 deletions

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 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-2.5.xsd">
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.BeforeAndAfterTransactionAnnotationTests$DatabaseSetup" />
</beans>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 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-2.5.xsd">
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.ClassLevelTransactionalSpringRunnerTests$DatabaseSetup" />
</beans>

View File

@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 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-2.5.xsd">
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="transactionalTests-context.xml" />
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.ConcreteTransactionalJUnit4SpringContextTests$DatabaseSetup" />
<jdbc:initialize-database data-source="dataSource" >
<jdbc:script location="classpath:/org/springframework/test/jdbc/data.sql"/>
</jdbc:initialize-database>
<bean id="employee" class="org.springframework.tests.sample.beans.Employee">
<property name="name" value="John Smith" />

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="org.hsqldb.jdbcDriver" p:url="jdbc:hsqldb:mem:transactional_tests" p:username="sa" p:password="" />
<bean id="txMgr" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:data-source-ref="dataSource" />
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.DefaultRollbackFalseTransactionalTests$DatabaseSetup" />
</beans>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 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-2.5.xsd">
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.DefaultRollbackTrueTransactionalTests$DatabaseSetup" />
</beans>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
xmlns:p="http://www.springframework.org/schema/p" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="org.hsqldb.jdbcDriver" p:url="jdbc:hsqldb:mem:transactional_tests" p:username="sa" p:password="" />
<jdbc:embedded-database id="dataSource" generate-name="true" />
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:data-source-ref="dataSource" />

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 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-2.5.xsd">
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.MethodLevelTransactionalSpringRunnerTests$DatabaseSetup" />
</beans>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="org.hsqldb.jdbcDriver" p:url="jdbc:hsqldb:mem:transactional_tests" p:username="sa" p:password="" />
<bean id="txMgr" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:data-source-ref="dataSource" />
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.RollbackOverrideDefaultRollbackFalseTransactionalTests$DatabaseSetup" />
</beans>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 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-2.5.xsd">
<bean id="databaseSetup"
class="org.springframework.test.context.junit4.RollbackOverrideDefaultRollbackTrueTransactionalTests$DatabaseSetup" />
</beans>

View File

@@ -1 +0,0 @@
CREATE TABLE person (name VARCHAR(20) NOT NULL, PRIMARY KEY(name))

View File

@@ -1,6 +0,0 @@
DROP TABLE person IF EXISTS;
CREATE TABLE person (
name VARCHAR(20) NOT NULL,
PRIMARY KEY(name)
);

View File

@@ -4,8 +4,13 @@
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<jdbc:embedded-database id="dataSource" generate-name="true" type="HSQL" />
<jdbc:embedded-database id="dataSource2" generate-name="true" type="HSQL" />
<jdbc:embedded-database id="dataSource" generate-name="true">
<jdbc:script location="classpath:/org/springframework/test/jdbc/schema.sql"/>
</jdbc:embedded-database>
<jdbc:embedded-database id="dataSource2" generate-name="true">
<jdbc:script location="classpath:/org/springframework/test/jdbc/schema.sql"/>
</jdbc:embedded-database>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
p:dataSource-ref="dataSource" />

View File

@@ -18,8 +18,8 @@
p:data-source-ref="dataSource" />
<jdbc:embedded-database id="dataSource">
<jdbc:script location="classpath:/org/springframework/test/context/testng/schema.sql" />
<jdbc:script location="classpath:/org/springframework/test/context/testng/data.sql" />
<jdbc:script location="classpath:/org/springframework/test/jdbc/schema.sql" />
<jdbc:script location="classpath:/org/springframework/test/jdbc/data.sql" />
</jdbc:embedded-database>
</beans>

View File

@@ -1 +0,0 @@
INSERT INTO person VALUES('bob');

View File

@@ -1,4 +0,0 @@
CREATE TABLE person (
name VARCHAR(20) NOT NULL,
PRIMARY KEY(name)
);

View File

@@ -1,3 +1,5 @@
DROP TABLE person IF EXISTS;
CREATE TABLE person (
name VARCHAR(20) NOT NULL,
PRIMARY KEY(name)