BATCH-1344: JobRunnerTestUtils -> JobLauncherTestUtils
This commit is contained in:
@@ -18,7 +18,7 @@ package org.springframework.batch.sample;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -29,12 +29,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
public class BeanWrapperMapperSampleJobFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testJobLaunch() throws Exception {
|
||||
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.trade.Trade;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
@@ -38,7 +38,7 @@ public class CompositeItemWriterSampleFunctionalTests {
|
||||
private SimpleJdbcTemplate simpleJdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
@@ -51,7 +51,7 @@ public class CompositeItemWriterSampleFunctionalTests {
|
||||
simpleJdbcTemplate.update("DELETE from TRADE");
|
||||
int before = simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from TRADE");
|
||||
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
|
||||
checkOutputFile("target/test-outputs/CustomerReport1.txt");
|
||||
checkOutputFile("target/test-outputs/CustomerReport2.txt");
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
@@ -52,7 +52,7 @@ public class CustomerFilterJobFunctionalTests {
|
||||
private Map<String, Double> credits = new HashMap<String, Double>();
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
@@ -79,7 +79,7 @@ public class CustomerFilterJobFunctionalTests {
|
||||
@Test
|
||||
public void testFilterJob() throws Exception {
|
||||
|
||||
JobExecution jobExecution = jobRunnerUtils.launchJob();
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
|
||||
|
||||
customers = Arrays.asList(new Customer("customer1", (credits.get("customer1"))), new Customer("customer2",
|
||||
(credits.get("customer2"))), new Customer("customer3", 100500), new Customer("customer4", credits
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.launch.JobOperator;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -51,12 +51,12 @@ public class DatabaseShutdownFunctionalTests {
|
||||
private JobOperator jobOperator;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
|
||||
JobExecution jobExecution = jobRunnerUtils.launchJob();
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.person.PersonService;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -16,7 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
public class DelegatingJobFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
private PersonService personService;
|
||||
@@ -24,7 +24,7 @@ public class DelegatingJobFunctionalTests {
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
|
||||
assertTrue(personService.getReturnedCount() > 0);
|
||||
assertEquals(personService.getReturnedCount(), personService.getReceivedCount());
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -17,7 +17,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
public class FootballJobFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
private SimpleJdbcTemplate simpleJdbcTemplate;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class FootballJobFunctionalTests {
|
||||
simpleJdbcTemplate.update("DELETE FROM GAMES");
|
||||
simpleJdbcTemplate.update("DELETE FROM PLAYER_SUMMARY");
|
||||
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
|
||||
int count = simpleJdbcTemplate.queryForInt("SELECT COUNT(*) from PLAYER_SUMMARY");
|
||||
assertTrue(count > 0);
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -48,7 +48,7 @@ public class GracefulShutdownFunctionalTests {
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
@@ -56,7 +56,7 @@ public class GracefulShutdownFunctionalTests {
|
||||
final JobParameters jobParameters = new JobParametersBuilder().addLong("timestamp", System.currentTimeMillis())
|
||||
.toJobParameters();
|
||||
|
||||
JobExecution jobExecution = jobRunnerUtils.launchJob(jobParameters);
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob(jobParameters);
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -37,7 +37,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
public class GroovyJobFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Before
|
||||
public void removeOldData() throws IOException {
|
||||
@@ -47,7 +47,7 @@ public class GroovyJobFunctionalTests {
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
assertFalse(new File("target/groovyJob/output/files.zip").exists());
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
assertTrue(new File("target/groovyJob/output/files.zip").exists());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.FileReader;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -27,11 +27,11 @@ public class HeaderFooterSampleFunctionalTests {
|
||||
private Resource output;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testJob() throws Exception {
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
|
||||
BufferedReader inputReader = new BufferedReader(new FileReader(input.getFile()));
|
||||
BufferedReader outputReader = new BufferedReader(new FileReader(output.getFile()));
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor;
|
||||
import org.springframework.batch.sample.domain.trade.internal.HibernateCreditDao;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.UncategorizedSQLException;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
@@ -67,7 +67,7 @@ public class HibernateFailureJobFunctionalTests {
|
||||
private List<BigDecimal> creditsBeforeUpdate;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
@@ -88,7 +88,7 @@ public class HibernateFailureJobFunctionalTests {
|
||||
writer.setFailOnFlush(2);
|
||||
|
||||
try {
|
||||
jobRunnerUtils.launchJob(params);
|
||||
jobLauncherTestUtils.launchJob(params);
|
||||
} catch (HibernateJdbcException e) {
|
||||
// This is what would happen if the flush happened outside the
|
||||
// RepeatContext:
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.converter.DefaultJobParametersConverter;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -40,7 +40,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
public class JobStepFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
// auto-injected attributes
|
||||
private SimpleJdbcTemplate simpleJdbcTemplate;
|
||||
@@ -55,7 +55,7 @@ public class JobStepFunctionalTests {
|
||||
|
||||
simpleJdbcTemplate.update("DELETE FROM TRADE");
|
||||
|
||||
jobRunnerUtils.launchJob(new DefaultJobParametersConverter()
|
||||
jobLauncherTestUtils.launchJob(new DefaultJobParametersConverter()
|
||||
.getJobParameters(PropertiesConverter
|
||||
.stringToProperties("run.id(long)=1,parameter=true,run.date=20070122,input.file=classpath:data/fixedLengthImportJob/input/20070122.teststream.ImportTradeDataStep.txt")));
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.trade.internal.ItemTrackingTradeItemWriter;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -40,11 +40,11 @@ public class LoopFlowSampleFunctionalTests {
|
||||
private ItemTrackingTradeItemWriter itemWriter;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testJobLaunch() throws Exception {
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
// items processed = items read + 2 exceptions
|
||||
assertEquals(10, itemWriter.getItems().size());
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.StringUtils;
|
||||
public class MultilineJobFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
// The output is grouped together in two lines, instead of all the
|
||||
// trades coming out on a single line.
|
||||
@@ -46,7 +46,7 @@ public class MultilineJobFunctionalTests {
|
||||
|
||||
@Test
|
||||
public void testJobLaunch() throws Exception {
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
assertEquals(EXPECTED_RESULT, StringUtils.replace(IOUtils.toString(output.getInputStream()), System
|
||||
.getProperty("line.separator"), ""));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import static org.springframework.batch.test.AssertFile.assertFileEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
@@ -36,11 +36,11 @@ public class MultilineOrderJobFunctionalTests {
|
||||
private static final String EXPECTED = "data/multilineOrderJob/result/multilineOrderOutput.txt";
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testJobLaunch() throws Exception {
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
assertFileEquals(new ClassPathResource(EXPECTED), new FileSystemResource(ACTUAL));
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -52,7 +52,7 @@ public class PartitionFileJobFunctionalTests implements ApplicationContextAware
|
||||
private ItemReader<CustomerCredit> inputReader;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class PartitionFileJobFunctionalTests implements ApplicationContextAware
|
||||
List<CustomerCredit> inputs = new ArrayList<CustomerCredit>(getCredits(inputReader));
|
||||
close(inputReader);
|
||||
|
||||
JobExecution jobExecution = jobRunnerUtils.launchJob();
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
|
||||
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -52,7 +52,7 @@ public class PartitionJdbcJobFunctionalTests implements ApplicationContextAware
|
||||
private ItemReader<CustomerCredit> inputReader;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class PartitionJdbcJobFunctionalTests implements ApplicationContextAware
|
||||
List<CustomerCredit> inputs = new ArrayList<CustomerCredit>(getCredits(inputReader));
|
||||
close(inputReader);
|
||||
|
||||
JobExecution jobExecution = jobRunnerUtils.launchJob();
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob();
|
||||
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.item.file.FlatFileItemWriter;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.test.AssertFile;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -47,17 +47,17 @@ public class RestartFileSampleFunctionalTests {
|
||||
private Resource outputResource;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void runTest() throws Exception {
|
||||
JobParameters jobParameters = jobRunnerUtils.getUniqueJobParameters();
|
||||
JobParameters jobParameters = jobLauncherTestUtils.getUniqueJobParameters();
|
||||
|
||||
JobExecution je1 = jobRunnerUtils.launchJob(jobParameters);
|
||||
JobExecution je1 = jobLauncherTestUtils.launchJob(jobParameters);
|
||||
assertEquals(BatchStatus.FAILED, je1.getStatus());
|
||||
AssertFile.assertLineCount(10, outputResource);
|
||||
|
||||
JobExecution je2 = jobRunnerUtils.launchJob(jobParameters);
|
||||
JobExecution je2 = jobLauncherTestUtils.launchJob(jobParameters);
|
||||
assertEquals(BatchStatus.COMPLETED, je2.getStatus());
|
||||
AssertFile.assertLineCount(20, outputResource);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.converter.DefaultJobParametersConverter;
|
||||
import org.springframework.batch.support.PropertiesConverter;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -45,7 +45,7 @@ import org.springframework.test.context.transaction.BeforeTransaction;
|
||||
public class RestartFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
// auto-injected attributes
|
||||
private SimpleJdbcTemplate simpleJdbcTemplate;
|
||||
@@ -99,7 +99,7 @@ public class RestartFunctionalTests {
|
||||
|
||||
// load the application context and launch the job
|
||||
private JobExecution runJobForRestartTest() throws Exception {
|
||||
return jobRunnerUtils
|
||||
return jobLauncherTestUtils
|
||||
.launchJob(new DefaultJobParametersConverter()
|
||||
.getJobParameters(PropertiesConverter
|
||||
.stringToProperties("run.id(long)=1,parameter=true,run.date=20070122,input.file=classpath:data/fixedLengthImportJob/input/20070122.teststream.ImportTradeDataStep.txt")));
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.trade.internal.GeneratingTradeItemReader;
|
||||
import org.springframework.batch.sample.support.RetrySampleItemWriter;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -28,11 +28,11 @@ public class RetrySampleFunctionalTests {
|
||||
private RetrySampleItemWriter<?> itemProcessor;
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
//items processed = items read + 2 exceptions
|
||||
assertEquals(itemGenerator.getLimit()+2, itemProcessor.getCounter());
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -34,11 +34,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
public class TaskletJobFunctionalTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
JobExecution jobExecution = jobRunnerUtils.launchJob(new JobParametersBuilder().addString("value", "foo")
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob(new JobParametersBuilder().addString("value", "foo")
|
||||
.toJobParameters());
|
||||
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.sample.domain.trade.Trade;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
@@ -57,7 +57,7 @@ public class TradeJobFunctionalTests {
|
||||
private Map<String, Double> credits = new HashMap<String, Double>();
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
public void setDataSource(DataSource dataSource) {
|
||||
@@ -81,7 +81,7 @@ public class TradeJobFunctionalTests {
|
||||
@Test
|
||||
public void testLaunchJob() throws Exception {
|
||||
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
|
||||
customers = Arrays.asList(new Customer("customer1", (credits.get("customer1") - 98.34)),
|
||||
new Customer("customer2", (credits.get("customer2") - 18.12 - 12.78)),
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.batch.sample.domain.trade.CustomerCredit;
|
||||
import org.springframework.batch.sample.domain.trade.internal.CustomerCreditIncreaseProcessor;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
public abstract class AbstractIoSampleTests {
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
@Autowired
|
||||
private ItemReader<CustomerCredit> reader;
|
||||
@@ -46,7 +46,7 @@ public abstract class AbstractIoSampleTests {
|
||||
List<CustomerCredit> inputs = getCredits(reader);
|
||||
close(reader);
|
||||
|
||||
JobExecution jobExecution = jobRunnerUtils.launchJob(getUniqueJobParameters());
|
||||
JobExecution jobExecution = jobLauncherTestUtils.launchJob(getUniqueJobParameters());
|
||||
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
|
||||
|
||||
pointReaderToOutput(reader);
|
||||
@@ -66,7 +66,7 @@ public abstract class AbstractIoSampleTests {
|
||||
}
|
||||
|
||||
protected JobParameters getUniqueJobParameters() {
|
||||
return jobRunnerUtils.getUniqueJobParameters();
|
||||
return jobLauncherTestUtils.getUniqueJobParameters();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.batch.sample.iosample;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.AssertFile;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -39,14 +39,14 @@ public class MultiLineFunctionalTests {
|
||||
private static final String INPUT_FILE = "src/main/resources/data/iosample/input/multiLine.txt";
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
/**
|
||||
* Output should be the same as input
|
||||
*/
|
||||
@Test
|
||||
public void testJob() throws Exception {
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
AssertFile.assertFileEquals(new FileSystemResource(INPUT_FILE), new FileSystemResource(OUTPUT_FILE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.batch.sample.iosample;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.batch.test.AssertFile;
|
||||
import org.springframework.batch.test.JobRunnerTestUtils;
|
||||
import org.springframework.batch.test.JobLauncherTestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -39,14 +39,14 @@ public class MultiRecordTypeFunctionalTests {
|
||||
private static final String INPUT_FILE = "src/main/resources/data/iosample/input/multiRecordType.txt";
|
||||
|
||||
@Autowired
|
||||
private JobRunnerTestUtils jobRunnerUtils;
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
/**
|
||||
* Output should be the same as input
|
||||
*/
|
||||
@Test
|
||||
public void testJob() throws Exception {
|
||||
jobRunnerUtils.launchJob();
|
||||
jobLauncherTestUtils.launchJob();
|
||||
AssertFile.assertFileEquals(new FileSystemResource(INPUT_FILE), new FileSystemResource(OUTPUT_FILE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<context:annotation-config/>
|
||||
<bean class="org.springframework.batch.test.JobRunnerTestUtils"/>
|
||||
<bean class="org.springframework.batch.test.JobLauncherTestUtils"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<import resource="classpath:/simple-job-launcher-context.xml" />
|
||||
<import resource="classpath:/jobs/jobStepSample.xml" />
|
||||
|
||||
<bean class="org.springframework.batch.test.JobRunnerTestUtils">
|
||||
<bean class="org.springframework.batch.test.JobLauncherTestUtils">
|
||||
<property name="job" ref="jobStepJob"/>
|
||||
</bean>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user