Remove java.sql.Timestamp from domain objects.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.execution.job;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -118,7 +118,7 @@ public class DefaultJobExecutor implements JobExecutor {
|
||||
status = exceptionClassifier.classifyForExitCode(t);
|
||||
rethrow(t);
|
||||
} finally {
|
||||
execution.setEndTime(new Timestamp(System.currentTimeMillis()));
|
||||
execution.setEndTime(new Date(System.currentTimeMillis()));
|
||||
execution.setExitStatus(status);
|
||||
jobRepository.saveOrUpdate(execution);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.execution.step.simple;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -161,7 +161,7 @@ public class SimpleStepExecutor implements StepExecutor {
|
||||
stepScopeContext.setAttribute(StepScope.ID_KEY, stepExecution.getJobExecution().getJob().getIdentifier());
|
||||
|
||||
try {
|
||||
stepExecution.setStartTime(new Timestamp(System.currentTimeMillis()));
|
||||
stepExecution.setStartTime(new Date(System.currentTimeMillis()));
|
||||
updateStatus(stepExecution, BatchStatus.STARTED);
|
||||
|
||||
final boolean saveRestartData = configuration.isSaveRestartData();
|
||||
@@ -265,7 +265,7 @@ public class SimpleStepExecutor implements StepExecutor {
|
||||
}
|
||||
finally {
|
||||
stepExecution.setExitStatus(status);
|
||||
stepExecution.setEndTime(new Timestamp(System.currentTimeMillis()));
|
||||
stepExecution.setEndTime(new Date(System.currentTimeMillis()));
|
||||
try {
|
||||
jobRepository.saveOrUpdate(stepExecution);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.batch.execution.repository;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -174,7 +174,7 @@ public class SimpleJobRepositoryTests extends TestCase {
|
||||
executions.add(execution);
|
||||
// For this test it is important that the execution is finished
|
||||
// and the executions in the list contain one with an end date
|
||||
execution.setEndTime(new Timestamp(System.currentTimeMillis()));
|
||||
execution.setEndTime(new Date(System.currentTimeMillis()));
|
||||
jobDaoControl.setReturnValue(executions);
|
||||
jobDao.update(databaseJob);
|
||||
jobDao.save(new JobExecution(databaseJob));
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.batch.execution.repository.dao;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class AbstractJobDaoTests extends
|
||||
|
||||
protected JobExecution jobExecution;
|
||||
|
||||
protected Timestamp jobExecutionStartTime = new Timestamp(System
|
||||
protected Date jobExecutionStartTime = new Date(System
|
||||
.currentTimeMillis());
|
||||
|
||||
protected String[] getConfigLocations() {
|
||||
@@ -74,7 +74,7 @@ public abstract class AbstractJobDaoTests extends
|
||||
job = jobDao.createJob(jobRuntimeInformation);
|
||||
|
||||
// Create an execution
|
||||
jobExecutionStartTime = new Timestamp(System.currentTimeMillis());
|
||||
jobExecutionStartTime = new Date(System.currentTimeMillis());
|
||||
jobExecution = new JobExecution(job);
|
||||
jobExecution.setStartTime(jobExecutionStartTime);
|
||||
jobExecution.setStatus(BatchStatus.STARTED);
|
||||
@@ -188,7 +188,7 @@ public abstract class AbstractJobDaoTests extends
|
||||
|
||||
jobExecution.setStatus(BatchStatus.COMPLETED);
|
||||
jobExecution.setExitStatus(ExitStatus.FINISHED);
|
||||
jobExecution.setEndTime(new Timestamp(System.currentTimeMillis()));
|
||||
jobExecution.setEndTime(new Date(System.currentTimeMillis()));
|
||||
jobDao.update(jobExecution);
|
||||
|
||||
List executions = jobDao.findJobExecutions(job);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.execution.repository.dao;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
|
||||
|
||||
stepExecution = new StepExecution(step1, jobExecution);
|
||||
stepExecution.setStatus(BatchStatus.STARTED);
|
||||
stepExecution.setStartTime(new Timestamp(System.currentTimeMillis()));
|
||||
stepExecution.setStartTime(new Date(System.currentTimeMillis()));
|
||||
stepDao.save(stepExecution);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
|
||||
|
||||
StepExecution execution = new StepExecution(step2, jobExecution);
|
||||
execution.setStatus(BatchStatus.STARTED);
|
||||
execution.setStartTime(new Timestamp(System.currentTimeMillis()));
|
||||
execution.setStartTime(new Date(System.currentTimeMillis()));
|
||||
Properties statistics = new Properties();
|
||||
statistics.setProperty("statistic.key1", "0");
|
||||
statistics.setProperty("statistic.key2", "5");
|
||||
@@ -180,7 +180,7 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour
|
||||
public void testUpdateStepExecution(){
|
||||
|
||||
stepExecution.setStatus(BatchStatus.COMPLETED);
|
||||
stepExecution.setEndTime(new Timestamp(System.currentTimeMillis()));
|
||||
stepExecution.setEndTime(new Date(System.currentTimeMillis()));
|
||||
stepExecution.setCommitCount(5);
|
||||
stepExecution.setTaskCount(5);
|
||||
stepExecution.setStatistics(new Properties());
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.execution.runtime;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -80,7 +79,7 @@ public class ScheduledJobIdentifierTests extends TestCase {
|
||||
public void testEqualsInstanceWithTimestamp() throws Exception {
|
||||
ScheduledJobIdentifier other = new ScheduledJobIdentifier(instance.getName());
|
||||
other.setJobKey(instance.getJobKey());
|
||||
other.setScheduleDate(new Timestamp(instance.getScheduleDate().getTime()));
|
||||
other.setScheduleDate(new Date(instance.getScheduleDate().getTime()));
|
||||
assertEquals(instance, other);
|
||||
assertEquals(other, instance);
|
||||
assertEquals(instance.hashCode(), other.hashCode());
|
||||
|
||||
Reference in New Issue
Block a user