IN PROGRESS - BATCH-709: Change all collections to use generics
This commit is contained in:
@@ -36,6 +36,12 @@ public class StepExecutionTests extends TestCase {
|
||||
private StepExecution execution = newStepExecution(new StepSupport("stepName"), new Long(23));
|
||||
|
||||
private StepExecution blankExecution = newStepExecution(new StepSupport("blank"), null);
|
||||
|
||||
private ExecutionContext foobarEc = new ExecutionContext() {
|
||||
{
|
||||
put("foo", "bar");
|
||||
}
|
||||
};
|
||||
|
||||
public void testStepExecution() {
|
||||
assertNull(new StepExecution("step", null).getId());
|
||||
@@ -206,7 +212,7 @@ public class StepExecutionTests extends TestCase {
|
||||
Set set = new HashSet();
|
||||
set.add(execution);
|
||||
assertTrue(set.contains(execution));
|
||||
execution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
execution.setExecutionContext(foobarEc);
|
||||
assertTrue(set.contains(execution));
|
||||
}
|
||||
|
||||
@@ -214,7 +220,7 @@ public class StepExecutionTests extends TestCase {
|
||||
|
||||
ExitStatus status = ExitStatus.NOOP;
|
||||
execution.setExitStatus(status);
|
||||
execution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
execution.setExecutionContext(foobarEc);
|
||||
|
||||
byte[] serialized = SerializationUtils.serialize(execution);
|
||||
StepExecution deserialized = (StepExecution) SerializationUtils.deserialize(serialized);
|
||||
|
||||
@@ -55,8 +55,11 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException {
|
||||
JobExecution result = new JobExecution(null);
|
||||
StepExecution stepExecution = result.createStepExecution(new StepSupport("stepName"));
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter
|
||||
.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(new ExecutionContext() {
|
||||
{
|
||||
put("foo", "bar");
|
||||
}
|
||||
});
|
||||
list.add(jobParameters);
|
||||
return result;
|
||||
}
|
||||
@@ -67,7 +70,8 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}.
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -76,15 +80,18 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
try {
|
||||
launcher.afterPropertiesSet();
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
String message = e.getMessage();
|
||||
assertTrue("Message does not contain 'launcher': " + message, contains(message.toLowerCase(), "joblauncher"));
|
||||
assertTrue("Message does not contain 'launcher': " + message,
|
||||
contains(message.toLowerCase(), "joblauncher"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}.
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -98,14 +105,17 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
try {
|
||||
launcher.afterPropertiesSet();
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
String message = e.getMessage();
|
||||
assertTrue("Message does not contain 'locator': " + message, contains(message.toLowerCase(), "joblocator"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#getStatistics()}.
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#getStatistics()}
|
||||
* .
|
||||
*/
|
||||
public void testGetStatistics() {
|
||||
Properties props = launcher.getStatistics();
|
||||
@@ -114,7 +124,9 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#getStatistics()}.
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#getStatistics()}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -127,7 +139,9 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#isRunning()}.
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#isRunning()}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -138,7 +152,9 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#isRunning()}.
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#isRunning()}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -150,12 +166,14 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
}
|
||||
});
|
||||
String value = launcher.run("foo");
|
||||
assertTrue("Return value was not an exception: " + value, contains(value, "JobExecutionAlreadyRunningException"));
|
||||
assertTrue("Return value was not an exception: " + value,
|
||||
contains(value, "JobExecutionAlreadyRunningException"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}.
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}
|
||||
* .
|
||||
*/
|
||||
public void testRunNonExistentJob() {
|
||||
String value = launcher.run("foo");
|
||||
@@ -164,7 +182,8 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}.
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -177,7 +196,8 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}.
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -198,7 +218,9 @@ public class SimpleExportedJobLauncherTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#stop()}.
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#stop()}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
@@ -139,7 +139,11 @@ public class ItemOrientedStepIntegrationTests extends AbstractDependencyInjectio
|
||||
JobExecution jobExecution = jobRepository.createJobExecution(job, new JobParameters());
|
||||
StepExecution stepExecution = new StepExecution(step.getName(), jobExecution);
|
||||
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(new ExecutionContext() {
|
||||
{
|
||||
put("foo", "bar");
|
||||
}
|
||||
});
|
||||
// step.setLastExecution(stepExecution);
|
||||
|
||||
try {
|
||||
|
||||
@@ -80,6 +80,12 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
private JobInstance jobInstance;
|
||||
|
||||
private ResourcelessTransactionManager transactionManager;
|
||||
|
||||
private ExecutionContext foobarEc = new ExecutionContext() {
|
||||
{
|
||||
put("foo", "bar");
|
||||
}
|
||||
};
|
||||
|
||||
private ItemReader getReader(String[] args) {
|
||||
return new ListItemReader(Arrays.asList(args));
|
||||
@@ -529,7 +535,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
JobExecution jobExecutionContext = new JobExecution(jobInstance);
|
||||
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
|
||||
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(foobarEc);
|
||||
|
||||
try {
|
||||
itemOrientedStep.execute(stepExecution);
|
||||
@@ -556,7 +562,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
JobExecution jobExecutionContext = new JobExecution(jobInstance);
|
||||
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
|
||||
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(foobarEc);
|
||||
// step.setLastExecution(stepExecution);
|
||||
|
||||
try {
|
||||
@@ -583,7 +589,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
JobExecution jobExecutionContext = new JobExecution(jobInstance);
|
||||
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
|
||||
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(foobarEc);
|
||||
// step.setLastExecution(stepExecution);
|
||||
|
||||
try {
|
||||
@@ -616,7 +622,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
JobExecution jobExecutionContext = new JobExecution(jobInstance);
|
||||
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
|
||||
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(foobarEc);
|
||||
// step.setLastExecution(stepExecution);
|
||||
|
||||
try {
|
||||
@@ -644,7 +650,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
JobExecution jobExecutionContext = new JobExecution(jobInstance);
|
||||
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
|
||||
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(foobarEc);
|
||||
// step.setLastExecution(stepExecution);
|
||||
|
||||
try {
|
||||
@@ -706,7 +712,7 @@ public class ItemOrientedStepTests extends TestCase {
|
||||
JobExecution jobExecutionContext = new JobExecution(jobInstance);
|
||||
StepExecution stepExecution = new StepExecution(itemOrientedStep.getName(), jobExecutionContext);
|
||||
|
||||
stepExecution.setExecutionContext(new ExecutionContext(PropertiesConverter.stringToProperties("foo=bar")));
|
||||
stepExecution.setExecutionContext(foobarEc);
|
||||
// step.setLastExecution(stepExecution);
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user