Send test coverage in core up to the high 90s.

This commit is contained in:
dsyer
2008-01-30 08:02:29 +00:00
parent 1cf29b8241
commit 152829ba5f
18 changed files with 472 additions and 159 deletions

View File

@@ -98,7 +98,7 @@ public class Entity implements Serializable {
}
Entity entity = (Entity) other;
if (id == null || entity.getId() == null) {
return entity == this;
return false;
}
return id.equals(entity.getId());
}

View File

@@ -51,14 +51,13 @@ public class JobExecution extends Entity {
* Because a JobExecution isn't valid unless the job is set, this
* constructor is the only valid one from a modelling point of view.
*
* @param job
* the job of which this execution is a part
* @param job the job of which this execution is a part
*/
public JobExecution(JobInstance job, Long id) {
super(id);
this.jobInstance = job;
}
/**
* Constructor for transient (unsaved) instances.
*
@@ -145,34 +144,33 @@ public class JobExecution extends Entity {
this.stepExecutions.add(stepExecution);
return stepExecution;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
* @see org.springframework.batch.core.domain.Entity#toString()
*/
public String toString() {
return super.toString()+", startTime="+startTime+", endTime="+endTime+", job=["+jobInstance+"]";
return super.toString() + ", startTime=" + startTime + ", endTime=" + endTime + ", job=[" + jobInstance + "]";
}
/**
* Test if this {@link JobExecution} indicates that it is running. It should
* be noted that this does not necessarily mean that it has been
* persisted as such yet.
* Test if this {@link JobExecution} indicates that it is running. It should
* be noted that this does not necessarily mean that it has been persisted
* as such yet.
* @return true if the end time is null
*/
public boolean isRunning() {
return endTime==null;
return endTime == null;
}
/**
* Stop the JobExecution, each StepExecution will be iterated through, calling
* setTermianteOnly, signaling to the StepExecutor currently running that it should
* be terminated.
* Signal the {@link JobExecution} to stop. Iterates through the associated
* {@link StepExecution}s, calling {@link StepExecution#setTerminateOnly()}.
*
*/
public void stop(){
for(Iterator it = stepExecutions.iterator();it.hasNext();){
StepExecution stepExecution = (StepExecution)it.next();
public void stop() {
for (Iterator it = stepExecutions.iterator(); it.hasNext();) {
StepExecution stepExecution = (StepExecution) it.next();
stepExecution.setTerminateOnly();
}
}

View File

@@ -196,7 +196,6 @@ public class JobParameters {
}
public int hashCode() {
return new HashCodeBuilder(7, 21).
append(stringMap).
append(longMap).

View File

@@ -139,6 +139,6 @@ public class JobSupport implements BeanNameAware, Job {
}
public String toString() {
return ClassUtils.getShortName(JobSupport.class) + ": [name=" + name + "]";
return ClassUtils.getShortName(getClass()) + ": [name=" + name + "]";
}
}

View File

@@ -169,7 +169,7 @@ public class StepExecution extends Entity {
public boolean equals(Object obj) {
Object stepId = getStepId();
Object jobExecutionId = getJobExecutionId();
if (stepId == null && jobExecutionId == null || !(obj instanceof StepExecution) || getId() != null) {
if (stepId == null && jobExecutionId == null || !(obj instanceof StepExecution) || getId() == null) {
return super.equals(obj);
}
StepExecution other = (StepExecution) obj;