IN PROGRESS - BATCH-571: Remove reference to Step from StepExecution

step reference replaced with stepName string
This commit is contained in:
robokaso
2008-04-28 11:41:31 +00:00
parent 8b8c65ae50
commit 6ca877c1d9
23 changed files with 110 additions and 111 deletions

View File

@@ -33,10 +33,10 @@ import org.springframework.batch.support.PropertiesConverter;
*/
public class StepExecutionTests extends TestCase {
private StepExecution execution = newStepExecution(new StepSupport("stepName"),
new Long(23));
private StepExecution execution = newStepExecution(new StepSupport("stepName"), new Long(23));
private StepExecution blankExecution = new StepExecution("blank", new JobExecution());
private StepExecution blankExecution = new StepExecution(new StepSupport("blank"), new JobExecution());
/**
* Test method for
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
@@ -50,7 +50,7 @@ public class StepExecutionTests extends TestCase {
* {@link org.springframework.batch.core.JobExecution#JobExecution()}.
*/
public void testStepExecutionWithNullId() {
assertNull(new StepExecution(new StepSupport("stepName"), new JobExecution()).getId());
assertNull(new StepExecution("stepName", new JobExecution()).getId());
}
/**
@@ -118,34 +118,37 @@ public class StepExecutionTests extends TestCase {
execution.setItemCount(123);
assertEquals(123, execution.getItemCount().intValue());
}
public void testGetJobExecution() throws Exception {
assertNotNull(execution.getJobExecution());
}
public void testApplyContribution() throws Exception {
StepContribution contribution = execution.createStepContribution();
contribution.incrementCommitCount();
execution.apply(contribution);
assertEquals(new Integer(1), execution.getCommitCount());
}
public void testTerminateOnly() throws Exception {
assertFalse(execution.isTerminateOnly());
execution.setTerminateOnly();
assertTrue(execution.isTerminateOnly());
}
public void testToStringWithNullName() throws Exception {
String value = new StepExecution(new StepSupport(null), new JobExecution()).toString();
assertTrue("Should contain name=null: "+value, value.indexOf("name=null")>=0);
public void testNullNameIsIllegal() throws Exception {
try {
new StepExecution(null, new JobExecution());
fail();
}
catch (IllegalArgumentException e) {
// expected
}
}
public void testToString() throws Exception {
assertTrue("Should contain item count: " + execution.toString(),
execution.toString().indexOf("item") >= 0);
assertTrue("Should contain commit count: " + execution.toString(),
execution.toString().indexOf("commit") >= 0);
assertTrue("Should contain item count: " + execution.toString(), execution.toString().indexOf("item") >= 0);
assertTrue("Should contain commit count: " + execution.toString(), execution.toString().indexOf("commit") >= 0);
assertTrue("Should contain rollback count: " + execution.toString(),
execution.toString().indexOf("rollback") >= 0);
}
@@ -154,7 +157,7 @@ public class StepExecutionTests extends TestCase {
assertNotNull(execution.getExecutionContext());
ExecutionContext context = new ExecutionContext();
context.putString("foo", "bar");
execution.setExecutionContext(context );
execution.setExecutionContext(context);
assertEquals("bar", execution.getExecutionContext().getString("foo"));
}
@@ -204,14 +207,12 @@ public class StepExecutionTests extends TestCase {
}
public void testHashCode() throws Exception {
assertTrue("Hash code same as parent", new Entity(execution.getId())
.hashCode() != execution.hashCode());
assertTrue("Hash code same as parent", new Entity(execution.getId()).hashCode() != execution.hashCode());
}
public void testHashCodeWithNullIds() throws Exception {
assertTrue("Hash code not same as parent",
new Entity(execution.getId()).hashCode() != blankExecution
.hashCode());
assertTrue("Hash code not same as parent", new Entity(execution.getId()).hashCode() != blankExecution
.hashCode());
}
public void testHashCodeViaHashSet() throws Exception {
@@ -224,7 +225,7 @@ public class StepExecutionTests extends TestCase {
private StepExecution newStepExecution(Step step, Long long2) {
JobInstance job = new JobInstance(new Long(3), new JobParameters(), new JobSupport("testJob"));
StepExecution execution = new StepExecution(step, new JobExecution(job, long2), new Long(4));
StepExecution execution = new StepExecution(step.getName(), new JobExecution(job, long2), new Long(4));
return execution;
}

View File

@@ -115,8 +115,8 @@ public class SimpleJobTests extends TestCase {
jobExecution = jobRepository.createJobExecution(job, jobParameters);
jobInstance = jobExecution.getJobInstance();
stepExecution1 = new StepExecution(step1, jobExecution, null);
stepExecution2 = new StepExecution(step2, jobExecution, null);
stepExecution1 = new StepExecution(step1.getName(), jobExecution, null);
stepExecution2 = new StepExecution(step2.getName(), jobExecution, null);
}

View File

@@ -22,9 +22,6 @@ import junit.framework.TestCase;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepExecutionListener;
import org.springframework.batch.core.listener.CompositeStepExecutionListener;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.step.StepSupport;
import org.springframework.batch.repeat.ExitStatus;
/**
@@ -82,7 +79,7 @@ public class CompositeStepExecutionListenerTests extends TestCase {
list.add("foo");
}
});
listener.beforeStep(new StepExecution(new StepSupport("foo"), null));
listener.beforeStep(new StepExecution("foo", null));
assertEquals(1, list.size());
}

View File

@@ -94,7 +94,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
jobExecution = new JobExecution(jobInstance);
jobExecutionDao.saveJobExecution(jobExecution);
stepExecution = new StepExecution(step1, jobExecution, new Long(1));
stepExecution = new StepExecution(step1.getName(), jobExecution, new Long(1));
stepExecution.setStatus(BatchStatus.STARTED);
stepExecution.setStartTime(new Date(System.currentTimeMillis()));
stepExecutionDao.saveStepExecution(stepExecution);
@@ -122,7 +122,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
}
public void testSaveStepExecution() {
StepExecution execution = new StepExecution(step2, jobExecution, null);
StepExecution execution = new StepExecution(step2.getName(), jobExecution, null);
execution.setStatus(BatchStatus.STARTED);
execution.setStartTime(new Date(System.currentTimeMillis()));
execution.setExitStatus(ExitStatus.FAILED.addExitDescription("java.lang.Exception"));
@@ -134,7 +134,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
}
public void testSaveStepExecutionAndExecutionContext() {
StepExecution execution = new StepExecution(step2, jobExecution, null);
StepExecution execution = new StepExecution(step2.getName(), jobExecution, null);
execution.setStatus(BatchStatus.STARTED);
execution.setStartTime(new Date(System.currentTimeMillis()));
execution.setExecutionContext(executionContext);
@@ -165,7 +165,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
}
public void testUpdateStepExecutionWithNullId() {
StepExecution stepExecution = new StepExecution(new StepSupport("testStep"), null, null);
StepExecution stepExecution = new StepExecution("testStep", null, null);
try {
stepExecutionDao.updateStepExecution(stepExecution);
fail("Expected IllegalArgumentException");

View File

@@ -67,7 +67,7 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
jobExecution = repository.createJobExecution(new JobSupport("testJob"), new JobParameters());
jobInstance = jobExecution.getJobInstance();
step = new StepSupport("foo");
stepExecution = new StepExecution(step, jobExecution);
stepExecution = new StepExecution(step.getName(), jobExecution);
dao = getStepExecutionDao();
}
@@ -179,10 +179,10 @@ public abstract class AbstractStepExecutionDaoTests extends AbstractTransactiona
public void testConcurrentModificationException() {
step = new StepSupport("foo");
StepExecution exec1 = new StepExecution(step, jobExecution);
StepExecution exec1 = new StepExecution(step.getName(), jobExecution);
dao.saveStepExecution(exec1);
StepExecution exec2 = new StepExecution(step, jobExecution);
StepExecution exec2 = new StepExecution(step.getName(), jobExecution);
exec2.setId(exec1.getId());
exec2.incrementVersion();

View File

@@ -126,7 +126,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
// first execution
JobExecution firstJobExec = jobRepository.createJobExecution(job, jobParameters);
StepExecution firstStepExec = new StepExecution(step, firstJobExec);
StepExecution firstStepExec = new StepExecution(step.getName(), firstJobExec);
jobRepository.saveOrUpdate(firstJobExec);
jobRepository.saveOrUpdate(firstStepExec);
@@ -145,7 +145,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
// second execution
JobExecution secondJobExec = jobRepository.createJobExecution(job, jobParameters);
StepExecution secondStepExec = new StepExecution(step, secondJobExec);
StepExecution secondStepExec = new StepExecution(step.getName(), secondJobExec);
jobRepository.saveOrUpdate(secondJobExec);
jobRepository.saveOrUpdate(secondStepExec);
@@ -164,7 +164,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
};
JobExecution jobExec = jobRepository.createJobExecution(job, jobParameters);
Step step = new StepSupport("step1");
StepExecution stepExec = new StepExecution(step, jobExec);
StepExecution stepExec = new StepExecution(step.getName(), jobExec);
stepExec.setExecutionContext(ctx);
jobRepository.saveOrUpdate(stepExec);

View File

@@ -143,7 +143,7 @@ public class SimpleJobRepositoryTests extends TestCase {
public void testSaveOrUpdateStepExecutionException() {
StepExecution stepExecution = new StepExecution(new StepSupport("stepName"), null, null);
StepExecution stepExecution = new StepExecution("stepName", null, null);
// failure scenario -- no step id set.
try {

View File

@@ -9,7 +9,6 @@ import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.SimpleJob;
import org.springframework.batch.core.step.tasklet.TaskletStep;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.database.JdbcCursorItemReader;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -37,7 +36,7 @@ public class JdbcCursorItemReaderPreparedStatementIntegrationTests extends
JobParameters jobParameters = new JobParametersBuilder().addLong("begin.id", new Long(1)).addLong("end.id", new Long(4)).toJobParameters();
JobInstance jobInstance = new JobInstance(new Long(1), jobParameters, new SimpleJob());
JobExecution jobExecution = new JobExecution(jobInstance, new Long(2));
StepExecution stepExecution = new StepExecution(new TaskletStep(), jobExecution, new Long(3) );
StepExecution stepExecution = new StepExecution("taskletStep", jobExecution, new Long(3) );
pss.beforeStep(stepExecution);
List parameterNames = new ArrayList();

View File

@@ -26,7 +26,6 @@ import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.SimpleJob;
import org.springframework.batch.core.step.tasklet.TaskletStep;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -50,7 +49,7 @@ public class StepExecutionPreparedStatementSetterTests extends AbstractTransacti
JobParameters jobParameters = new JobParametersBuilder().addLong("begin.id", new Long(1)).addLong("end.id", new Long(4)).toJobParameters();
JobInstance jobInstance = new JobInstance(new Long(1), jobParameters, new SimpleJob());
JobExecution jobExecution = new JobExecution(jobInstance, new Long(2));
stepExecution = new StepExecution(new TaskletStep(), jobExecution, new Long(3) );
stepExecution = new StepExecution("taskletStep", jobExecution, new Long(3) );
pss.beforeStep(stepExecution);
jdbcTemplate = getJdbcTemplate();
}

View File

@@ -30,13 +30,17 @@ public class AbstractStepTests extends TestCase {
*/
final List events = new ArrayList();
final StepExecution execution = new StepExecution(tested, new JobExecution(new JobInstance(new Long(1),
final StepExecution execution = new StepExecution(tested.getName(), new JobExecution(new JobInstance(new Long(1),
new JobParameters(), new JobSupport())));
/**
* Fills the events list when abstract methods are called.
*/
private class EventTrackingStep extends AbstractStep {
public EventTrackingStep() {
setBeanName("eventTrackingStep");
}
protected void open(ExecutionContext ctx) throws Exception {
events.add("open");

View File

@@ -27,7 +27,7 @@ import org.springframework.batch.core.StepExecution;
public class ThreadStepInterruptionPolicyTests extends TestCase {
ThreadStepInterruptionPolicy policy = new ThreadStepInterruptionPolicy();
private StepExecution context = new StepExecution(new StepSupport(), null);
private StepExecution context = new StepExecution("stepSupport", null);
/**
* Test method for {@link org.springframework.batch.core.step.ThreadStepInterruptionPolicy#checkInterrupted(StepExecution)}.

View File

@@ -117,7 +117,7 @@ public class ItemOrientedStepTests extends TestCase {
public void testStepExecutor() throws Exception {
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
itemOrientedStep.execute(stepExecution);
assertEquals(1, processed.size());
@@ -134,7 +134,7 @@ public class ItemOrientedStepTests extends TestCase {
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
StepContribution contribution = stepExecution.createStepContribution();
itemOrientedStep.processChunk(stepExecution, contribution);
assertEquals(1, processed.size());
@@ -150,7 +150,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setJobRepository(repository);
JobExecution jobExecution = repository.createJobExecution(jobInstance.getJob(), jobInstance.getJobParameters());
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
itemOrientedStep.execute(stepExecution);
assertEquals(1, processed.size());
@@ -175,7 +175,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(itemReader, itemWriter));
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
try {
itemOrientedStep.execute(stepExecution);
@@ -205,7 +205,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(itemReader, itemWriter));
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
try {
itemOrientedStep.execute(stepExecution);
@@ -240,7 +240,7 @@ public class ItemOrientedStepTests extends TestCase {
}
});
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
try {
itemOrientedStep.execute(stepExecution);
@@ -262,7 +262,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(tasklet, itemWriter));
itemOrientedStep.registerStream(tasklet);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
itemOrientedStep.execute(stepExecution);
@@ -272,7 +272,7 @@ public class ItemOrientedStepTests extends TestCase {
public void testSuccessfulExecutionWithExecutionContext() throws Exception {
final JobExecution jobExecution = new JobExecution(jobInstance);
final StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
final StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
itemOrientedStep.setJobRepository(new JobRepositorySupport() {
public void saveOrUpdateExecutionContext(StepExecution stepExecution) {
list.add(stepExecution);
@@ -288,7 +288,7 @@ public class ItemOrientedStepTests extends TestCase {
public void testSuccessfulExecutionWithFailureOnSaveOfExecutionContext() throws Exception {
final JobExecution jobExecution = new JobExecution(jobInstance);
final StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
final StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
itemOrientedStep.setJobRepository(new JobRepositorySupport() {
private int counter = 0;
@@ -320,7 +320,7 @@ public class ItemOrientedStepTests extends TestCase {
MockRestartableItemReader tasklet = new MockRestartableItemReader();
itemOrientedStep.setItemHandler(new SimpleItemHandler(tasklet, itemWriter));
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
try {
itemOrientedStep.execute(stepExecution);
@@ -344,7 +344,7 @@ public class ItemOrientedStepTests extends TestCase {
}
}, itemWriter));
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
itemOrientedStep.execute(stepExecution);
}
@@ -363,7 +363,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(reader, itemWriter));
itemOrientedStep.registerStream(reader);
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
assertEquals(false, stepExecution.getExecutionContext().containsKey("foo"));
@@ -381,7 +381,7 @@ public class ItemOrientedStepTests extends TestCase {
}
} });
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
assertEquals(false, stepExecution.getExecutionContext().containsKey("foo"));
@@ -402,7 +402,7 @@ public class ItemOrientedStepTests extends TestCase {
}
});
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
itemOrientedStep.execute(stepExecution);
assertEquals(2, list.size());
}
@@ -419,7 +419,7 @@ public class ItemOrientedStepTests extends TestCase {
};
itemOrientedStep.setStreams(new ItemStream[] { reader });
itemOrientedStep.registerStepExecutionListener(reader);
StepExecution stepExecution = new StepExecution(itemOrientedStep, new JobExecution(jobInstance));
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), new JobExecution(jobInstance));
itemOrientedStep.execute(stepExecution);
assertEquals(1, list.size());
}
@@ -440,7 +440,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setStepOperations(stepTemplate);
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
itemOrientedStep.execute(stepExecution);
assertEquals(1, list.size());
ExitStatus returnedStatus = stepExecution.getExitStatus();
@@ -461,7 +461,7 @@ public class ItemOrientedStepTests extends TestCase {
}
}, itemWriter));
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
try {
itemOrientedStep.execute(stepExecution);
fail("Expected RuntimeException");
@@ -485,7 +485,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(reader, itemWriter));
itemOrientedStep.setStreams(new ItemStream[] { reader });
JobExecution jobExecution = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecution);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecution);
assertEquals(false, stepExecution.getExecutionContext().containsKey("foo"));
@@ -525,7 +525,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(itemReader, itemWriter));
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
@@ -551,7 +551,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(itemReader, itemWriter));
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
// step.setLastExecution(stepExecution);
@@ -578,7 +578,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(itemReader, itemWriter));
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
// step.setLastExecution(stepExecution);
@@ -611,7 +611,7 @@ public class ItemOrientedStepTests extends TestCase {
});
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
// step.setLastExecution(stepExecution);
@@ -639,7 +639,7 @@ public class ItemOrientedStepTests extends TestCase {
});
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
// step.setLastExecution(stepExecution);
@@ -671,7 +671,7 @@ public class ItemOrientedStepTests extends TestCase {
});
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
try {
itemOrientedStep.execute(stepExecution);
@@ -702,7 +702,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.registerStream(itemReader);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
// step.setLastExecution(stepExecution);
@@ -738,7 +738,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setItemHandler(new SimpleItemHandler(reader, itemWriter));
itemOrientedStep.registerStream(reader);
StepExecution stepExecution = new StepExecution(itemOrientedStep, new JobExecution(jobInstance));
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), new JobExecution(jobInstance));
try {
itemOrientedStep.execute(stepExecution);
@@ -761,7 +761,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.setStepOperations(template);
JobExecution jobExecutionContext = new JobExecution(jobInstance);
StepExecution stepExecution = new StepExecution(itemOrientedStep, jobExecutionContext);
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
itemOrientedStep.execute(stepExecution);
assertEquals(3, processed.size());
@@ -780,7 +780,7 @@ public class ItemOrientedStepTests extends TestCase {
}
};
itemOrientedStep.setStepExecutionListeners(new StepExecutionListener[] { listener });
StepExecution stepExecution = new StepExecution(itemOrientedStep, new JobExecution(jobInstance));
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), new JobExecution(jobInstance));
try {
itemOrientedStep.execute(stepExecution);
fail();

View File

@@ -49,6 +49,7 @@ public class RepeatOperationsStepFactoryBeanTests extends TestCase {
new JobSupport("job")));
protected void setUp() throws Exception {
factory.setBeanName("RepeatOperationsStep");
factory.setItemReader(new ListItemReader(new ArrayList()));
factory.setItemWriter(new EmptyItemWriter());
factory.setJobRepository(new JobRepositorySupport());
@@ -80,7 +81,7 @@ public class RepeatOperationsStepFactoryBeanTests extends TestCase {
});
Step step = (Step) factory.getObject();
step.execute(new StepExecution(step, jobExecution));
step.execute(new StepExecution(step.getName(), jobExecution));
assertEquals(1, list.size());
}

View File

@@ -52,6 +52,7 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
protected int count;
protected void setUp() throws Exception {
factory.setBeanName("stepName");
factory.setJobRepository(new JobRepositorySupport());
factory.setTransactionManager(new ResourcelessTransactionManager());
factory.setCommitInterval(COMMIT_INTERVAL);
@@ -70,7 +71,7 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
public void testSkip() throws Exception {
AbstractStep step = (AbstractStep) factory.getObject();
StepExecution stepExecution = new StepExecution(step, jobExecution);
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
step.execute(stepExecution);
assertEquals(2, stepExecution.getSkipCount());
@@ -97,7 +98,7 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
});
AbstractStep step = (AbstractStep) factory.getObject();
StepExecution stepExecution = new StepExecution(step, jobExecution);
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
try {
step.execute(stepExecution);
@@ -117,7 +118,7 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
AbstractStep step = (AbstractStep) factory.getObject();
StepExecution stepExecution = new StepExecution(step, jobExecution);
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
try {
step.execute(stepExecution);
@@ -152,7 +153,7 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
AbstractStep step = (AbstractStep) factory.getObject();
StepExecution stepExecution = new StepExecution(step, jobExecution);
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
try {
step.execute(stepExecution);
@@ -244,7 +245,7 @@ public class SkipLimitStepFactoryBeanTests extends TestCase {
factory.setItemReader(provider);
AbstractStep step = (AbstractStep) factory.getObject();
StepExecution stepExecution = new StepExecution(step, jobExecution);
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
step.execute(stepExecution);
assertEquals(1, stepExecution.getSkipCount());

View File

@@ -124,7 +124,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
factory.setRetryLimit(10);
AbstractStep step = (AbstractStep) factory.getObject();
StepExecution stepExecution = new StepExecution(step, jobExecution);
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
step.execute(stepExecution);
assertEquals(0, stepExecution.getSkipCount());
@@ -151,7 +151,7 @@ public class StatefulRetryStepFactoryBeanTests extends TestCase {
factory.setRetryLimit(10);
AbstractStep step = (AbstractStep) factory.getObject();
StepExecution stepExecution = new StepExecution(step, jobExecution);
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
step.execute(stepExecution);
assertEquals(2, stepExecution.getSkipCount());

View File

@@ -72,7 +72,7 @@ public class StepExecutorInterruptionTests extends TestCase {
return null;
}
}, itemWriter));
stepExecution = new StepExecution(step, jobExecution);
stepExecution = new StepExecution(step.getName(), jobExecution);
}
public void testInterruptChunk() throws Exception {

View File

@@ -16,7 +16,6 @@ import org.springframework.batch.core.UnexpectedJobExecutionException;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.step.JobRepositorySupport;
import org.springframework.batch.core.step.StepSupport;
import org.springframework.batch.repeat.ExitStatus;
public class TaskletStepTests extends TestCase {
@@ -26,7 +25,7 @@ public class TaskletStepTests extends TestCase {
private List list = new ArrayList();
protected void setUp() throws Exception {
stepExecution = new StepExecution(new StepSupport("stepName"), new JobExecution(new JobInstance(new Long(0L),
stepExecution = new StepExecution("stepName", new JobExecution(new JobInstance(new Long(0L),
new JobParameters(), new JobSupport("testJob")), new Long(12)));
}