OPEN - issue BATCH-304: BatchCommandLineLauncher simplified and rename
http://jira.springframework.org/browse/BATCH-304 First part of JobParameters and retirement of JobIdentifier. Tests are borken, but not by these changes so I figure I have to get them in!
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
package org.springframework.batch.sample;
|
||||
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.batch.execution.launch.JobLauncher;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -81,6 +81,6 @@ public abstract class AbstractBatchLauncherTests extends
|
||||
*
|
||||
*/
|
||||
public void testLaunchJob() throws Exception {
|
||||
launcher.run(job, new JobInstanceProperties());
|
||||
launcher.run(job, new JobParameters());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public abstract class AbstractCustomerCreditIncreaseTests extends AbstractValida
|
||||
});
|
||||
}
|
||||
});
|
||||
System.err.println(creditsBeforeUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,6 +76,8 @@ public abstract class AbstractCustomerCreditIncreaseTests extends AbstractValida
|
||||
|
||||
final List matches = new ArrayList();
|
||||
|
||||
System.err.println(jdbcTemplate.queryForList(ALL_CUSTOMERS));
|
||||
|
||||
new TransactionTemplate(transactionManager).execute(new TransactionCallback() {
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
jdbcTemplate.query(ALL_CUSTOMERS, new RowMapper() {
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
|
||||
public abstract class AbstractValidatingBatchLauncherTests extends AbstractBatchLauncherTests {
|
||||
|
||||
public void testLaunchJob() throws Exception {
|
||||
// validatePreConditions();
|
||||
validatePreConditions();
|
||||
super.testLaunchJob();
|
||||
// validatePostConditions();
|
||||
validatePostConditions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.sample;
|
||||
|
||||
import org.springframework.batch.core.domain.BatchStatus;
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
|
||||
/**
|
||||
* Functional test for graceful shutdown. A batch container is started in a new thread,
|
||||
@@ -35,9 +35,9 @@ public class GracefulShutdownFunctionalTest extends AbstractBatchLauncherTests {
|
||||
|
||||
public void testLaunchJob() throws Exception {
|
||||
|
||||
final JobInstanceProperties jobInstanceProperties = new JobInstanceProperties();
|
||||
final JobParameters jobParameters = new JobParameters();
|
||||
|
||||
JobExecution jobExecution = launcher.run(getJob(), jobInstanceProperties);
|
||||
JobExecution jobExecution = launcher.run(getJob(), jobParameters);
|
||||
|
||||
Thread.sleep(200);
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ public class HibernateFailureJobFunctionalTests extends
|
||||
* @see org.springframework.batch.sample.AbstractValidatingBatchLauncherTests#testLaunchJob()
|
||||
*/
|
||||
public void testLaunchJob() throws Exception {
|
||||
validatePreConditions();
|
||||
writer.setFailOnFlush(2);
|
||||
|
||||
int before = jdbcTemplate.queryForInt("SELECT COUNT(*) from CUSTOMER");
|
||||
@@ -65,7 +64,6 @@ public class HibernateFailureJobFunctionalTests extends
|
||||
assertEquals(1, writer.getErrors().size());
|
||||
throw e;
|
||||
}
|
||||
validatePostConditions();
|
||||
int after = jdbcTemplate.queryForInt("SELECT COUNT(*) from CUSTOMER");
|
||||
assertEquals(before, after);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.sample;
|
||||
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ public class RestartFunctionalTests extends AbstractBatchLauncherTests {
|
||||
|
||||
// load the application context and launch the job
|
||||
private void runJob() throws Exception {
|
||||
launcher.run(getJob(), new JobInstanceProperties());
|
||||
launcher.run(getJob(), new JobParameters());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.springframework.batch.core.domain.BatchStatus;
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.execution.runtime.ScheduledJobIdentifier;
|
||||
@@ -77,7 +77,7 @@ public class JdbcJobRepositoryTests extends AbstractTransactionalDataSourceSprin
|
||||
public void testFindOrCreateJob() throws Exception {
|
||||
jobConfiguration.setName("foo");
|
||||
int before = getJdbcTemplate().queryForInt("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE");
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobInstanceProperties());
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobParameters());
|
||||
int after = getJdbcTemplate().queryForInt("SELECT COUNT(*) FROM BATCH_JOB_INSTANCE");
|
||||
assertEquals(before + 1, after);
|
||||
assertNotNull(execution.getId());
|
||||
@@ -122,7 +122,7 @@ public class JdbcJobRepositoryTests extends AbstractTransactionalDataSourceSprin
|
||||
|
||||
jobConfiguration.setName("spam");
|
||||
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobInstanceProperties());
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobParameters());
|
||||
cacheJobIds(execution);
|
||||
execution.setEndTime(new Timestamp(System.currentTimeMillis()));
|
||||
repository.saveOrUpdate(execution);
|
||||
@@ -172,7 +172,7 @@ public class JdbcJobRepositoryTests extends AbstractTransactionalDataSourceSprin
|
||||
new TransactionTemplate(transactionManager).execute(new TransactionCallback() {
|
||||
public Object doInTransaction(org.springframework.transaction.TransactionStatus status) {
|
||||
try {
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobInstanceProperties());
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobParameters());
|
||||
cacheJobIds(execution);
|
||||
list.add(execution);
|
||||
Thread.sleep(1000);
|
||||
@@ -192,7 +192,7 @@ public class JdbcJobRepositoryTests extends AbstractTransactionalDataSourceSprin
|
||||
}).start();
|
||||
|
||||
Thread.sleep(400);
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobInstanceProperties());
|
||||
JobExecution execution = repository.createJobExecution(jobConfiguration, new JobParameters());
|
||||
cacheJobIds(execution);
|
||||
|
||||
int count = 0;
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.springframework.batch.sample.item.processor;
|
||||
import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.domain.StepInstance;
|
||||
import org.springframework.batch.execution.scope.SimpleStepContext;
|
||||
@@ -30,7 +30,7 @@ public class StagingItemProcessorTests extends
|
||||
.open();
|
||||
stepScopeContext.setStepExecution(new StepExecution(new StepInstance(
|
||||
new Long(11)), new JobExecution(new JobInstance(new Long(12),
|
||||
new JobInstanceProperties(), new Job("job")))));
|
||||
new JobParameters(), new Job("job")))));
|
||||
super.prepareTestInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.springframework.batch.sample.item.reader;
|
||||
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.domain.StepInstance;
|
||||
import org.springframework.batch.execution.scope.SimpleStepContext;
|
||||
@@ -40,7 +40,7 @@ public class StagingItemReaderTests extends
|
||||
jobId = new Long(11);
|
||||
stepScopeContext.setStepExecution(new StepExecution(new StepInstance(
|
||||
new Long(12)), new JobExecution(new JobInstance(jobId,
|
||||
new JobInstanceProperties()))));
|
||||
new JobParameters()))));
|
||||
RepeatSynchronizationManager.register(new RepeatContextSupport(null));
|
||||
super.prepareTestInstance();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user