<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:b="http://www.springframework.org/schema/batch"
  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/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
  <import resource="baseContext.xml"/>

  <b:job id="taskletJob">
    <b:step id="step">
      <b:tasklet ref="testTasklet"/>
    </b:step>
  </b:job>

  <b:job id="itemsAndTaskletJob">
    <b:step id="itemStep">
      <b:tasklet>
        <b:chunk commit-interval="5" reader="itemReader" processor="itemProcessor"
          writer="itemWriter"/>
      </b:tasklet>
      <b:next on="*" to="taskletStep"/>
    </b:step>
    <b:step id="taskletStep">
      <b:tasklet ref="testTasklet"/>
    </b:step>
  </b:job>

  <b:job id="parallelItemsJob">
    <b:step id="parallelItemsStep">
      <b:tasklet task-executor="asyncTaskExecutor" throttle-limit="2">
        <b:chunk commit-interval="2" reader="syncItemReader" processor="itemProcessor"
          writer="itemWriter"/>
      </b:tasklet>
    </b:step>
  </b:job>

  <b:job id="flowJob">
    <b:flow id="flow" parent="parentFlow"/>
  </b:job>
  <b:flow id="parentFlow">
    <b:step id="flowStep1" next="flowStep2">
      <b:tasklet ref="testTasklet"/>
    </b:step>
    <b:step id="flowStep2">
      <b:tasklet ref="testTasklet"/>
    </b:step>
  </b:flow>

  <b:job id="splitJob">
    <b:split id="split" task-executor="asyncTaskExecutor">
      <b:flow>
        <b:step id="splitFlowStep1">
          <b:tasklet ref="testTasklet"/>
        </b:step>
      </b:flow>
      <b:flow>
        <b:step id="splitFlowStep2">
          <b:tasklet ref="testTasklet"/>
        </b:step>
      </b:flow>
    </b:split>
  </b:job>

  <b:job id="decisionJob">
    <b:step id="decisionStepStart" next="decision">
      <b:tasklet ref="testTasklet"/>
    </b:step>
    <b:decision id="decision" decider="testDecider">
      <b:next on="LEFT" to="decisionStepLeft"/>
      <b:next on="RIGHT" to="decisionStepRight"/>
    </b:decision>
    <b:step id="decisionStepLeft">
      <b:tasklet ref="testTasklet"/>
    </b:step>
    <b:step id="decisionStepRight">
      <b:tasklet ref="testTasklet"/>
    </b:step>
  </b:job>

  <b:job id="partitionedJob">
    <b:step id="partitionManagerStep">
      <b:partition step="partitionWorkerStep" partitioner="testPartitioner">
        <b:handler task-executor="asyncTaskExecutor" grid-size="2"/>
      </b:partition>
    </b:step>
  </b:job>
  <b:step id="partitionWorkerStep">
    <b:tasklet>
      <b:chunk commit-interval="5" reader="testPartitionedItemReader" processor="itemProcessor"
        writer="itemWriter"/>
    </b:tasklet>
  </b:step>
  <bean id="testPartitioner" class="springbatch.TestPartitioner"/>
  <bean id="testPartitionedItemReader" class="springbatch.TestPartitionedItemReader"/>

  <bean id="itemReader" class="springbatch.TestItemReader"/>
  <bean id="syncItemReader" class="springbatch.TestSyncItemReader">
    <constructor-arg name="max" value="5"/>
  </bean>
  <bean id="itemProcessor" class="springbatch.TestItemProcessor"/>
  <bean id="itemWriter" class="springbatch.TestItemWriter"/>
  <bean id="testTasklet" class="springbatch.TestTasklet"/>
  <bean id="testDecider" class="springbatch.TestDecider"/>
</beans>