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:
@@ -18,6 +18,8 @@ package org.springframework.batch.core.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Typesafe enumeration representing the status of an artifact within the
|
||||
* batch environment. See Effective Java Programming by Joshua Bloch for more
|
||||
@@ -69,6 +71,7 @@ public class BatchStatus implements Serializable{
|
||||
* @throws IllegalArgumentException if no status matches provided string.
|
||||
*/
|
||||
public static BatchStatus getStatus(String statusAsString) {
|
||||
Assert.notNull(statusAsString, "Cannot match null to valid status.");
|
||||
final String upperCaseStatusAsString = statusAsString.toUpperCase();
|
||||
for (int i = 0; i < VALUES.length; i++) {
|
||||
if (VALUES[i].toString().equals(upperCaseStatusAsString)) {
|
||||
|
||||
@@ -36,11 +36,11 @@ public interface JobIdentifier {
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* A simple getter for the {@link JobInstanceProperties} that also identify
|
||||
* A simple getter for the {@link JobParameters} that also identify
|
||||
* this job.
|
||||
*
|
||||
* @return JobRuntimeParameters
|
||||
*/
|
||||
public JobInstanceProperties getJobInstanceProperties();
|
||||
public JobParameters getJobInstanceProperties();
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class JobInstance extends Entity {
|
||||
|
||||
private List stepInstances = new ArrayList();
|
||||
|
||||
private JobInstanceProperties jobInstanceProperties;
|
||||
private JobParameters jobParameters;
|
||||
|
||||
private Job job;
|
||||
|
||||
@@ -44,14 +44,14 @@ public class JobInstance extends Entity {
|
||||
|
||||
private int jobExecutionCount;
|
||||
|
||||
public JobInstance(Long id, JobInstanceProperties jobInstanceProperties) {
|
||||
public JobInstance(Long id, JobParameters jobParameters) {
|
||||
super(id);
|
||||
Assert.notNull(jobInstanceProperties, "JobInstanceProperties must not be null.");
|
||||
this.jobInstanceProperties = jobInstanceProperties;
|
||||
Assert.notNull(jobParameters, "JobInstanceProperties must not be null.");
|
||||
this.jobParameters = jobParameters;
|
||||
}
|
||||
|
||||
public JobInstance(Long id, JobInstanceProperties jobInstanceProperties, Job job){
|
||||
this(id, jobInstanceProperties);
|
||||
public JobInstance(Long id, JobParameters jobParameters, Job job){
|
||||
this(id, jobParameters);
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ public class JobInstance extends Entity {
|
||||
/**
|
||||
* @return JobInstanceProperties
|
||||
*/
|
||||
public JobInstanceProperties getJobInstanceProperties() {
|
||||
return jobInstanceProperties;
|
||||
public JobParameters getJobInstanceProperties() {
|
||||
return jobParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ public class JobInstance extends Entity {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return super.toString()+", JobInstanceProperties=["+ jobInstanceProperties +"]" +
|
||||
return super.toString()+", JobInstanceProperties=["+ jobParameters +"]" +
|
||||
", Job=[" + job + "]";
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
* @author Lucas Ward
|
||||
* @since 1.0
|
||||
*/
|
||||
public class JobInstanceProperties {
|
||||
public class JobParameters {
|
||||
|
||||
private final Map stringMap;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class JobInstanceProperties {
|
||||
* that this constructor should only be used if an empty parameters is needed, since
|
||||
* JobRuntimeParameters is immutable.
|
||||
*/
|
||||
public JobInstanceProperties(){
|
||||
public JobParameters(){
|
||||
this.stringMap = new LinkedHashMap();
|
||||
this.longMap = new LinkedHashMap();
|
||||
this.dateMap = new LinkedHashMap();
|
||||
@@ -46,14 +46,14 @@ public class JobInstanceProperties {
|
||||
|
||||
/**
|
||||
* Create a new parameters object based upon three maps for each of the three
|
||||
* data types. See {@link JobInstancePropertiesBuilder} for an easier way to
|
||||
* data types. See {@link JobParametersBuilder} for an easier way to
|
||||
* create paramters.
|
||||
*
|
||||
* @param stringMap
|
||||
* @param longMap
|
||||
* @param dateMap
|
||||
*/
|
||||
public JobInstanceProperties(Map stringMap, Map longMap, Map dateMap){
|
||||
public JobParameters(Map stringMap, Map longMap, Map dateMap){
|
||||
super();
|
||||
|
||||
validateMap(stringMap, String.class);
|
||||
@@ -168,13 +168,9 @@ public class JobInstanceProperties {
|
||||
return tempMap;
|
||||
}
|
||||
|
||||
public boolean isEmtpy(){
|
||||
return dateMap.isEmpty() && longMap.isEmpty() && stringMap.isEmpty();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
if(obj instanceof JobInstanceProperties == false){
|
||||
if(obj instanceof JobParameters == false){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -182,7 +178,7 @@ public class JobInstanceProperties {
|
||||
return true;
|
||||
}
|
||||
|
||||
JobInstanceProperties parameters = (JobInstanceProperties)obj;
|
||||
JobParameters parameters = (JobParameters)obj;
|
||||
|
||||
//Since the type contained by each map is known, it's safe to call Map.equals()
|
||||
if(getParameters().equals(parameters.getParameters())){
|
||||
@@ -10,33 +10,35 @@ import java.util.Map;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Helper class for creating JobRuntimeParameters. Useful because of all JobRuntimeParameters
|
||||
* are immutable, and require 3 separate maps of the three supported types to ensure typesafety.
|
||||
* Once created, it can be used in the same was a java.lang.StringBuilder (except, order is irrelevant),
|
||||
* by adding various parameters types and creating a valid JobRuntimeParametres once finished.
|
||||
* Helper class for creating {@link JobParameters}. Useful because of all
|
||||
* {@link JobParameters} are immutable, and require 3 separate maps of the three
|
||||
* supported types to ensure typesafety. Once created, it can be used in the
|
||||
* same was a java.lang.StringBuilder (except, order is irrelevant), by adding
|
||||
* various parameters types and creating a valid JobRuntimeParametres once
|
||||
* finished.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @since 1.0
|
||||
* @see JobInstanceProperties
|
||||
* @see JobParameters
|
||||
*/
|
||||
public class JobInstancePropertiesBuilder {
|
||||
public class JobParametersBuilder {
|
||||
|
||||
private final Map stringMap;
|
||||
|
||||
|
||||
private final Map longMap;
|
||||
|
||||
|
||||
private final Map dateMap;
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor. Initializes the builder
|
||||
* Default constructor. Initializes the builder
|
||||
*/
|
||||
public JobInstancePropertiesBuilder() {
|
||||
|
||||
public JobParametersBuilder() {
|
||||
|
||||
this.stringMap = new HashMap();
|
||||
this.longMap = new HashMap();
|
||||
this.dateMap = new HashMap();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new String parameter for the given key.
|
||||
*
|
||||
@@ -44,12 +46,12 @@ public class JobInstancePropertiesBuilder {
|
||||
* @param parameter - runtime parameter
|
||||
* @return a refernece to this object.
|
||||
*/
|
||||
public JobInstancePropertiesBuilder addString(String key, String parameter){
|
||||
public JobParametersBuilder addString(String key, String parameter) {
|
||||
Assert.notNull(parameter, "Parameter must not be null.");
|
||||
stringMap.put(key, parameter);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new Date parameter for the given key.
|
||||
*
|
||||
@@ -57,12 +59,12 @@ public class JobInstancePropertiesBuilder {
|
||||
* @param parameter - runtime parameter
|
||||
* @return a refernece to this object.
|
||||
*/
|
||||
public JobInstancePropertiesBuilder addDate(String key, Date parameter){
|
||||
public JobParametersBuilder addDate(String key, Date parameter) {
|
||||
Assert.notNull(parameter, "Parameter must not be null.");
|
||||
dateMap.put(key, new Date(parameter.getTime()));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new Long parameter for the given key.
|
||||
*
|
||||
@@ -70,19 +72,19 @@ public class JobInstancePropertiesBuilder {
|
||||
* @param parameter - runtime parameter
|
||||
* @return a refernece to this object.
|
||||
*/
|
||||
public JobInstancePropertiesBuilder addLong(String key, Long parameter){
|
||||
public JobParametersBuilder addLong(String key, Long parameter) {
|
||||
Assert.notNull(parameter, "Parameter must not be null.");
|
||||
longMap.put(key, parameter);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Conversion method that takes the current state of this builder and returns it as
|
||||
* a JobruntimeParameters object.
|
||||
* Conversion method that takes the current state of this builder and
|
||||
* returns it as a JobruntimeParameters object.
|
||||
*
|
||||
* @return a valid JobRuntimeParameters object.
|
||||
*/
|
||||
public JobInstanceProperties toJobParameters(){
|
||||
return new JobInstanceProperties(stringMap, longMap, dateMap);
|
||||
public JobParameters toJobParameters() {
|
||||
return new JobParameters(stringMap, longMap, dateMap);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import org.springframework.batch.core.domain.Job;
|
||||
import org.springframework.batch.core.domain.JobExecution;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.JobInstance;
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.domain.StepInstance;
|
||||
|
||||
@@ -53,7 +53,7 @@ public interface JobRepository {
|
||||
* exists, its persisted values (including ID) will be returned in a new
|
||||
* {@link JobInstance} object. If no previous run is found, a new job will
|
||||
* be created and returned.
|
||||
* @param jobInstanceProperties TODO
|
||||
* @param jobParameters TODO
|
||||
* @param jobConfiguration
|
||||
* describes the configuration for this job
|
||||
*
|
||||
@@ -64,7 +64,7 @@ public interface JobRepository {
|
||||
*
|
||||
*/
|
||||
public JobExecution createJobExecution(Job job,
|
||||
JobInstanceProperties jobInstanceProperties)
|
||||
JobParameters jobParameters)
|
||||
throws JobExecutionAlreadyRunningException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,29 +16,31 @@
|
||||
|
||||
package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
|
||||
/**
|
||||
* A factory for {@link JobIdentifier} instances. A job can be
|
||||
* A factory for {@link JobParameters} instances. A job can be
|
||||
* executed with many possible runtime parameters, which identify the instance
|
||||
* of the job. This factory allows job identifiers to be created with different
|
||||
* properties according to the {@link JobIdentifier} strategy required. For
|
||||
* properties according to the {@link JobParameters} strategy required. For
|
||||
* example some projects or jobs need a schedule date as part of the
|
||||
* {@link JobIdentifier} and some do not (e.g. for an ad-hoc execution a simple
|
||||
* {@link JobParameters} and some do not (e.g. for an ad-hoc execution a simple
|
||||
* label might be enough).
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface JobIdentifierFactory {
|
||||
public interface JobParametersFactory {
|
||||
|
||||
/**
|
||||
* Get a new {@link JobIdentifier} instance.
|
||||
* Get a new {@link JobParameters} instance.
|
||||
*
|
||||
* @param name
|
||||
* the name of the job.
|
||||
* @return a {@link JobIdentifier} with the same name.
|
||||
* @param properties
|
||||
* the runtime parameters in the form of String literals.
|
||||
* @return a {@link JobParameters} properties converted to the correct types.
|
||||
*/
|
||||
public JobIdentifier getJobIdentifier(String name);
|
||||
public JobParameters getJobParameters(Properties properties);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.core.runtime;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
import org.springframework.batch.core.domain.JobInstanceProperties;
|
||||
import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils;
|
||||
public class SimpleJobIdentifier implements JobIdentifier {
|
||||
|
||||
private String name;
|
||||
private JobInstanceProperties runtimeParameters;
|
||||
private JobParameters runtimeParameters;
|
||||
|
||||
/**
|
||||
* Default constructor. Since there it is required that the Identifier at least have a name,
|
||||
@@ -47,10 +47,10 @@ public class SimpleJobIdentifier implements JobIdentifier {
|
||||
* @param name
|
||||
*/
|
||||
public SimpleJobIdentifier(String name) {
|
||||
this(name, new JobInstanceProperties());
|
||||
this(name, new JobParameters());
|
||||
}
|
||||
|
||||
public SimpleJobIdentifier(String name, JobInstanceProperties runtimeParameters){
|
||||
public SimpleJobIdentifier(String name, JobParameters runtimeParameters){
|
||||
this.name = name;
|
||||
this.runtimeParameters = runtimeParameters;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class SimpleJobIdentifier implements JobIdentifier {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public JobInstanceProperties getJobInstanceProperties() {
|
||||
public JobParameters getJobInstanceProperties() {
|
||||
return runtimeParameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package org.springframework.batch.core.runtime;
|
||||
|
||||
import org.springframework.batch.core.domain.JobIdentifier;
|
||||
|
||||
|
||||
/**
|
||||
* Factory for {@link SimpleJobIdentifier} instances.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class SimpleJobIdentifierFactory implements JobIdentifierFactory {
|
||||
|
||||
/**
|
||||
* Create a {@link JobIdentifier} with the given name.
|
||||
*
|
||||
* @param name the name for the {@link JobIdentifier}
|
||||
* @return a {@link JobIdentifier} with the given name.
|
||||
*
|
||||
* @see org.springframework.batch.core.runtime.JobIdentifierFactory#getJobIdentifier(java.lang.String)
|
||||
*/
|
||||
public JobIdentifier getJobIdentifier(String name) {
|
||||
return new SimpleJobIdentifier(name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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