OPEN - issue BATCH-304: BatchCommandLineLauncher simplified and rename

http://jira.springframework.org/browse/BATCH-304

Date format hell - how is new Date(0) "19691231"?
This commit is contained in:
dsyer
2008-01-24 10:07:38 +00:00
parent 28f794df4e
commit 97d5359f3c
3 changed files with 11 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.batch.core.runtime;
import java.util.Properties;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.JobParametersBuilder;
/**
* A factory for {@link JobParameters} instances. A job can be
@@ -29,9 +30,10 @@ import org.springframework.batch.core.domain.JobParameters;
* {@link JobParameters} and some do not (e.g. for an ad-hoc execution a simple
* label might be enough).
*
*
* @author Dave Syer
*
* @see JobParametersBuilder
*
*/
public interface JobParametersFactory {

View File

@@ -15,9 +15,12 @@
*/
package org.springframework.batch.execution.bootstrap.support;
import java.util.Properties;
import junit.framework.TestCase;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.support.PropertiesConverter;
/**
* @author Dave Syer
@@ -43,7 +46,9 @@ public class JobParametersPropertyEditorTests extends TestCase {
*/
public void testGetAsText() {
editor.setAsText("foo=bar,spam=bucket");
assertEquals("foo=bar,spam=bucket", editor.getAsText());
Properties properties = PropertiesConverter.stringToProperties(editor.getAsText());
assertEquals("bar", properties.getProperty("foo"));
assertEquals("bucket", properties.getProperty("spam"));
}
}

View File

@@ -35,7 +35,7 @@ public class DefaultJobInstanceLabelGeneratorTests extends TestCase {
* Test method for {@link org.springframework.batch.execution.resource.DefaultJobInstanceLabelGenerator#getLabel()}.
*/
public void testDefaultGetLabel() throws Exception {
JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(0)).addString("key", "bar").toJobParameters();
JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(1)).addString("key", "bar").toJobParameters();
JobInstance job = new JobInstance(null, jobParameters, new Job(null));
assertEquals("null-bar-19700101", instance.getLabel(job));
}
@@ -44,7 +44,7 @@ public class DefaultJobInstanceLabelGeneratorTests extends TestCase {
* Test method for {@link org.springframework.batch.execution.resource.DefaultJobInstanceLabelGenerator#getLabel()}.
*/
public void testGetLabelWithAllProperties() throws Exception {
JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(0)).addString("key", "bar").toJobParameters();
JobParameters jobParameters = new JobParametersBuilder().addDate("schedule.date", new Date(1)).addString("key", "bar").toJobParameters();
JobInstance job = new JobInstance(null, jobParameters, new Job("foo"));
assertEquals("foo-bar-19700101", instance.getLabel(job));
}