Re-organise parallel job to run quicker (not football job any more).

This commit is contained in:
dsyer
2007-12-20 08:55:18 +00:00
parent 6ad57bcb69
commit a29f0f83e8
7 changed files with 242 additions and 306 deletions

View File

@@ -2,7 +2,6 @@ package org.springframework.batch.sample;
import javax.sql.DataSource;
import org.springframework.batch.sample.item.processor.StagingItemProcessor;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -16,21 +15,12 @@ public class FootballJobFunctionalTests extends
}
protected String[] getConfigLocations() {
return new String[] { "jobs/parallelJob.xml##" };
return new String[] { "jobs/footballJob.xml##" };
}
protected void validatePostConditions() throws Exception {
int count;
count = jdbcTemplate.queryForInt(
"SELECT COUNT(*) from BATCH_STAGING where PROCESSED=?",
new Object[] {StagingItemProcessor.NEW});
assertEquals(0, count);
int total = jdbcTemplate.queryForInt(
"SELECT COUNT(*) from BATCH_STAGING");
count = jdbcTemplate.queryForInt(
"SELECT COUNT(*) from BATCH_STAGING where PROCESSED=?",
new Object[] {StagingItemProcessor.DONE});
assertEquals(total, count);
int count = jdbcTemplate.queryForInt("SELECT COUNT(*) from PLAYER_SUMMARY");
assertTrue(count>0);
}
}

View File

@@ -0,0 +1,36 @@
package org.springframework.batch.sample;
import javax.sql.DataSource;
import org.springframework.batch.sample.item.processor.StagingItemProcessor;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
public class ParallelJobFunctionalTests extends
AbstractValidatingBatchLauncherTests {
private JdbcOperations jdbcTemplate;
public void setDataSource(DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
protected String[] getConfigLocations() {
return new String[] { "jobs/parallelJob.xml" };
}
protected void validatePostConditions() throws Exception {
int count;
count = jdbcTemplate.queryForInt(
"SELECT COUNT(*) from BATCH_STAGING where PROCESSED=?",
new Object[] {StagingItemProcessor.NEW});
assertEquals(0, count);
int total = jdbcTemplate.queryForInt(
"SELECT COUNT(*) from BATCH_STAGING");
count = jdbcTemplate.queryForInt(
"SELECT COUNT(*) from BATCH_STAGING where PROCESSED=?",
new Object[] {StagingItemProcessor.DONE});
assertEquals(total, count);
}
}