OPEN - issue BATCH-1407: Integration tests for core (including multi-threaded long running tests)

This commit is contained in:
dsyer
2009-12-21 14:23:44 +00:00
parent 159a29216e
commit 644efc30a0
21 changed files with 648 additions and 546 deletions

View File

@@ -7,16 +7,11 @@ batch.jdbc.url=jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true
# batch.jdbc.url=jdbc:hsqldb:hsql://localhost:9005/samples
batch.jdbc.user=sa
batch.jdbc.password=
batch.schema=
batch.jndi.name=
batch.naming.factory.initial=
batch.naming.provider.url=
batch.schema.script=schema-hsqldb.sql
batch.drop.script=schema-drop-hsqldb.sql
batch.business.schema.script=business-schema-hsqldb.sql
batch.jdbc.testWhileIdle=false
batch.jdbc.validationQuery=
batch.schema.script=classpath:/org/springframework/batch/core/schema-hsqldb.sql
batch.business.schema.script=classpath:/business-schema-hsqldb.sql
batch.data.source.init=true
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
# Bean Properties for override
# when not using sequences:
incrementerParent.columnName=ID
batch.database.incrementer.parent=columnIncrementerParent
batch.grid.size=2

View File

@@ -1,65 +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:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
<!-- Initialise the database before every test case: -->
<bean id="dataSourceInitializer" class="test.jdbc.datasource.DataSourceInitializer">
<property name="dataSource" ref="dataSource"/>
<property name=""></property>
<property name="initScripts">
<list>
<value>${batch.drop.script}</value>
<value>${batch.schema.script}</value>
<value>${batch.business.schema.script}</value>
</list>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${batch.jdbc.driver}" />
<property name="url" value="${batch.jdbc.url}" />
<property name="username" value="${batch.jdbc.user}" />
<property name="password" value="${batch.jdbc.password}" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" lazy-init="true">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- Set up or detect a System property called "org.springframework.batch.support.SystemPropertyInitializer.ENVIRONMENT" used to construct a properties file on the classpath. The default is "hsql". -->
<bean id="environment"
class="org.springframework.batch.support.SystemPropertyInitializer">
<property name="defaultValue" value="hsql"/>
</bean>
<!-- Use this to set additional properties on beans at run time -->
<bean id="overrideProperties" class="org.springframework.beans.factory.config.PropertyOverrideConfigurer"
depends-on="environment">
<property name="location" value="classpath:batch-${org.springframework.batch.support.SystemPropertyInitializer.ENVIRONMENT}.properties" />
<!-- Allow system properties (-D) to override those from file -->
<property name="localOverride" value="true" />
<property name="properties">
<bean class="java.lang.System" factory-method="getProperties" />
</property>
<property name="ignoreInvalidKeys" value="true" />
<property name="order" value="2" />
</bean>
<bean id="placeholderProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
depends-on="environment">
<property name="location" value="classpath:batch-${org.springframework.batch.support.SystemPropertyInitializer.ENVIRONMENT}.properties" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="order" value="1" />
</bean>
<bean id="incrementerParent" class="${batch.database.incrementer.class}" abstract="true">
<property name="dataSource" ref="dataSource" />
<property name="incrementerName" value="ID" />
</bean>
<!--import resource="alt-data-source-context.xml" /-->
</beans>

View File

@@ -1,39 +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.xsd">
<!-- Initialise the database before every test case: -->
<bean id="dataSourceInitializer" class="com.springsource.batch.test.datasource.DataSourceInitializer">
<property name="initialize" value="${batch.data.source.init}" />
<property name="dataSource" ref="dataSource" />
<property name="initScripts">
<list>
<value>${batch.schema.script}</value>
<value>${batch.business.schema.script}
</value>
</list>
</property>
</bean>
<!--
Set up or detect a System property called "environment" used to
construct a properties file on the classpath. The default is
determined from the data source.
-->
<bean id="environment"
class="org.springframework.batch.support.SystemPropertyInitializer">
<property name="defaultValue" value="hsql"/>
</bean>
<!-- Use this to set additional properties on beans at run time -->
<bean id="placeholderProperties"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
depends-on="environment">
<property name="location"
value="classpath:batch-${org.springframework.batch.support.SystemPropertyInitializer.ENVIRONMENT}.properties" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="ignoreUnresolvablePlaceholders" value="false" />
<property name="order" value="1" />
</bean>
</beans>

