Set Spring Cloud Task Date Strategy to match Batch

resolves #868
Signed-off-by: Glenn Renfro <grenfro@vmware.com>

Updated the timestamps for H2,oracle, db2, hsqldb to be 9 digits for improved accuracy
This commit is contained in:
Glenn Renfro
2022-10-18 08:17:38 -04:00
parent cf8056880b
commit a0fda4bf6e
30 changed files with 243 additions and 247 deletions

View File

@@ -19,7 +19,6 @@ package org.springframework.cloud.task.batch.handler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -156,8 +155,6 @@ public class TaskJobLauncherApplicationRunner extends JobLauncherApplicationRunn
private void monitorJobExecutions() {
RepeatTemplate template = new RepeatTemplate();
Date startDate = new Date();
template.iterate(context -> {
List<JobExecution> failedJobExecutions = new ArrayList<>();

View File

@@ -16,6 +16,7 @@
package org.springframework.cloud.task.batch.partition;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -91,7 +92,7 @@ public class DeployerPartitionHandlerTests {
public void setUp() {
MockitoAnnotations.openMocks(this);
this.environment = new MockEnvironment();
TaskExecution taskExecution = new TaskExecution(2, 0, "name", new Date(), new Date(), "",
TaskExecution taskExecution = new TaskExecution(2, 0, "name", LocalDateTime.now(), LocalDateTime.now(), "",
Collections.emptyList(), null, null, null);
Mockito.lenient().when(taskRepository.createTaskExecution()).thenReturn(taskExecution);
}

View File

@@ -19,11 +19,11 @@ package org.springframework.cloud.task.listener;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import io.micrometer.observation.ObservationConvention;
@@ -191,7 +191,7 @@ public class TaskLifecycleListener
private void doTaskEnd() {
if ((this.listenerFailed || this.started) && !this.finished) {
this.taskExecution.setEndTime(new Date());
this.taskExecution.setEndTime(LocalDateTime.now());
if (this.applicationFailedException != null) {
this.taskExecution.setErrorMessage(stackTraceToString(this.applicationFailedException));
@@ -277,7 +277,8 @@ public class TaskLifecycleListener
Assert.isNull(taskExecution.getEndTime(),
String.format("Invalid TaskExecution, ID %s task is already complete",
this.taskProperties.getExecutionid()));
Date startDate = (taskExecution.getStartTime() == null) ? new Date() : taskExecution.getStartTime();
LocalDateTime startDate = (taskExecution.getStartTime() == null) ? LocalDateTime.now()
: taskExecution.getStartTime();
this.taskExecution = this.taskRepository.startTaskExecution(this.taskProperties.getExecutionid(),
this.taskNameResolver.getTaskName(), startDate, args,
this.taskProperties.getExternalExecutionId(), this.taskProperties.getParentExecutionId());
@@ -285,7 +286,7 @@ public class TaskLifecycleListener
else {
TaskExecution taskExecution = new TaskExecution();
taskExecution.setTaskName(this.taskNameResolver.getTaskName());
taskExecution.setStartTime(new Date());
taskExecution.setStartTime(LocalDateTime.now());
taskExecution.setArguments(args);
taskExecution.setExternalExecutionId(this.taskProperties.getExternalExecutionId());
taskExecution.setParentExecutionId(this.taskProperties.getParentExecutionId());
@@ -384,8 +385,8 @@ public class TaskLifecycleListener
}
private TaskExecution getTaskExecutionCopy(TaskExecution taskExecution) {
Date startTime = new Date(taskExecution.getStartTime().getTime());
Date endTime = (taskExecution.getEndTime() == null) ? null : new Date(taskExecution.getEndTime().getTime());
LocalDateTime startTime = taskExecution.getStartTime();
LocalDateTime endTime = taskExecution.getEndTime();
return new TaskExecution(taskExecution.getExecutionId(), taskExecution.getExitCode(),
taskExecution.getTaskName(), startTime, endTime, taskExecution.getExitMessage(),

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.repository;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.util.Assert;
@@ -55,12 +55,12 @@ public class TaskExecution {
/**
* Time of when the task was started.
*/
private Date startTime;
private LocalDateTime startTime;
/**
* Timestamp of when the task was completed/terminated.
*/
private Date endTime;
private LocalDateTime endTime;
/**
* Message returned from the task or stacktrace.
@@ -90,9 +90,9 @@ public class TaskExecution {
this.arguments = new ArrayList<>();
}
public TaskExecution(long executionId, Integer exitCode, String taskName, Date startTime, Date endTime,
String exitMessage, List<String> arguments, String errorMessage, String externalExecutionId,
Long parentExecutionId) {
public TaskExecution(long executionId, Integer exitCode, String taskName, LocalDateTime startTime,
LocalDateTime endTime, String exitMessage, List<String> arguments, String errorMessage,
String externalExecutionId, Long parentExecutionId) {
Assert.notNull(arguments, "arguments must not be null");
this.executionId = executionId;
@@ -100,15 +100,16 @@ public class TaskExecution {
this.taskName = taskName;
this.exitMessage = exitMessage;
this.arguments = new ArrayList<>(arguments);
this.startTime = (startTime != null) ? (Date) startTime.clone() : null;
this.endTime = (endTime != null) ? (Date) endTime.clone() : null;
this.startTime = startTime;
this.endTime = endTime;
this.errorMessage = errorMessage;
this.externalExecutionId = externalExecutionId;
this.parentExecutionId = parentExecutionId;
}
public TaskExecution(long executionId, Integer exitCode, String taskName, Date startTime, Date endTime,
String exitMessage, List<String> arguments, String errorMessage, String externalExecutionId) {
public TaskExecution(long executionId, Integer exitCode, String taskName, LocalDateTime startTime,
LocalDateTime endTime, String exitMessage, List<String> arguments, String errorMessage,
String externalExecutionId) {
this(executionId, exitCode, taskName, startTime, endTime, exitMessage, arguments, errorMessage,
externalExecutionId, null);
@@ -134,20 +135,20 @@ public class TaskExecution {
this.taskName = taskName;
}
public Date getStartTime() {
return (this.startTime != null) ? (Date) this.startTime.clone() : null;
public LocalDateTime getStartTime() {
return this.startTime;
}
public void setStartTime(Date startTime) {
this.startTime = (startTime != null) ? (Date) startTime.clone() : null;
public void setStartTime(LocalDateTime startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return (this.endTime != null) ? (Date) this.endTime.clone() : null;
public LocalDateTime getEndTime() {
return this.endTime;
}
public void setEndTime(Date endTime) {
this.endTime = (endTime != null) ? (Date) endTime.clone() : null;
public void setEndTime(LocalDateTime endTime) {
this.endTime = endTime;
}
public String getExitMessage() {

View File

@@ -16,7 +16,7 @@
package org.springframework.cloud.task.repository;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
@@ -40,7 +40,7 @@ public interface TaskRepository {
* @return the updated {@link TaskExecution}
*/
@Transactional("${spring.cloud.task.transaction-manager:springCloudTaskTransactionManager}")
TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage);
TaskExecution completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage);
/**
* Notifies the repository that a taskExecution has completed.
@@ -53,7 +53,7 @@ public interface TaskRepository {
* @since 1.1.0
*/
@Transactional("${spring.cloud.task.transaction-manager:springCloudTaskTransactionManager}")
TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage,
TaskExecution completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage,
String errorMessage);
/**
@@ -99,7 +99,7 @@ public interface TaskRepository {
* @return TaskExecution created based on the parameters.
*/
@Transactional("${spring.cloud.task.transaction-manager:springCloudTaskTransactionManager}")
TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments,
TaskExecution startTaskExecution(long executionid, String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId);
/**
@@ -122,7 +122,7 @@ public interface TaskRepository {
* a TaskExecution.
*/
@Transactional("${spring.cloud.task.transaction-manager:springCloudTaskTransactionManager}")
TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments,
TaskExecution startTaskExecution(long executionid, String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId, Long parentExecutionId);
}

View File

@@ -18,10 +18,11 @@ package org.springframework.cloud.task.repository.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -199,13 +200,13 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
}
@Override
public TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments,
public TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId) {
return createTaskExecution(taskName, startTime, arguments, externalExecutionId, null);
}
@Override
public TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments,
public TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId, Long parentExecutionId) {
long nextExecutionId = getNextExecutionId();
@@ -214,8 +215,9 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
final MapSqlParameterSource queryParameters = new MapSqlParameterSource()
.addValue("taskExecutionId", nextExecutionId, Types.BIGINT).addValue("exitCode", null, Types.INTEGER)
.addValue("startTime", startTime, Types.TIMESTAMP).addValue("taskName", taskName, Types.VARCHAR)
.addValue("lastUpdated", new Date(), Types.TIMESTAMP)
.addValue("startTime", startTime == null ? null : Timestamp.valueOf(startTime), Types.TIMESTAMP)
.addValue("taskName", taskName, Types.VARCHAR)
.addValue("lastUpdated", Timestamp.valueOf(LocalDateTime.now()), Types.TIMESTAMP)
.addValue("externalExecutionId", externalExecutionId, Types.VARCHAR)
.addValue("parentExecutionId", parentExecutionId, Types.BIGINT);
@@ -225,20 +227,21 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
}
@Override
public TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments,
String externalExecutionId) {
public TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime,
List<String> arguments, String externalExecutionId) {
return startTaskExecution(executionId, taskName, startTime, arguments, externalExecutionId, null);
}
@Override
public TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments,
String externalExecutionId, Long parentExecutionId) {
public TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime,
List<String> arguments, String externalExecutionId, Long parentExecutionId) {
TaskExecution taskExecution = new TaskExecution(executionId, null, taskName, startTime, null, null, arguments,
null, externalExecutionId, parentExecutionId);
final MapSqlParameterSource queryParameters = new MapSqlParameterSource()
.addValue("startTime", startTime, Types.TIMESTAMP).addValue("exitCode", null, Types.INTEGER)
.addValue("taskName", taskName, Types.VARCHAR).addValue("lastUpdated", new Date(), Types.TIMESTAMP)
.addValue("startTime", startTime == null ? null : Timestamp.valueOf(startTime), Types.TIMESTAMP)
.addValue("exitCode", null, Types.INTEGER).addValue("taskName", taskName, Types.VARCHAR)
.addValue("lastUpdated", Timestamp.valueOf(LocalDateTime.now()), Types.TIMESTAMP)
.addValue("parentExecutionId", parentExecutionId, Types.BIGINT)
.addValue("taskExecutionId", executionId, Types.BIGINT);
@@ -258,7 +261,7 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
}
@Override
public void completeTaskExecution(long taskExecutionId, Integer exitCode, Date endTime, String exitMessage,
public void completeTaskExecution(long taskExecutionId, Integer exitCode, LocalDateTime endTime, String exitMessage,
String errorMessage) {
final MapSqlParameterSource queryParameters = new MapSqlParameterSource().addValue("taskExecutionId",
taskExecutionId, Types.BIGINT);
@@ -271,17 +274,18 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
}
final MapSqlParameterSource parameters = new MapSqlParameterSource()
.addValue("endTime", endTime, Types.TIMESTAMP).addValue("exitCode", exitCode, Types.INTEGER)
.addValue("exitMessage", exitMessage, Types.VARCHAR)
.addValue("endTime", endTime == null ? null : Timestamp.valueOf(endTime), Types.TIMESTAMP)
.addValue("exitCode", exitCode, Types.INTEGER).addValue("exitMessage", exitMessage, Types.VARCHAR)
.addValue("errorMessage", errorMessage, Types.VARCHAR)
.addValue("lastUpdated", new Date(), Types.TIMESTAMP)
.addValue("lastUpdated", Timestamp.valueOf(LocalDateTime.now()), Types.TIMESTAMP)
.addValue("taskExecutionId", taskExecutionId, Types.BIGINT);
this.jdbcTemplate.update(getQuery(UPDATE_TASK_EXECUTION), parameters);
}
@Override
public void completeTaskExecution(long taskExecutionId, Integer exitCode, Date endTime, String exitMessage) {
public void completeTaskExecution(long taskExecutionId, Integer exitCode, LocalDateTime endTime,
String exitMessage) {
completeTaskExecution(taskExecutionId, exitCode, endTime, exitMessage, null);
}
@@ -582,9 +586,9 @@ public class JdbcTaskExecutionDao implements TaskExecutionDao {
parentExecutionId = null;
}
return new TaskExecution(id, getNullableExitCode(rs), rs.getString("TASK_NAME"),
rs.getTimestamp("START_TIME"), rs.getTimestamp("END_TIME"), rs.getString("EXIT_MESSAGE"),
getTaskArguments(id), rs.getString("ERROR_MESSAGE"), rs.getString("EXTERNAL_EXECUTION_ID"),
parentExecutionId);
rs.getObject("START_TIME", LocalDateTime.class), rs.getObject("END_TIME", LocalDateTime.class),
rs.getString("EXIT_MESSAGE"), getTaskArguments(id), rs.getString("ERROR_MESSAGE"),
rs.getString("EXTERNAL_EXECUTION_ID"), parentExecutionId);
}
private Integer getNullableExitCode(ResultSet rs) throws SQLException {

View File

@@ -17,10 +17,10 @@
package org.springframework.cloud.task.repository.dao;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -58,13 +58,13 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
}
@Override
public TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments,
public TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId) {
return createTaskExecution(taskName, startTime, arguments, externalExecutionId, null);
}
@Override
public TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments,
public TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId, Long parentExecutionId) {
long taskExecutionId = getNextExecutionId();
TaskExecution taskExecution = new TaskExecution(taskExecutionId, null, taskName, startTime, null, null,
@@ -74,14 +74,14 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
}
@Override
public TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments,
String externalExecutionid) {
public TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime,
List<String> arguments, String externalExecutionid) {
return startTaskExecution(executionId, taskName, startTime, arguments, externalExecutionid, null);
}
@Override
public TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments,
String externalExecutionid, Long parentExecutionId) {
public TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime,
List<String> arguments, String externalExecutionid, Long parentExecutionId) {
TaskExecution taskExecution = this.taskExecutions.get(executionId);
taskExecution.setTaskName(taskName);
taskExecution.setStartTime(startTime);
@@ -94,7 +94,7 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
}
@Override
public void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage,
public void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage,
String errorMessage) {
if (!this.taskExecutions.containsKey(executionId)) {
throw new IllegalStateException("Invalid TaskExecution, ID " + executionId + " not found.");
@@ -108,7 +108,7 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
}
@Override
public void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) {
public void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage) {
completeTaskExecution(executionId, exitCode, endTime, exitMessage, null);
}
@@ -287,7 +287,7 @@ public class MapTaskExecutionDao implements TaskExecutionDao {
final TaskExecution tempTaskExecution = tempTaskExecutions
.get(taskExecutionMapEntry.getValue().getTaskName());
if (tempTaskExecution == null
|| tempTaskExecution.getStartTime().before(taskExecutionMapEntry.getValue().getStartTime())
|| tempTaskExecution.getStartTime().isBefore(taskExecutionMapEntry.getValue().getStartTime())
|| (tempTaskExecution.getStartTime().equals(taskExecutionMapEntry.getValue().getStartTime())
&& tempTaskExecution.getExecutionId() < taskExecutionMapEntry.getValue()
.getExecutionId())) {

View File

@@ -16,7 +16,7 @@
package org.springframework.cloud.task.repository.dao;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
@@ -42,7 +42,7 @@ public interface TaskExecutionDao {
* @param externalExecutionId id assigned to the task by the platform
* @return A fully qualified {@link TaskExecution} instance.
*/
TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments,
TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId);
/**
@@ -55,7 +55,7 @@ public interface TaskExecutionDao {
* @return A fully qualified {@link TaskExecution} instance.
* @since 1.2.0
*/
TaskExecution createTaskExecution(String taskName, Date startTime, List<String> arguments,
TaskExecution createTaskExecution(String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId, Long parentExecutionId);
/**
@@ -69,7 +69,7 @@ public interface TaskExecutionDao {
* start.
* @since 1.1.0
*/
TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments,
TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId);
/**
@@ -84,7 +84,7 @@ public interface TaskExecutionDao {
* start.
* @since 1.2.0
*/
TaskExecution startTaskExecution(long executionId, String taskName, Date startTime, List<String> arguments,
TaskExecution startTaskExecution(long executionId, String taskName, LocalDateTime startTime, List<String> arguments,
String externalExecutionId, Long parentExecutionId);
/**
@@ -96,7 +96,7 @@ public interface TaskExecutionDao {
* @param errorMessage error information available upon failure of a task.
* @since 1.1.0
*/
void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage,
void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage,
String errorMessage);
/**
@@ -106,7 +106,7 @@ public interface TaskExecutionDao {
* @param endTime the time the task completed.
* @param exitMessage the message assigned to the task upon completion.
*/
void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage);
void completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime, String exitMessage);
/**
* Retrieves a task execution from the task repository.

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.repository.support;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
@@ -87,13 +87,14 @@ public class SimpleTaskRepository implements TaskRepository {
}
@Override
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) {
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime,
String exitMessage) {
return completeTaskExecution(executionId, exitCode, endTime, exitMessage, null);
}
@Override
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage,
String errorMessage) {
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, LocalDateTime endTime,
String exitMessage, String errorMessage) {
initialize();
validateCompletedTaskExitInformation(executionId, exitCode, endTime);
@@ -133,8 +134,8 @@ public class SimpleTaskRepository implements TaskRepository {
}
@Override
public TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments,
String externalExecutionId) {
public TaskExecution startTaskExecution(long executionid, String taskName, LocalDateTime startTime,
List<String> arguments, String externalExecutionId) {
return startTaskExecution(executionid, taskName, startTime, arguments, externalExecutionId, null);
}
@@ -145,8 +146,8 @@ public class SimpleTaskRepository implements TaskRepository {
}
@Override
public TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments,
String externalExecutionId, Long parentExecutionId) {
public TaskExecution startTaskExecution(long executionid, String taskName, LocalDateTime startTime,
List<String> arguments, String externalExecutionId, Long parentExecutionId) {
initialize();
TaskExecution taskExecution = this.taskExecutionDao.startTaskExecution(executionid, taskName, startTime,
arguments, externalExecutionId, parentExecutionId);
@@ -187,7 +188,7 @@ public class SimpleTaskRepository implements TaskRepository {
}
}
private void validateCompletedTaskExitInformation(long executionId, Integer exitCode, Date endTime) {
private void validateCompletedTaskExitInformation(long executionId, Integer exitCode, LocalDateTime endTime) {
Assert.notNull(exitCode, "exitCode should not be null");
Assert.isTrue(exitCode >= 0, "exit code must be greater than or equal to zero");
Assert.notNull(endTime, "TaskExecution endTime cannot be null.");

View File

@@ -1,13 +1,13 @@
CREATE TABLE TASK_EXECUTION (
TASK_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY ,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
START_TIME TIMESTAMP(9) DEFAULT NULL ,
END_TIME TIMESTAMP(9) DEFAULT NULL ,
TASK_NAME VARCHAR(100) ,
EXIT_CODE INTEGER ,
EXIT_MESSAGE VARCHAR(2500) ,
ERROR_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
LAST_UPDATED TIMESTAMP(9),
EXTERNAL_EXECUTION_ID VARCHAR(255),
PARENT_EXECUTION_ID BIGINT
);
@@ -32,6 +32,6 @@ CREATE TABLE TASK_LOCK (
LOCK_KEY CHAR(36) NOT NULL,
REGION VARCHAR(100) NOT NULL,
CLIENT_ID CHAR(36),
CREATED_DATE TIMESTAMP NOT NULL,
CREATED_DATE TIMESTAMP(9) NOT NULL,
constraint LOCK_PK primary key (LOCK_KEY, REGION)
);

View File

@@ -1,13 +1,13 @@
CREATE TABLE TASK_EXECUTION (
TASK_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY ,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
START_TIME TIMESTAMP(9) DEFAULT NULL ,
END_TIME TIMESTAMP(9) DEFAULT NULL ,
TASK_NAME VARCHAR(100) ,
EXIT_CODE INTEGER ,
EXIT_MESSAGE VARCHAR(2500) ,
ERROR_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
LAST_UPDATED TIMESTAMP(9),
EXTERNAL_EXECUTION_ID VARCHAR(255),
PARENT_EXECUTION_ID BIGINT
);
@@ -32,6 +32,6 @@ CREATE TABLE TASK_LOCK (
LOCK_KEY CHAR(36) NOT NULL,
REGION VARCHAR(100) NOT NULL,
CLIENT_ID CHAR(36),
CREATED_DATE TIMESTAMP NOT NULL,
CREATED_DATE TIMESTAMP(9) NOT NULL,
constraint LOCK_PK primary key (LOCK_KEY, REGION)
);

View File

@@ -1,13 +1,13 @@
CREATE TABLE TASK_EXECUTION (
TASK_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY ,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
START_TIME TIMESTAMP(9) DEFAULT NULL ,
END_TIME TIMESTAMP(9) DEFAULT NULL ,
TASK_NAME VARCHAR(100) ,
EXIT_CODE INTEGER ,
EXIT_MESSAGE VARCHAR(2500) ,
ERROR_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
LAST_UPDATED TIMESTAMP(9),
EXTERNAL_EXECUTION_ID VARCHAR(255),
PARENT_EXECUTION_ID BIGINT
);
@@ -34,6 +34,6 @@ CREATE TABLE TASK_LOCK (
LOCK_KEY CHAR(36) NOT NULL,
REGION VARCHAR(100) NOT NULL,
CLIENT_ID CHAR(36),
CREATED_DATE TIMESTAMP NOT NULL,
CREATED_DATE TIMESTAMP(9) NOT NULL,
constraint LOCK_PK primary key (LOCK_KEY, REGION)
);

View File

@@ -1,13 +1,13 @@
CREATE TABLE TASK_EXECUTION (
TASK_EXECUTION_ID NUMBER NOT NULL PRIMARY KEY ,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
START_TIME TIMESTAMP(9) DEFAULT NULL ,
END_TIME TIMESTAMP(9) DEFAULT NULL ,
TASK_NAME VARCHAR2(100) ,
EXIT_CODE INTEGER ,
EXIT_MESSAGE VARCHAR2(2500) ,
ERROR_MESSAGE VARCHAR2(2500) ,
LAST_UPDATED TIMESTAMP,
LAST_UPDATED TIMESTAMP(9),
EXTERNAL_EXECUTION_ID VARCHAR2(255),
PARENT_EXECUTION_ID NUMBER
);
@@ -32,6 +32,6 @@ CREATE TABLE TASK_LOCK (
LOCK_KEY VARCHAR2(36) NOT NULL,
REGION VARCHAR2(100) NOT NULL,
CLIENT_ID VARCHAR2(36),
CREATED_DATE TIMESTAMP NOT NULL,
CREATED_DATE TIMESTAMP(9) NOT NULL,
constraint LOCK_PK primary key (LOCK_KEY, REGION)
);

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.configuration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import javax.sql.DataSource;
@@ -93,7 +93,7 @@ public class RepositoryTransactionManagerConfigurationTests {
TaskExecution taskExecution = taskRepository.createTaskExecution("transactionManagerTask");
taskExecution = taskRepository.startTaskExecution(taskExecution.getExecutionId(),
taskExecution.getTaskName(), new Date(), new ArrayList<>(0), null);
taskExecution.getTaskName(), LocalDateTime.now(), new ArrayList<>(0), null);
TaskLifecycleListener listener = context.getBean(TaskLifecycleListener.class);

View File

@@ -17,8 +17,8 @@
package org.springframework.cloud.task.listener;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
@@ -81,8 +81,8 @@ public class TaskExecutionListenerTests {
setupContextForTaskExecutionListener();
DefaultTaskListenerConfiguration.TestTaskExecutionListener taskExecutionListener = this.context
.getBean(DefaultTaskListenerConfiguration.TestTaskExecutionListener.class);
TaskExecution taskExecution = new TaskExecution(0, null, "wombat", new Date(), new Date(), null,
new ArrayList<>(), null, null);
TaskExecution taskExecution = new TaskExecution(0, null, "wombat", LocalDateTime.now(), LocalDateTime.now(),
null, new ArrayList<>(), null, null);
verifyListenerResults(false, false, taskExecution, taskExecutionListener);
}
@@ -155,8 +155,8 @@ public class TaskExecutionListenerTests {
this.context.publishEvent(new ApplicationReadyEvent(new SpringApplication(), new String[0], this.context,
Duration.ofSeconds(50)));
TaskExecution taskExecution = new TaskExecution(0, 0, "wombat", new Date(), new Date(), null, new ArrayList<>(),
null, null);
TaskExecution taskExecution = new TaskExecution(0, 0, "wombat", LocalDateTime.now(), LocalDateTime.now(), null,
new ArrayList<>(), null, null);
verifyListenerResults(true, false, taskExecution, taskExecutionListener);
}
@@ -175,8 +175,8 @@ public class TaskExecutionListenerTests {
this.context.publishEvent(
new ApplicationReadyEvent(application, new String[0], this.context, Duration.ofSeconds(50)));
TaskExecution taskExecution = new TaskExecution(0, 1, "wombat", new Date(), new Date(), null, new ArrayList<>(),
null, null);
TaskExecution taskExecution = new TaskExecution(0, 1, "wombat", LocalDateTime.now(), LocalDateTime.now(), null,
new ArrayList<>(), null, null);
verifyListenerResults(true, true, taskExecution, taskExecutionListener);
}
@@ -189,8 +189,8 @@ public class TaskExecutionListenerTests {
setupContextForAnnotatedListener();
DefaultAnnotationConfiguration.AnnotatedTaskListener annotatedListener = this.context
.getBean(DefaultAnnotationConfiguration.AnnotatedTaskListener.class);
TaskExecution taskExecution = new TaskExecution(0, null, "wombat", new Date(), new Date(), null,
new ArrayList<>(), null, null);
TaskExecution taskExecution = new TaskExecution(0, null, "wombat", LocalDateTime.now(), LocalDateTime.now(),
null, new ArrayList<>(), null, null);
verifyListenerResults(false, false, taskExecution, annotatedListener);
}
@@ -206,8 +206,8 @@ public class TaskExecutionListenerTests {
this.context.publishEvent(new ApplicationReadyEvent(new SpringApplication(), new String[0], this.context,
Duration.ofSeconds(50)));
TaskExecution taskExecution = new TaskExecution(0, 0, "wombat", new Date(), new Date(), null, new ArrayList<>(),
null, null);
TaskExecution taskExecution = new TaskExecution(0, 0, "wombat", LocalDateTime.now(), LocalDateTime.now(), null,
new ArrayList<>(), null, null);
verifyListenerResults(true, false, taskExecution, annotatedListener);
}
@@ -226,8 +226,8 @@ public class TaskExecutionListenerTests {
this.context.publishEvent(
new ApplicationReadyEvent(application, new String[0], this.context, Duration.ofSeconds(50)));
TaskExecution taskExecution = new TaskExecution(0, 1, "wombat", new Date(), new Date(), null, new ArrayList<>(),
null, null);
TaskExecution taskExecution = new TaskExecution(0, 1, "wombat", LocalDateTime.now(), LocalDateTime.now(), null,
new ArrayList<>(), null, null);
verifyListenerResults(true, true, taskExecution, annotatedListener);
}

View File

@@ -255,7 +255,8 @@ public class TaskLifecycleListenerTests {
}
if (update) {
assertThat(taskExecution.getEndTime().getTime() >= taskExecution.getStartTime().getTime()).isTrue();
assertThat(taskExecution.getEndTime().isAfter(taskExecution.getStartTime())
|| taskExecution.getEndTime().isEqual(taskExecution.getStartTime())).isTrue();
assertThat(taskExecution.getExitCode()).isNotNull();
}
else {

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.micrometer;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import io.micrometer.core.instrument.LongTaskTimer;
import io.micrometer.core.instrument.Tags;
@@ -99,8 +99,8 @@ public class TaskObservationsTests {
@Test
public void defaultTaskTest() {
TaskExecution taskExecution = new TaskExecution(123L, 0, null, new Date(), new Date(), null, new ArrayList<>(),
null, null, null);
TaskExecution taskExecution = new TaskExecution(123L, 0, null, LocalDateTime.now(), LocalDateTime.now(), null,
new ArrayList<>(), null, null, null);
// Start Task
taskObservations.onTaskStartup(taskExecution);
@@ -274,8 +274,8 @@ public class TaskObservationsTests {
}
private TaskExecution startupObservationForBasicTests(String taskName, long taskExecutionId) {
TaskExecution taskExecution = new TaskExecution(taskExecutionId, 0, taskName, new Date(), new Date(), null,
new ArrayList<>(), null, "-1", -1L);
TaskExecution taskExecution = new TaskExecution(taskExecutionId, 0, taskName, LocalDateTime.now(),
LocalDateTime.now(), null, new ArrayList<>(), null, "-1", -1L);
// Start Task
taskObservations.onTaskStartup(taskExecution);

View File

@@ -16,10 +16,8 @@
package org.springframework.cloud.task.repository.dao;
import java.util.Calendar;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.List;
import java.util.TimeZone;
import org.junit.jupiter.api.Test;
@@ -90,15 +88,12 @@ public abstract class BaseTaskExecutionDaoTestCases {
final TaskExecution lastTaskExecution = latestTaskExecutions.get(0);
assertThat(lastTaskExecution.getTaskName()).isEqualTo("FOO1");
final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTime.setTime(lastTaskExecution.getStartTime());
assertThat(dateTime.get(Calendar.YEAR)).isEqualTo(2015);
assertThat(dateTime.get(Calendar.MONTH) + 1).isEqualTo(2);
assertThat(dateTime.get(Calendar.DAY_OF_MONTH)).isEqualTo(22);
assertThat(dateTime.get(Calendar.HOUR_OF_DAY)).isEqualTo(23);
assertThat(dateTime.get(Calendar.MINUTE)).isEqualTo(59);
assertThat(dateTime.get(Calendar.SECOND)).isEqualTo(0);
assertThat(lastTaskExecution.getStartTime().getYear()).isEqualTo(2015);
assertThat(lastTaskExecution.getStartTime().getMonthValue()).isEqualTo(2);
assertThat(lastTaskExecution.getStartTime().getDayOfMonth()).isEqualTo(22);
assertThat(lastTaskExecution.getStartTime().getHour()).isEqualTo(23);
assertThat(lastTaskExecution.getStartTime().getMinute()).isEqualTo(59);
assertThat(lastTaskExecution.getStartTime().getSecond()).isEqualTo(0);
}
@Test
@@ -110,35 +105,31 @@ public abstract class BaseTaskExecutionDaoTestCases {
assertThat(latestTaskExecutions.size() == 3)
.as("Expected 3 taskExecutions but got " + latestTaskExecutions.size()).isTrue();
final Calendar dateTimeFoo3 = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTimeFoo3.setTime(latestTaskExecutions.get(0).getStartTime());
LocalDateTime startDateTime = latestTaskExecutions.get(0).getStartTime();
assertThat(startDateTime.getYear()).isEqualTo(2016);
assertThat(startDateTime.getMonthValue()).isEqualTo(8);
assertThat(startDateTime.getDayOfMonth()).isEqualTo(20);
assertThat(startDateTime.getHour()).isEqualTo(14);
assertThat(startDateTime.getMinute()).isEqualTo(45);
assertThat(startDateTime.getSecond()).isEqualTo(0);
assertThat(dateTimeFoo3.get(Calendar.YEAR)).isEqualTo(2016);
assertThat(dateTimeFoo3.get(Calendar.MONTH) + 1).isEqualTo(8);
assertThat(dateTimeFoo3.get(Calendar.DAY_OF_MONTH)).isEqualTo(20);
assertThat(dateTimeFoo3.get(Calendar.HOUR_OF_DAY)).isEqualTo(14);
assertThat(dateTimeFoo3.get(Calendar.MINUTE)).isEqualTo(45);
assertThat(dateTimeFoo3.get(Calendar.SECOND)).isEqualTo(0);
LocalDateTime startDateTimeOne = latestTaskExecutions.get(1).getStartTime();
final Calendar dateTimeFoo1 = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTimeFoo1.setTime(latestTaskExecutions.get(1).getStartTime());
assertThat(startDateTimeOne.getYear()).isEqualTo(2015);
assertThat(startDateTimeOne.getMonthValue()).isEqualTo(2);
assertThat(startDateTimeOne.getDayOfMonth()).isEqualTo(22);
assertThat(startDateTimeOne.getHour()).isEqualTo(23);
assertThat(startDateTimeOne.getMinute()).isEqualTo(59);
assertThat(startDateTimeOne.getSecond()).isEqualTo(0);
assertThat(dateTimeFoo1.get(Calendar.YEAR)).isEqualTo(2015);
assertThat(dateTimeFoo1.get(Calendar.MONTH) + 1).isEqualTo(2);
assertThat(dateTimeFoo1.get(Calendar.DAY_OF_MONTH)).isEqualTo(22);
assertThat(dateTimeFoo1.get(Calendar.HOUR_OF_DAY)).isEqualTo(23);
assertThat(dateTimeFoo1.get(Calendar.MINUTE)).isEqualTo(59);
assertThat(dateTimeFoo1.get(Calendar.SECOND)).isEqualTo(0);
LocalDateTime startDateTimeTwo = latestTaskExecutions.get(2).getStartTime();
final Calendar dateTimeFoo4 = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTimeFoo4.setTime(latestTaskExecutions.get(2).getStartTime());
assertThat(dateTimeFoo4.get(Calendar.YEAR)).isEqualTo(2015);
assertThat(dateTimeFoo4.get(Calendar.MONTH) + 1).isEqualTo(2);
assertThat(dateTimeFoo4.get(Calendar.DAY_OF_MONTH)).isEqualTo(20);
assertThat(dateTimeFoo4.get(Calendar.HOUR_OF_DAY)).isEqualTo(14);
assertThat(dateTimeFoo4.get(Calendar.MINUTE)).isEqualTo(45);
assertThat(dateTimeFoo4.get(Calendar.SECOND)).isEqualTo(0);
assertThat(startDateTimeTwo.getYear()).isEqualTo(2015);
assertThat(startDateTimeTwo.getMonthValue()).isEqualTo(2);
assertThat(startDateTimeTwo.getDayOfMonth()).isEqualTo(20);
assertThat(startDateTimeTwo.getHour()).isEqualTo(14);
assertThat(startDateTimeTwo.getMinute()).isEqualTo(45);
assertThat(startDateTimeTwo.getSecond()).isEqualTo(0);
}
/**
@@ -154,15 +145,14 @@ public abstract class BaseTaskExecutionDaoTestCases {
assertThat(latestTaskExecutions.size() == 1)
.as("Expected only 1 taskExecution but got " + latestTaskExecutions.size()).isTrue();
final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTime.setTime(latestTaskExecutions.get(0).getStartTime());
LocalDateTime startDateTime = latestTaskExecutions.get(0).getStartTime();
assertThat(dateTime.get(Calendar.YEAR)).isEqualTo(2015);
assertThat(dateTime.get(Calendar.MONTH) + 1).isEqualTo(2);
assertThat(dateTime.get(Calendar.DAY_OF_MONTH)).isEqualTo(22);
assertThat(dateTime.get(Calendar.HOUR_OF_DAY)).isEqualTo(23);
assertThat(dateTime.get(Calendar.MINUTE)).isEqualTo(59);
assertThat(dateTime.get(Calendar.SECOND)).isEqualTo(0);
assertThat(startDateTime.getYear()).isEqualTo(2015);
assertThat(startDateTime.getMonthValue()).isEqualTo(2);
assertThat(startDateTime.getDayOfMonth()).isEqualTo(22);
assertThat(startDateTime.getHour()).isEqualTo(23);
assertThat(startDateTime.getMinute()).isEqualTo(59);
assertThat(startDateTime.getSecond()).isEqualTo(0);
assertThat(latestTaskExecutions.get(0).getExecutionId()).isEqualTo(9 + executionIdOffset);
}
@@ -208,15 +198,14 @@ public abstract class BaseTaskExecutionDaoTestCases {
final TaskExecution latestTaskExecution = this.dao.getLatestTaskExecutionForTaskName("FOO1");
assertThat(latestTaskExecution).as("Expected the latestTaskExecution not to be null").isNotNull();
final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTime.setTime(latestTaskExecution.getStartTime());
LocalDateTime startDateTime = latestTaskExecution.getStartTime();
assertThat(dateTime.get(Calendar.YEAR)).isEqualTo(2015);
assertThat(dateTime.get(Calendar.MONTH) + 1).isEqualTo(2);
assertThat(dateTime.get(Calendar.DAY_OF_MONTH)).isEqualTo(22);
assertThat(dateTime.get(Calendar.HOUR_OF_DAY)).isEqualTo(23);
assertThat(dateTime.get(Calendar.MINUTE)).isEqualTo(59);
assertThat(dateTime.get(Calendar.SECOND)).isEqualTo(0);
assertThat(startDateTime.getYear()).isEqualTo(2015);
assertThat(startDateTime.getMonthValue()).isEqualTo(2);
assertThat(startDateTime.getDayOfMonth()).isEqualTo(22);
assertThat(startDateTime.getHour()).isEqualTo(23);
assertThat(startDateTime.getMinute()).isEqualTo(59);
assertThat(startDateTime.getSecond()).isEqualTo(0);
}
/**
@@ -231,15 +220,14 @@ public abstract class BaseTaskExecutionDaoTestCases {
final TaskExecution latestTaskExecution = this.dao.getLatestTaskExecutionForTaskName("FOO5");
assertThat(latestTaskExecution).as("Expected the latestTaskExecution not to be null").isNotNull();
final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
dateTime.setTime(latestTaskExecution.getStartTime());
LocalDateTime startDateTime = latestTaskExecution.getStartTime();
assertThat(dateTime.get(Calendar.YEAR)).isEqualTo(2015);
assertThat(dateTime.get(Calendar.MONTH) + 1).isEqualTo(2);
assertThat(dateTime.get(Calendar.DAY_OF_MONTH)).isEqualTo(22);
assertThat(dateTime.get(Calendar.HOUR_OF_DAY)).isEqualTo(23);
assertThat(dateTime.get(Calendar.MINUTE)).isEqualTo(59);
assertThat(dateTime.get(Calendar.SECOND)).isEqualTo(0);
assertThat(startDateTime.getYear()).isEqualTo(2015);
assertThat(startDateTime.getMonthValue()).isEqualTo(2);
assertThat(startDateTime.getDayOfMonth()).isEqualTo(22);
assertThat(startDateTime.getHour()).isEqualTo(23);
assertThat(startDateTime.getMinute()).isEqualTo(59);
assertThat(startDateTime.getSecond()).isEqualTo(0);
assertThat(latestTaskExecution.getExecutionId()).isEqualTo(9 + executionIdOffset);
}
@@ -248,7 +236,7 @@ public abstract class BaseTaskExecutionDaoTestCases {
public void getRunningTaskExecutions() {
initializeRepositoryNotInOrderWithMultipleTaskExecutions();
assertThat(this.dao.getRunningTaskExecutionCount()).isEqualTo(this.dao.getTaskExecutionCount());
this.dao.completeTaskExecution(1, 0, new Date(), "c'est fini!");
this.dao.completeTaskExecution(1, 0, LocalDateTime.now(), "c'est fini!");
assertThat(this.dao.getRunningTaskExecutionCount()).isEqualTo(this.dao.getTaskExecutionCount() - 1);
}
@@ -300,11 +288,9 @@ public abstract class BaseTaskExecutionDaoTestCases {
return executionIdOffset;
}
private Date getDate(int year, int month, int day, int hour, int minute) {
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
calendar.clear();
calendar.set(year, month - 1, day, hour, minute);
return calendar.getTime();
private LocalDateTime getDate(int year, int month, int day, int hour, int minute) {
return LocalDateTime.now().withYear(year).withMonth(month).withDayOfMonth(day).withHour(hour).withMinute(minute)
.withSecond(0);
}
private long createTaskExecution(TaskExecution te) {
@@ -316,7 +302,7 @@ public abstract class BaseTaskExecutionDaoTestCases {
TaskExecution taskExecution = new TaskExecution();
taskExecution.setTaskName(taskName);
taskExecution.setExternalExecutionId(externalExecutionId);
taskExecution.setStartTime(new Date());
taskExecution.setStartTime(LocalDateTime.now());
return taskExecution;
}

View File

@@ -16,9 +16,9 @@
package org.springframework.cloud.task.repository.dao;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.UUID;
@@ -79,7 +79,7 @@ public class JdbcTaskExecutionDaoTests extends BaseTaskExecutionDaoTestCases {
TaskExecution expectedTaskExecution = this.dao.createTaskExecution(null, null, new ArrayList<>(0), null);
expectedTaskExecution.setArguments(Collections.singletonList("foo=" + UUID.randomUUID().toString()));
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
this.dao.startTaskExecution(expectedTaskExecution.getExecutionId(), expectedTaskExecution.getTaskName(),

View File

@@ -16,9 +16,9 @@
package org.springframework.cloud.task.repository.dao;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -55,7 +55,7 @@ public class MapTaskExecutionDaoTests extends BaseTaskExecutionDaoTestCases {
TaskExecution expectedTaskExecution = this.dao.createTaskExecution(null, null, new ArrayList<>(0), null);
expectedTaskExecution.setArguments(Collections.singletonList("foo=" + UUID.randomUUID().toString()));
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
this.dao.startTaskExecution(expectedTaskExecution.getExecutionId(), expectedTaskExecution.getTaskName(),

View File

@@ -16,11 +16,11 @@
package org.springframework.cloud.task.repository.support;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -418,7 +418,7 @@ public class SimpleTaskExplorerTests {
private TaskExecution getSimpleTaskExecution() {
TaskExecution taskExecution = new TaskExecution();
taskExecution.setTaskName(TASK_NAME);
taskExecution.setStartTime(new Date());
taskExecution.setStartTime(LocalDateTime.now());
taskExecution.setExternalExecutionId(EXTERNAL_EXECUTION_ID);
return taskExecution;
}

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.repository.support;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.Date;
import java.util.UUID;
import javax.sql.DataSource;
@@ -97,7 +97,7 @@ public class SimpleTaskRepositoryJdbcTests {
.createAndStoreEmptyTaskExecution(this.taskRepository);
expectedTaskExecution.setArguments(Collections.singletonList("foo=" + UUID.randomUUID().toString()));
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
TaskExecution actualTaskExecution = this.taskRepository.startTaskExecution(
@@ -114,7 +114,7 @@ public class SimpleTaskRepositoryJdbcTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreEmptyTaskExecution(this.taskRepository);
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
TaskExecution actualTaskExecution = this.taskRepository.startTaskExecution(
@@ -163,7 +163,7 @@ public class SimpleTaskRepositoryJdbcTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreEmptyTaskExecution(this.taskRepository);
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
expectedTaskExecution.setParentExecutionId(12345L);
@@ -180,7 +180,7 @@ public class SimpleTaskRepositoryJdbcTests {
public void testCompleteTaskExecution() {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreTaskExecutionNoParams(this.taskRepository);
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(77);
expectedTaskExecution.setExitMessage(UUID.randomUUID().toString());
@@ -195,7 +195,7 @@ public class SimpleTaskRepositoryJdbcTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreTaskExecutionNoParams(this.taskRepository);
expectedTaskExecution.setExitMessage(new String(new char[SimpleTaskRepository.MAX_EXIT_MESSAGE_SIZE + 1]));
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(0);
TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution, this.taskRepository);
assertThat(actualTaskExecution.getExitMessage().length()).isEqualTo(SimpleTaskRepository.MAX_EXIT_MESSAGE_SIZE);
@@ -210,7 +210,7 @@ public class SimpleTaskRepositoryJdbcTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreTaskExecutionNoParams(simpleTaskRepository);
expectedTaskExecution.setExitMessage(new String(new char[SimpleTaskRepository.MAX_EXIT_MESSAGE_SIZE + 1]));
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(0);
TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution, simpleTaskRepository);
assertThat(actualTaskExecution.getExitMessage().length()).isEqualTo(5);
@@ -222,7 +222,7 @@ public class SimpleTaskRepositoryJdbcTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreTaskExecutionNoParams(this.taskRepository);
expectedTaskExecution.setErrorMessage(new String(new char[SimpleTaskRepository.MAX_ERROR_MESSAGE_SIZE + 1]));
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(0);
TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution, this.taskRepository);
assertThat(actualTaskExecution.getErrorMessage().length())
@@ -238,7 +238,7 @@ public class SimpleTaskRepositoryJdbcTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreTaskExecutionNoParams(simpleTaskRepository);
expectedTaskExecution.setErrorMessage(new String(new char[SimpleTaskRepository.MAX_ERROR_MESSAGE_SIZE + 1]));
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(0);
TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution, simpleTaskRepository);
assertThat(actualTaskExecution.getErrorMessage().length()).isEqualTo(5);
@@ -292,7 +292,7 @@ public class SimpleTaskRepositoryJdbcTests {
public void testCreateTaskExecutionNoParamMaxTaskName() {
TaskExecution taskExecution = new TaskExecution();
taskExecution.setTaskName(new String(new char[SimpleTaskRepository.MAX_TASK_NAME_SIZE + 1]));
taskExecution.setStartTime(new Date());
taskExecution.setStartTime(LocalDateTime.now());
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> {
this.taskRepository.createTaskExecution(taskExecution);
});
@@ -303,7 +303,7 @@ public class SimpleTaskRepositoryJdbcTests {
public void testCreateTaskExecutionNegativeException() {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreTaskExecutionNoParams(this.taskRepository);
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(-1);
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> {
@@ -326,7 +326,7 @@ public class SimpleTaskRepositoryJdbcTests {
private TaskExecution completeTaskExecution(TaskExecution expectedTaskExecution, TaskRepository taskRepository) {
return taskRepository.completeTaskExecution(expectedTaskExecution.getExecutionId(),
expectedTaskExecution.getExitCode(), new Date(), expectedTaskExecution.getExitMessage(),
expectedTaskExecution.getExitCode(), LocalDateTime.now(), expectedTaskExecution.getExitMessage(),
expectedTaskExecution.getErrorMessage());
}
@@ -335,7 +335,7 @@ public class SimpleTaskRepositoryJdbcTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator.createAndStoreTaskExecutionNoParams(taskRepository);
expectedTaskExecution.setErrorMessage(new String(new char[maxErrorMessage + 1]));
expectedTaskExecution.setExitMessage(new String(new char[maxExitMessage + 1]));
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(0);
TaskExecution actualTaskExecution = completeTaskExecution(expectedTaskExecution, taskRepository);

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.repository.support;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
@@ -110,7 +110,7 @@ public class SimpleTaskRepositoryMapTests {
.createAndStoreEmptyTaskExecution(this.taskRepository);
expectedTaskExecution.setArguments(Collections.singletonList("foo=" + UUID.randomUUID().toString()));
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
TaskExecution actualTaskExecution = this.taskRepository.startTaskExecution(
@@ -126,7 +126,7 @@ public class SimpleTaskRepositoryMapTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreEmptyTaskExecution(this.taskRepository);
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
TaskExecution actualTaskExecution = this.taskRepository.startTaskExecution(
@@ -142,7 +142,7 @@ public class SimpleTaskRepositoryMapTests {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreEmptyTaskExecution(this.taskRepository);
expectedTaskExecution.setStartTime(new Date());
expectedTaskExecution.setStartTime(LocalDateTime.now());
expectedTaskExecution.setTaskName(UUID.randomUUID().toString());
expectedTaskExecution.setParentExecutionId(12345L);
@@ -158,7 +158,7 @@ public class SimpleTaskRepositoryMapTests {
public void testCompleteTaskExecution() {
TaskExecution expectedTaskExecution = TaskExecutionCreator
.createAndStoreTaskExecutionNoParams(this.taskRepository);
expectedTaskExecution.setEndTime(new Date());
expectedTaskExecution.setEndTime(LocalDateTime.now());
expectedTaskExecution.setExitCode(0);
TaskExecution actualTaskExecution = TaskExecutionCreator.completeExecution(this.taskRepository,
expectedTaskExecution);

View File

@@ -20,6 +20,7 @@ import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -73,9 +74,9 @@ public final class TestDBUtils {
TaskExecution taskExecution = new TaskExecution(rs.getLong("TASK_EXECUTION_ID"),
StringUtils.hasText(rs.getString("EXIT_CODE")) ? Integer.valueOf(rs.getString("EXIT_CODE"))
: null,
rs.getString("TASK_NAME"), rs.getTimestamp("START_TIME"), rs.getTimestamp("END_TIME"),
rs.getString("EXIT_MESSAGE"), new ArrayList<>(0), rs.getString("ERROR_MESSAGE"),
rs.getString("EXTERNAL_EXECUTION_ID"));
rs.getString("TASK_NAME"), rs.getObject("START_TIME", LocalDateTime.class),
rs.getObject("END_TIME", LocalDateTime.class), rs.getString("EXIT_MESSAGE"), new ArrayList<>(0),
rs.getString("ERROR_MESSAGE"), rs.getString("EXTERNAL_EXECUTION_ID"));
return taskExecution;
}
});

View File

@@ -16,8 +16,8 @@
package org.springframework.cloud.task.util;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
@@ -86,11 +86,11 @@ public final class TestVerifierUtils {
*/
public static TaskExecution createSampleTaskExecutionNoArg() {
Random randomGenerator = new Random();
Date startTime = new Date();
long executionId = randomGenerator.nextLong();
String taskName = UUID.randomUUID().toString();
return new TaskExecution(executionId, null, taskName, startTime, null, null, new ArrayList<>(), null, null);
return new TaskExecution(executionId, null, taskName, LocalDateTime.now(), null, null, new ArrayList<>(), null,
null);
}
/**
@@ -100,14 +100,12 @@ public final class TestVerifierUtils {
public static TaskExecution endSampleTaskExecutionNoArg() {
Random randomGenerator = new Random();
int exitCode = randomGenerator.nextInt();
Date startTime = new Date();
Date endTime = new Date();
long executionId = randomGenerator.nextLong();
String taskName = UUID.randomUUID().toString();
String exitMessage = UUID.randomUUID().toString();
return new TaskExecution(executionId, exitCode, taskName, startTime, endTime, exitMessage, new ArrayList<>(),
null, null);
return new TaskExecution(executionId, exitCode, taskName, LocalDateTime.now(), LocalDateTime.now(), exitMessage,
new ArrayList<>(), null, null);
}
/**
@@ -116,14 +114,14 @@ public final class TestVerifierUtils {
* @return instance of the TaskExecution.
*/
public static TaskExecution createSampleTaskExecution(long executionId) {
Date startTime = new Date();
String taskName = UUID.randomUUID().toString();
String externalExecutionId = UUID.randomUUID().toString();
List<String> args = new ArrayList<>(ARG_SIZE);
for (int i = 0; i < ARG_SIZE; i++) {
args.add(UUID.randomUUID().toString());
}
return new TaskExecution(executionId, null, taskName, startTime, null, null, args, null, externalExecutionId);
return new TaskExecution(executionId, null, taskName, LocalDateTime.now(), null, null, args, null,
externalExecutionId);
}
/**
@@ -135,12 +133,12 @@ public final class TestVerifierUtils {
assertThat(actualTaskExecution.getExecutionId()).as("taskExecutionId must be equal")
.isEqualTo(expectedTaskExecution.getExecutionId());
if (actualTaskExecution.getStartTime() != null) {
assertThat(actualTaskExecution.getStartTime()).as("startTime must be equal")
.hasSameTimeAs(expectedTaskExecution.getStartTime());
assertThat(actualTaskExecution.getStartTime().isEqual(expectedTaskExecution.getStartTime()))
.as("startTime must be equal").isTrue();
}
if (actualTaskExecution.getEndTime() != null) {
assertThat(actualTaskExecution.getEndTime()).as("endTime must be equal")
.hasSameTimeAs(expectedTaskExecution.getEndTime());
assertThat(actualTaskExecution.getEndTime().isEqual(expectedTaskExecution.getEndTime()))
.as("endTime must be equal").isTrue();
}
assertThat(actualTaskExecution.getExitCode()).as("exitCode must be equal")
.isEqualTo(expectedTaskExecution.getExitCode());

View File

@@ -19,9 +19,9 @@ package org.springframework.cloud.task.executionid;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -189,10 +189,10 @@ public class TaskStartTests {
@Test
public void testWithGeneratedTaskExecutionWithExistingDate() throws Exception {
final String TASK_EXECUTION_NAME = "PRE-EXECUTION-TEST-NAME";
Date startDate = new Date();
LocalDateTime startDate = LocalDateTime.now();
Thread.sleep(500);
TaskExecution taskExecution = new TaskExecution(1, 0, TASK_EXECUTION_NAME, startDate, new Date(), "foo",
Collections.emptyList(), "foo", "bar", null);
TaskExecution taskExecution = new TaskExecution(1, 0, TASK_EXECUTION_NAME, startDate, LocalDateTime.now(),
"foo", Collections.emptyList(), "foo", "bar", null);
this.taskRepository.createTaskExecution(taskExecution);
assertThat(this.taskExplorer.getTaskExecutionCount()).as("Only one row is expected").isEqualTo(1);
@@ -203,7 +203,7 @@ public class TaskStartTests {
assertThat(taskExecutions.getTotalElements()).as("Only one row is expected").isEqualTo(1);
assertThat(taskExecutions.iterator().next().getExitCode().intValue()).as("return code should be 0")
.isEqualTo(0);
assertThat(this.taskExplorer.getTaskExecution(1).getStartTime().getTime()).isEqualTo(startDate.getTime());
assertThat(this.taskExplorer.getTaskExecution(1).getStartTime().isEqual(startDate)).isTrue();
}
@@ -218,7 +218,7 @@ public class TaskStartTests {
public void testCompletedTaskExecution() throws Exception {
this.taskRepository.createTaskExecution();
assertThat(this.taskExplorer.getTaskExecutionCount()).as("Only one row is expected").isEqualTo(1);
this.taskRepository.completeTaskExecution(1, 0, new Date(), "");
this.taskRepository.completeTaskExecution(1, 0, LocalDateTime.now(), "");
assertThatExceptionOfType(ApplicationContextException.class).isThrownBy(() -> {
this.applicationContext = getTaskApplication(1).run(new String[0]);
});
@@ -248,7 +248,8 @@ public class TaskStartTests {
public void testDuplicateTaskExecutionWithSingleInstanceDisabled() throws Exception {
this.taskRepository.createTaskExecution();
TaskExecution execution = this.taskRepository.createTaskExecution();
this.taskRepository.startTaskExecution(execution.getExecutionId(), "bar", new Date(), new ArrayList<>(), "");
this.taskRepository.startTaskExecution(execution.getExecutionId(), "bar", LocalDateTime.now(),
new ArrayList<>(), "");
String[] params = { "--spring.cloud.task.name=bar" };
enableLock("bar");
this.applicationContext = getTaskApplication(1).run(params);
@@ -293,7 +294,7 @@ public class TaskStartTests {
taskLockParams.put("LOCK_KEY", UUID.nameUUIDFromBytes(lockKey.getBytes()).toString());
taskLockParams.put("REGION", "DEFAULT");
taskLockParams.put("CLIENT_ID", "aClientID");
taskLockParams.put("CREATED_DATE", new Date());
taskLockParams.put("CREATED_DATE", LocalDateTime.now());
taskLockInsert.execute(taskLockParams);
}

View File

@@ -21,8 +21,10 @@ import java.util.List;
import java.util.UUID;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.WebApplicationType;
@@ -47,6 +49,11 @@ public class TaskEventTests {
private ConfigurableApplicationContext applicationContext;
@BeforeEach
public void setup() {
this.objectMapper.registerModule(new JavaTimeModule());
}
@AfterEach
public void tearDown() {
if (this.applicationContext != null && this.applicationContext.isActive()) {

View File

@@ -59,7 +59,7 @@ public class TaskApplication {
private TimestampTaskProperties config;
@Override
public void run(String... strings) throws Exception {
public void run(String... strings) {
DateFormat dateFormat = new SimpleDateFormat(this.config.getFormat());
logger.info(dateFormat.format(new Date()));
}

View File

@@ -41,18 +41,7 @@ public class JobParametersEvent {
public JobParametersEvent(Map<String, JobParameter<?>> jobParameters) {
this.parameters = new LinkedHashMap<>();
for (Map.Entry<String, JobParameter<?>> entry : jobParameters.entrySet()) {
if (entry.getValue().getValue() instanceof String) {
this.parameters.put(entry.getKey(), new JobParameterEvent(entry.getValue()));
}
else if (entry.getValue().getValue() instanceof Long) {
this.parameters.put(entry.getKey(), new JobParameterEvent(entry.getValue()));
}
else if (entry.getValue().getValue() instanceof Date) {
this.parameters.put(entry.getKey(), new JobParameterEvent(entry.getValue()));
}
else if (entry.getValue().getValue() instanceof Double) {
this.parameters.put(entry.getKey(), new JobParameterEvent(entry.getValue()));
}
this.parameters.put(entry.getKey(), new JobParameterEvent(entry.getValue()));
}
}
@@ -61,6 +50,7 @@ public class JobParametersEvent {
* @param key The key to get a value for
* @return The <code>Long</code> value
*/
@Deprecated(since = "3.0")
public Long getLong(String key) {
if (!this.parameters.containsKey(key)) {
return 0L;
@@ -76,6 +66,7 @@ public class JobParametersEvent {
* @param defaultValue to return if the value doesn't exist
* @return the parameter represented by the provided key, defaultValue otherwise.
*/
@Deprecated(since = "3.0")
public Long getLong(String key, long defaultValue) {
if (this.parameters.containsKey(key)) {
return getLong(key);
@@ -90,6 +81,7 @@ public class JobParametersEvent {
* @param key The key to get a value for
* @return The <code>String</code> value
*/
@Deprecated(since = "3.0")
public String getString(String key) {
JobParameterEvent value = this.parameters.get(key);
return value == null ? null : value.toString();
@@ -102,6 +94,7 @@ public class JobParametersEvent {
* @param defaultValue to return if the value doesn't exist
* @return the parameter represented by the provided key, defaultValue otherwise.
*/
@Deprecated(since = "3.0")
public String getString(String key, String defaultValue) {
if (this.parameters.containsKey(key)) {
return getString(key);
@@ -116,6 +109,7 @@ public class JobParametersEvent {
* @param key The key to get a value for
* @return The <code>Double</code> value
*/
@Deprecated(since = "3.0")
public Double getDouble(String key) {
if (!this.parameters.containsKey(key)) {
return 0.0;
@@ -131,6 +125,7 @@ public class JobParametersEvent {
* @param defaultValue to return if the value doesn't exist
* @return the parameter represented by the provided key, defaultValue otherwise.
*/
@Deprecated(since = "3.0")
public Double getDouble(String key, double defaultValue) {
if (this.parameters.containsKey(key)) {
return getDouble(key);
@@ -145,6 +140,7 @@ public class JobParametersEvent {
* @param key The key to get a value for
* @return The <code>java.util.Date</code> value
*/
@Deprecated(since = "3.0")
public Date getDate(String key) {
return this.getDate(key, null);
}
@@ -156,6 +152,7 @@ public class JobParametersEvent {
* @param defaultValue to return if the value doesn't exist
* @return the parameter represented by the provided key, defaultValue otherwise.
*/
@Deprecated(since = "3.0")
public Date getDate(String key, Date defaultValue) {
if (this.parameters.containsKey(key)) {
return (Date) this.parameters.get(key).getValue();

View File

@@ -16,7 +16,7 @@
package org.springframework.cloud.task.batch.listener;
import java.util.Date;
import java.time.LocalDateTime;
import org.junit.jupiter.api.Test;
@@ -41,13 +41,13 @@ public class JobParameterEventTests {
@Test
public void testConstructor() {
final String EXPECTED_VALUE = "FOO";
final Date EXPECTED_DATE_VALUE = new Date();
final LocalDateTime EXPECTED_DATE_VALUE = LocalDateTime.now();
JobParameter jobParameter = new JobParameter(EXPECTED_VALUE, String.class);
JobParameterEvent jobParameterEvent = new JobParameterEvent(jobParameter);
assertThat(jobParameterEvent.getValue()).isEqualTo(EXPECTED_VALUE);
assertThat(jobParameterEvent.isIdentifying()).isTrue();
jobParameter = new JobParameter(EXPECTED_DATE_VALUE, Date.class);
jobParameter = new JobParameter(EXPECTED_DATE_VALUE, LocalDateTime.class);
jobParameterEvent = new JobParameterEvent(jobParameter);
assertThat(jobParameterEvent.getValue()).isEqualTo(EXPECTED_DATE_VALUE);
assertThat(jobParameterEvent.isIdentifying()).isTrue();