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:
@@ -55,6 +55,19 @@ public class BatchStatusTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.BatchStatus#getStatus(java.lang.String)}.
|
||||
*/
|
||||
public void testGetStatusNullCode() {
|
||||
try{
|
||||
BatchStatus.getStatus(null);
|
||||
fail();
|
||||
}
|
||||
catch(IllegalArgumentException ex){
|
||||
//expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testSerialization() throws Exception{
|
||||
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
|
||||
@@ -27,9 +27,9 @@ import org.springframework.batch.repeat.ExitStatus;
|
||||
*/
|
||||
public class JobExecutionTests extends TestCase {
|
||||
|
||||
private JobExecution execution = new JobExecution(new JobInstance(new Long(11), new JobInstanceProperties()), new Long(12));
|
||||
private JobExecution execution = new JobExecution(new JobInstance(new Long(11), new JobParameters()), new Long(12));
|
||||
|
||||
private JobExecution context = new JobExecution(new JobInstance(new Long(11), new JobInstanceProperties(), new Job("foo")), new Long(12));
|
||||
private JobExecution context = new JobExecution(new JobInstance(new Long(11), new JobParameters(), new Job("foo")), new Long(12));
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
@@ -85,7 +85,7 @@ public class JobExecutionTests extends TestCase {
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(11, execution.getJobId().longValue());
|
||||
execution = new JobExecution(new JobInstance(new Long(23), new JobInstanceProperties()), null);
|
||||
execution = new JobExecution(new JobInstance(new Long(23), new JobParameters()), null);
|
||||
assertEquals(23, execution.getJobId().longValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class JobInstanceTests extends TestCase {
|
||||
|
||||
private JobInstance instance = new JobInstance(new Long(11), new JobInstanceProperties(), new Job("job"));
|
||||
private JobInstance instance = new JobInstance(new Long(11), new JobParameters(), new Job("job"));
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.core.domain.JobInstance#getStatus()}.
|
||||
@@ -66,7 +66,7 @@ public class JobInstanceTests extends TestCase {
|
||||
* Test method for {@link org.springframework.batch.core.domain.JobInstance#getIdentifier()}.
|
||||
*/
|
||||
public void testGetName() {
|
||||
instance = new JobInstance(new Long(1), new JobInstanceProperties(), new Job("foo"));
|
||||
instance = new JobInstance(new Long(1), new JobParameters(), new Job("foo"));
|
||||
assertEquals("foo", instance.getJobName());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@ import junit.framework.TestCase;
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class JobInstancePropertiesBuilderTests extends TestCase {
|
||||
public class JobParametersBuilderTests extends TestCase {
|
||||
|
||||
JobInstancePropertiesBuilder parametersBuilder;
|
||||
JobParametersBuilder parametersBuilder;
|
||||
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
parametersBuilder = new JobInstancePropertiesBuilder();
|
||||
parametersBuilder = new JobParametersBuilder();
|
||||
parametersBuilder.addDate("SCHEDULE_DATE", date);
|
||||
parametersBuilder.addLong("LONG", new Long(1));
|
||||
parametersBuilder.addString("STRING", "string value");
|
||||
@@ -28,7 +28,7 @@ public class JobInstancePropertiesBuilderTests extends TestCase {
|
||||
|
||||
public void testToJobRuntimeParamters(){
|
||||
|
||||
JobInstanceProperties parameters = parametersBuilder.toJobParameters();
|
||||
JobParameters parameters = parametersBuilder.toJobParameters();
|
||||
assertEquals(parameters.getDate("SCHEDULE_DATE"), date);
|
||||
assertEquals(parameters.getLong("LONG"), new Long(1));
|
||||
assertEquals(parameters.getString("STRING"), "string value");
|
||||
@@ -15,9 +15,9 @@ import junit.framework.TestCase;
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public class JobInstancePropertiesTests extends TestCase {
|
||||
public class JobParametersTests extends TestCase {
|
||||
|
||||
JobInstanceProperties parameters;
|
||||
JobParameters parameters;
|
||||
|
||||
Map stringMap;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
parameters = getNewParameters();
|
||||
}
|
||||
|
||||
private JobInstanceProperties getNewParameters(){
|
||||
private JobParameters getNewParameters(){
|
||||
|
||||
stringMap = new HashMap();
|
||||
stringMap.put("string.key1", "value1");
|
||||
@@ -47,7 +47,7 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
dateMap.put("date.key1", date1 );
|
||||
dateMap.put("date.key2", date2 );
|
||||
|
||||
return new JobInstanceProperties(stringMap, longMap, dateMap);
|
||||
return new JobParameters(stringMap, longMap, dateMap);
|
||||
}
|
||||
|
||||
public void testBadLongConstructorException() throws Exception{
|
||||
@@ -56,7 +56,7 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
badLongMap.put("key", "bad long");
|
||||
|
||||
try{
|
||||
new JobInstanceProperties(stringMap, badLongMap, dateMap);
|
||||
new JobParameters(stringMap, badLongMap, dateMap);
|
||||
fail();
|
||||
}
|
||||
catch(IllegalArgumentException ex){
|
||||
@@ -70,7 +70,7 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
badMap.put("key", new Integer(2));
|
||||
|
||||
try{
|
||||
new JobInstanceProperties(badMap, longMap, dateMap);
|
||||
new JobParameters(badMap, longMap, dateMap);
|
||||
fail();
|
||||
}
|
||||
catch(IllegalArgumentException ex){
|
||||
@@ -84,7 +84,7 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
badMap.put("key", new java.sql.Date(System.currentTimeMillis()));
|
||||
|
||||
try{
|
||||
new JobInstanceProperties(stringMap, longMap, badMap);
|
||||
new JobParameters(stringMap, longMap, badMap);
|
||||
fail();
|
||||
}
|
||||
catch(IllegalArgumentException ex){
|
||||
@@ -112,7 +112,7 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
|
||||
public void testEquals(){
|
||||
|
||||
JobInstanceProperties testParameters = getNewParameters();
|
||||
JobParameters testParameters = getNewParameters();
|
||||
assertTrue(testParameters.equals(parameters));
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
dateMap.put("date.key2", date2 );
|
||||
dateMap.put("date.key1", date1 );
|
||||
|
||||
JobInstanceProperties testProps = new JobInstanceProperties(stringMap, longMap, dateMap);
|
||||
JobParameters testProps = new JobParameters(stringMap, longMap, dateMap);
|
||||
|
||||
props = testProps.getParameters();
|
||||
stringBuilder = new StringBuilder();
|
||||
@@ -152,15 +152,6 @@ public class JobInstancePropertiesTests extends TestCase {
|
||||
|
||||
assertEquals(string1, string2);
|
||||
}
|
||||
|
||||
public void testIsEmpty(){
|
||||
|
||||
JobInstanceProperties props = new JobInstanceProperties();
|
||||
assertTrue(props.isEmtpy());
|
||||
|
||||
props = new JobInstancePropertiesBuilder().addString("test", "test").toJobParameters();
|
||||
assertFalse(props.isEmtpy());
|
||||
}
|
||||
|
||||
// Not sure how to properly test this since there is no order garuntee, commenting out for now.
|
||||
//
|
||||
@@ -212,7 +212,7 @@ public class StepExecutionTests extends TestCase {
|
||||
}
|
||||
|
||||
private StepExecution newStepExecution(Long long1, Long long2) {
|
||||
JobInstance job = new JobInstance(new Long(3), new JobInstanceProperties());
|
||||
JobInstance job = new JobInstance(new Long(3), new JobParameters());
|
||||
StepInstance step = new StepInstance(job, "foo", long1);
|
||||
StepExecution execution = new StepExecution(step, new JobExecution(job, long2), new Long(4));
|
||||
return execution;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class StepInstanceTests extends TestCase {
|
||||
*/
|
||||
public void testGetJobInstance() {
|
||||
assertEquals(null, instance.getJobInstance());
|
||||
JobInstance jobInstance = new JobInstance(new Long(1), new JobInstanceProperties());
|
||||
JobInstance jobInstance = new JobInstance(new Long(1), new JobParameters());
|
||||
instance = new StepInstance(jobInstance, null);
|
||||
assertEquals(jobInstance, instance.getJobInstance());
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class StepInstanceTests extends TestCase {
|
||||
public void testGetJob(){
|
||||
|
||||
Job job = new Job("job");
|
||||
JobInstance jobInstance = new JobInstance(new Long(2), new JobInstanceProperties(), job);
|
||||
JobInstance jobInstance = new JobInstance(new Long(2), new JobParameters(), job);
|
||||
instance = new StepInstance(jobInstance, null);
|
||||
assertEquals(job, instance.getJobInstance().getJob());
|
||||
}
|
||||
@@ -98,12 +98,12 @@ public class StepInstanceTests extends TestCase {
|
||||
*/
|
||||
public void testGetJobId() {
|
||||
assertEquals(null, instance.getJobId());
|
||||
instance = new StepInstance(new JobInstance(new Long(23), new JobInstanceProperties()), null);
|
||||
instance = new StepInstance(new JobInstance(new Long(23), new JobParameters()), null);
|
||||
assertEquals(23, instance.getJobId().longValue());
|
||||
}
|
||||
|
||||
public void testEqualsWithSameIdentifier() throws Exception {
|
||||
JobInstance job = new JobInstance(new Long(100), new JobInstanceProperties());
|
||||
JobInstance job = new JobInstance(new Long(100), new JobParameters());
|
||||
StepInstance step1 = new StepInstance(job, "foo", new Long(0));
|
||||
StepInstance step2 = new StepInstance(job, "foo", new Long(0));
|
||||
assertEquals(step1, step2);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class SimpleJobIdentifierFactoryTests extends TestCase {
|
||||
|
||||
public void testGetJobIdentifier() {
|
||||
JobIdentifier jobIdentifier = new SimpleJobIdentifierFactory().getJobIdentifier("foo");
|
||||
assertEquals("foo", jobIdentifier.getName());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user