View File

@@ -1,103 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config />
<bean class="org.springframework.batch.core.scope.StepScope" />
<bean id="simpleJob" class="org.springframework.batch.core.job.SimpleJob" abstract="true">
<property name="jobRepository" ref="jobRepository" />
<property name="restartable" value="true" />
</bean>
<bean id="taskletStep" class="org.springframework.batch.core.step.tasklet.TaskletStep" abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="jobRepository" ref="jobRepository" />
<property name="allowStartIfComplete" value="true" />
</bean>
<bean id="simpleStep" class="org.springframework.batch.core.step.item.SimpleStepFactoryBean" abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="jobRepository" ref="jobRepository" />
<property name="startLimit" value="100" />
<property name="commitInterval" value="1" />
</bean>
<bean id="skipLimitStep" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" parent="simpleStep"
abstract="true">
<property name="skipLimit" value="0" />
</bean>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
<property name="taskExecutor" ref="taskExecutor" />
</bean>
<bean id="poolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="2"></property>
<property name="maxPoolSize" value="20"></property>
</bean>
<bean id="taskExecutor" parent="poolTaskExecutor" />
<bean id="throttledTaskExecutor" class="com.springsource.batch.util.ThrottledTaskExecutor">
<property name="taskExecutor">
<bean parent="poolTaskExecutor" />
</property>
</bean>
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"
p:dataSource-ref="dataSource" p:transactionManager-ref="transactionManager" />
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean"
p:dataSource-ref="dataSource" />
<bean id="jobLoader" class="org.springframework.batch.core.configuration.support.ClassPathXmlJobLoader">
<property name="jobPaths" value="classpath*:/META-INF/batch/*-context.xml" />
<property name="jobRegistry" ref="jobRegistry"/>
</bean>
<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
<bean class="com.springsource.batch.service.JdbcSearchableJobExecutionDao">
<property name="dataSource" ref="dataSource" />
</bean>
<bean class="org.springframework.batch.core.repository.dao.JdbcExecutionContextDao">
<property name="jdbcTemplate">
<bean class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
<constructor-arg ref="dataSource" />
</bean>
</property>
</bean>
<bean class="com.springsource.batch.service.JdbcSearchableStepExecutionDao">
<property name="dataSource" ref="dataSource" />
</bean>
<bean class="com.springsource.batch.service.JdbcSearchableJobInstanceDao">
<property name="dataSource" ref="dataSource" />
</bean>
<bean class="com.springsource.batch.service.SimpleJobService" />
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="int[]" value="org.springframework.batch.support.IntArrayPropertyEditor" />
<entry key="double[]" value="org.springframework.batch.support.IntArrayPropertyEditor" />
<entry key="java.lang.Class[]" value="org.springframework.beans.propertyeditors.ClassArrayEditor" />
<entry key="org.springframework.batch.item.file.transform.Range[]" value="org.springframework.batch.item.file.transform.RangeArrayPropertyEditor" />
<!--
entry key="java.util.Date"> <bean class="org.springframework.beans.propertyeditors.CustomDateEditor">
<constructor-arg> <bean class="java.text.SimpleDateFormat"> <constructor-arg value="yyyyMMdd" /> </bean>
</constructor-arg> <constructor-arg value="false" /> </bean> </entry
-->
</map>
</property>
</bean>
</beans>

View File

@@ -1,6 +0,0 @@
DROP TABLE T_FOOS;
create table T_FOOS (
id integer not null primary key,
name varchar(80),
foo_date timestamp
);