本文整理匯總了Java中org.springframework.batch.core.JobExecution.setCreateTime方法的典型用法代碼示例。如果您正苦於以下問題:Java JobExecution.setCreateTime方法的具體用法?Java JobExecution.setCreateTime怎麽用?Java JobExecution.setCreateTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.batch.core.JobExecution
的用法示例。
在下文中一共展示了JobExecution.setCreateTime方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mapRow
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
* @param resultSet Set the result set
* @param rowNumber Set the row number
* @throws SQLException if there is a problem
* @return a job execution instance
*/
public final JobExecution mapRow(final ResultSet resultSet,
final int rowNumber) throws SQLException {
JobInstance jobInstance = new JobInstance(resultSet.getBigDecimal(
"JOB_INSTANCE_ID").longValue(),
new JobParameters(), resultSet.getString("JOB_NAME"));
JobExecution jobExecution = new JobExecution(jobInstance,
resultSet.getBigDecimal("JOB_EXECUTION_ID").longValue());
jobExecution.setStartTime(resultSet.getTimestamp("START_TIME"));
jobExecution.setCreateTime(resultSet.getTimestamp("CREATE_TIME"));
jobExecution.setEndTime(resultSet.getTimestamp("END_TIME"));
jobExecution.setStatus(BatchStatus.valueOf(resultSet
.getString("STATUS")));
ExitStatus exitStatus = new ExitStatus(
resultSet.getString("EXIT_CODE"),
resultSet.getString("EXIT_MESSAGE"));
jobExecution.setExitStatus(exitStatus);
return jobExecution;
}
示例2: testFindExecutionsOrdering
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
* Executions should be returned in the reverse order they were saved.
*/
@Transactional
@Test
public void testFindExecutionsOrdering() {
List<JobExecution> execs = new ArrayList<>();
for (int i = 0; i < 10; i++) {
JobExecution exec = new JobExecution(jobInstance, jobParameters);
exec.setCreateTime(new Date(i));
execs.add(exec);
jobExecutionDao.saveJobExecution(exec);
}
Collections.reverse(execs);
List<JobExecution> retrieved = jobExecutionDao.findJobExecutions(jobInstance);
for (int i = 0; i < 10; i++) {
assertExecutionsAreEqual(execs.get(i), retrieved.get(i));
}
}
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:23,代碼來源:MarkLogicJobExecutionDaoTests.java
示例3: testGetLastExecution
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
* Check the execution with most recent start time is returned
*/
@Transactional
@Test
public void testGetLastExecution() {
JobExecution exec1 = new JobExecution(jobInstance, jobParameters);
exec1.setCreateTime(new Date(0));
JobExecution exec2 = new JobExecution(jobInstance, jobParameters);
exec2.setCreateTime(new Date(10));
jobExecutionDao.saveJobExecution(exec1);
jobExecutionDao.saveJobExecution(exec2);
JobExecution last = jobExecutionDao.getLastJobExecution(jobInstance);
assertEquals(exec2, last);
}
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:19,代碼來源:MarkLogicJobExecutionDaoTests.java
示例4: testGetExecution
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
* Check the execution is returned
*/
@Transactional
@Test
public void testGetExecution() {
JobExecution exec = new JobExecution(jobInstance, jobParameters);
exec.setCreateTime(new Date(0));
exec.createStepExecution("step");
jobExecutionDao.saveJobExecution(exec);
/*
if (getStepExecutionDao() != null) {
for (StepExecution stepExecution : exec.getStepExecutions()) {
getStepExecutionDao().saveStepExecution(stepExecution);
}
}
*/
JobExecution value = jobExecutionDao.getJobExecution(exec.getId());
assertEquals(exec, value);
// N.B. the job instance is not re-hydrated in the JDBC case...
}
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:24,代碼來源:MarkLogicJobExecutionDaoTests.java
示例5: testJobExecution
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
/**
*
*/
@Test
public final void testJobExecution() {
Map<String, JobParameter> jobParametersMap = new HashMap<String, JobParameter>();
jobParametersMap.put("authority.name", new JobParameter("test"));
JobInstance jobInstance = new JobInstance(1L, new JobParameters(
jobParametersMap), "testJob");
jobInstance.setVersion(1);
jobInstanceDao.save(jobInstance);
JobExecution jobExecution = new JobExecution(jobInstance, 1L);
jobExecution.setCreateTime(new Date());
jobExecutionDao.save(jobExecution);
jobExecutionDao.delete(1L);
jobInstanceDao.delete(1L);
}
示例6: unmarshal
import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public JobExecution unmarshal(AdaptedJobExecution v) throws Exception {
JobExecution jobExec = new JobExecution(v.getId(), v.getJobParameters());
jobExec.setJobInstance(v.getJobInstance());
jobExec.setCreateTime(v.getCreateDateTime());
jobExec.setEndTime(v.getEndDateTime());
jobExec.setLastUpdated(v.getLastUpdatedDateTime());
jobExec.setStartTime(v.getStartDateTime());
jobExec.setStatus(BatchStatus.valueOf(v.getStatus()));
jobExec.setExitStatus(new ExitStatus(v.getExitCode(), ""));
jobExec.addStepExecutions(v.getStepExecutions());
jobExec.setVersion(v.getVersion());
jobExec.setExecutionContext(v.getExecutionContext());
return jobExec;
}