From dbca7a2531c4cfccec4deac0d3569ac58298a7e8 Mon Sep 17 00:00:00 2001 From: John Yong Date: Wed, 14 Mar 2018 23:44:26 +0800 Subject: [PATCH] [#8636] Migrate *Attributes time fields from Date to Instant (#8637) --- .../attributes/AccountAttributes.java | 6 ++-- .../attributes/AdminEmailAttributes.java | 32 +++++++------------ .../FeedbackQuestionAttributes.java | 14 ++++---- .../FeedbackResponseAttributes.java | 14 ++++---- .../FeedbackResponseCommentAttributes.java | 12 +++---- .../attributes/StudentAttributes.java | 30 ++++++++--------- .../attributes/StudentProfileAttributes.java | 10 +++--- .../java/teammates/common/util/Const.java | 14 ++++---- src/main/java/teammates/logic/api/Logic.java | 12 +++---- .../logic/core/AdminEmailsLogic.java | 6 ++-- .../core/FeedbackResponseCommentsLogic.java | 6 ++-- .../teammates/storage/api/AdminEmailsDb.java | 16 +++++----- .../api/FeedbackResponseCommentsDb.java | 17 +++++----- .../teammates/storage/api/ProfilesDb.java | 8 ++--- .../teammates/storage/entity/Account.java | 13 +++++--- .../teammates/storage/entity/AdminEmail.java | 19 ++++++----- .../storage/entity/CourseStudent.java | 22 +++++++------ .../storage/entity/FeedbackQuestion.java | 22 +++++++------ .../storage/entity/FeedbackResponse.java | 22 +++++++------ .../entity/FeedbackResponseComment.java | 26 ++++++++------- .../storage/entity/StudentProfile.java | 15 +++++---- ...FeedbackResponseCommentSearchDocument.java | 3 +- .../AdminEmailComposeSendAction.java | 8 ++--- ...uctorFeedbackResponseCommentAddAction.java | 4 +-- ...ctorFeedbackResponseCommentEditAction.java | 4 +-- ...orFeedbackResponseCommentAjaxPageData.java | 8 +++-- .../java/teammates/ui/pagedata/PageData.java | 5 --- ...AdminAccountManagementAccountTableRow.java | 5 +-- .../ui/template/AdminActivityLogTableRow.java | 3 +- .../template/FeedbackResponseCommentRow.java | 10 +++--- src/main/resources/InstructorSampleData.json | 32 +++++++++---------- .../datatransfer/AccountAttributesTest.java | 4 +-- .../AdminEmailAttributesTest.java | 26 +++++++-------- .../FeedbackQuestionAttributesTest.java | 8 ++--- .../FeedbackResponseAttributesTest.java | 8 ++--- ...FeedbackResponseCommentAttributesTest.java | 6 ++-- .../datatransfer/StudentAttributesTest.java | 8 ++--- .../StudentProfileAttributesTest.java | 4 +-- .../test/cases/storage/AccountsDbTest.java | 4 +-- .../storage/FeedbackQuestionsDbTest.java | 6 ++-- .../FeedbackResponseCommentsDbTest.java | 14 ++++---- .../storage/FeedbackResponsesDbTest.java | 6 ++-- .../test/cases/storage/StudentsDbTest.java | 6 ++-- .../teammates/test/driver/AssertHelper.java | 14 ++++---- .../data/AllAccessControlUiTest.json | 6 ++-- .../data/FeedbackSessionsLogicTest.json | 6 ++-- .../InstructorFeedbackResultsPageUiTest.json | 8 ++--- .../data/InstructorSearchPageUiTest.json | 14 ++++---- .../InstructorStudentRecordsPageUiTest.json | 8 ++--- src/test/resources/data/MashupPageUiTest.json | 4 +-- .../StudentFeedbackResultsPageUiTest.json | 6 ++-- ...tFeedbackSubmissionEditPageActionTest.json | 6 ++-- .../resources/data/typicalDataBundle.json | 10 +++--- 53 files changed, 303 insertions(+), 297 deletions(-) diff --git a/src/main/java/teammates/common/datatransfer/attributes/AccountAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/AccountAttributes.java index 2579c71e2be..d9a5f7810fd 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/AccountAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/AccountAttributes.java @@ -1,7 +1,7 @@ package teammates.common.datatransfer.attributes; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import teammates.common.util.Assumption; @@ -24,7 +24,7 @@ public class AccountAttributes extends EntityAttributes { public boolean isInstructor; public String email; public String institute; - public Date createdAt; + public Instant createdAt; public StudentProfileAttributes studentProfile; AccountAttributes() { @@ -57,7 +57,7 @@ public Builder() { accountAttributes = new AccountAttributes(); } - public Builder withCreatedAt(Date createdAt) { + public Builder withCreatedAt(Instant createdAt) { accountAttributes.createdAt = createdAt; return this; } diff --git a/src/main/java/teammates/common/datatransfer/attributes/AdminEmailAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/AdminEmailAttributes.java index e13c2cd0e58..c85794efcb0 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/AdminEmailAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/AdminEmailAttributes.java @@ -1,8 +1,7 @@ package teammates.common.datatransfer.attributes; +import java.time.Instant; import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; import java.util.List; import com.google.appengine.api.datastore.Text; @@ -23,13 +22,13 @@ public class AdminEmailAttributes extends EntityAttributes { public Text content; // Optional fields - public Date sendDate; - public Date createDate; + public Instant sendDate; + public Instant createDate; public String emailId; public boolean isInTrashBin; AdminEmailAttributes() { - createDate = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE; + createDate = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; emailId = Const.ParamsNames.ADMIN_EMAIL_ID; } @@ -118,11 +117,11 @@ public String getSubject() { return this.subject; } - public Date getSendDate() { + public Instant getSendDate() { return this.sendDate; } - public Date getCreateDate() { + public Instant getCreateDate() { return this.createDate; } @@ -138,20 +137,13 @@ public String getSendDateForDisplay() { if (this.sendDate == null) { return "Draft"; } - - Calendar cal = Calendar.getInstance(); - cal.setTime(this.sendDate); - cal = TimeHelper.convertToUserTimeZone(cal, Const.SystemParams.ADMIN_TIME_ZONE_DOUBLE); - - return TimeHelper.formatTime12H(cal.getTime()); + return TimeHelper.formatTime12H(TimeHelper.convertInstantToLocalDateTime( + this.sendDate, Const.SystemParams.ADMIN_TIME_ZONE_ID)); } public String getCreateDateForDisplay() { - Calendar cal = Calendar.getInstance(); - cal.setTime(this.createDate); - cal = TimeHelper.convertToUserTimeZone(cal, Const.SystemParams.ADMIN_TIME_ZONE_DOUBLE); - - return TimeHelper.formatTime12H(cal.getTime()); + return TimeHelper.formatTime12H(TimeHelper.convertInstantToLocalDateTime( + this.createDate, Const.SystemParams.ADMIN_TIME_ZONE_ID)); } public String getFirstAddressReceiver() { @@ -179,14 +171,14 @@ public Builder(String subject, List addressReceiver, List groupR adminEmailAttributes.content = content; } - public Builder withSendDate(Date sendDate) { + public Builder withSendDate(Instant sendDate) { if (sendDate != null) { adminEmailAttributes.sendDate = sendDate; } return this; } - public Builder withCreateDate(Date createDate) { + public Builder withCreateDate(Instant createDate) { if (createDate != null) { adminEmailAttributes.createDate = createDate; } diff --git a/src/main/java/teammates/common/datatransfer/attributes/FeedbackQuestionAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/FeedbackQuestionAttributes.java index 1d884441f0a..e0ee59d52cc 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/FeedbackQuestionAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/FeedbackQuestionAttributes.java @@ -1,7 +1,7 @@ package teammates.common.datatransfer.attributes; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import org.json.JSONException; @@ -40,8 +40,8 @@ public class FeedbackQuestionAttributes extends EntityAttributes showResponsesTo; public List showGiverNameTo; public List showRecipientNameTo; - protected transient Date createdAt; - protected transient Date updatedAt; + protected transient Instant createdAt; + protected transient Instant updatedAt; private String feedbackQuestionId; public FeedbackQuestionAttributes() { @@ -95,12 +95,12 @@ public FeedbackQuestionAttributes getCopy() { return new FeedbackQuestionAttributes(this); } - public Date getCreatedAt() { - return createdAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE : createdAt; + public Instant getCreatedAt() { + return createdAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : createdAt; } - public Date getUpdatedAt() { - return updatedAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE : updatedAt; + public Instant getUpdatedAt() { + return updatedAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : updatedAt; } public String getId() { diff --git a/src/main/java/teammates/common/datatransfer/attributes/FeedbackResponseAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/FeedbackResponseAttributes.java index c8103d12772..6eb0cb4ce43 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/FeedbackResponseAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/FeedbackResponseAttributes.java @@ -1,8 +1,8 @@ package teammates.common.datatransfer.attributes; +import java.time.Instant; import java.util.ArrayList; import java.util.Comparator; -import java.util.Date; import java.util.List; import com.google.appengine.api.datastore.Text; @@ -40,8 +40,8 @@ public class FeedbackResponseAttributes extends EntityAttributes showCommentTo; public List showGiverNameTo; public boolean isVisibilityFollowingFeedbackQuestion; - public Date createdAt; + public Instant createdAt; public String lastEditorEmail; - public Date lastEditedAt; + public Instant lastEditedAt; public Long feedbackResponseCommentId; public String giverSection; public String receiverSection; @@ -45,7 +45,7 @@ public class FeedbackResponseCommentAttributes extends EntityAttributes(); showGiverNameTo = new ArrayList<>(); isVisibilityFollowingFeedbackQuestion = true; - createdAt = new Date(); + createdAt = Instant.now(); } public static FeedbackResponseCommentAttributes valueOf(FeedbackResponseComment comment) { @@ -215,7 +215,7 @@ public Builder withVisibilityFollowingFeedbackQuestion(Boolean visibilityFollowi return this; } - public Builder withCreatedAt(Date createdAt) { + public Builder withCreatedAt(Instant createdAt) { if (createdAt != null) { frca.createdAt = createdAt; } @@ -230,7 +230,7 @@ public Builder withLastEditorEmail(String lastEditorEmail) { return this; } - public Builder withLastEditedAt(Date lastEditedAt) { + public Builder withLastEditedAt(Instant lastEditedAt) { frca.lastEditedAt = lastEditedAt == null ? frca.createdAt : lastEditedAt; diff --git a/src/main/java/teammates/common/datatransfer/attributes/StudentAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/StudentAttributes.java index a5e984a6e50..74ab25eff17 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/StudentAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/StudentAttributes.java @@ -1,8 +1,8 @@ package teammates.common.datatransfer.attributes; +import java.time.Instant; import java.util.ArrayList; import java.util.Comparator; -import java.util.Date; import java.util.List; import com.google.common.base.Strings; @@ -37,15 +37,15 @@ public class StudentAttributes extends EntityAttributes { * Creation and update time stamps. * Updated automatically in Student.java, jdoPreStore() */ - private transient Date createdAt; - private transient Date updatedAt; + private transient Instant createdAt; + private transient Instant updatedAt; StudentAttributes() { googleId = ""; section = Const.DEFAULT_SECTION; updateStatus = StudentUpdateStatus.UNKNOWN; - createdAt = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE; - updatedAt = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE; + createdAt = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; + updatedAt = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; } public static StudentAttributes valueOf(CourseStudent student) { @@ -279,19 +279,19 @@ public String getStudentStatus() { return Const.STUDENT_COURSE_STATUS_YET_TO_JOIN; } - public Date getCreatedAt() { + public Instant getCreatedAt() { return createdAt; } - public Date getUpdatedAt() { + public Instant getUpdatedAt() { return updatedAt; } - public void setCreatedAt(Date createdAt) { + public void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; } - public void setUpdatedAt(Date updatedAt) { + public void setUpdatedAt(Instant updatedAt) { this.updatedAt = updatedAt; } @@ -392,17 +392,17 @@ public Builder withUpdateStatus(StudentUpdateStatus updateStatus) { return this; } - public Builder withCreatedAt(Date createdAt) { - Date dateToAdd = createdAt == null - ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE + public Builder withCreatedAt(Instant createdAt) { + Instant dateToAdd = createdAt == null + ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : createdAt; studentAttributes.setCreatedAt(dateToAdd); return this; } - public Builder withUpdatedAt(Date updatedAt) { - Date dateToAdd = updatedAt == null - ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE + public Builder withUpdatedAt(Instant updatedAt) { + Instant dateToAdd = updatedAt == null + ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : updatedAt; studentAttributes.setUpdatedAt(dateToAdd); return this; diff --git a/src/main/java/teammates/common/datatransfer/attributes/StudentProfileAttributes.java b/src/main/java/teammates/common/datatransfer/attributes/StudentProfileAttributes.java index 01ac091a5b7..bdc6715fdd1 100644 --- a/src/main/java/teammates/common/datatransfer/attributes/StudentProfileAttributes.java +++ b/src/main/java/teammates/common/datatransfer/attributes/StudentProfileAttributes.java @@ -1,7 +1,7 @@ package teammates.common.datatransfer.attributes; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import com.google.appengine.api.blobstore.BlobKey; @@ -31,7 +31,7 @@ public class StudentProfileAttributes extends EntityAttributes { public String gender; // only accepts "male", "female" or "other" public String moreInfo; public String pictureKey; - public Date modifiedDate; + public Instant modifiedDate; StudentProfileAttributes(String googleId) { this.googleId = googleId; @@ -42,7 +42,7 @@ public class StudentProfileAttributes extends EntityAttributes { this.gender = "other"; this.moreInfo = ""; this.pictureKey = ""; - this.modifiedDate = new Date(); + this.modifiedDate = Instant.now(); } public static StudentProfileAttributes valueOf(StudentProfile sp) { @@ -233,8 +233,8 @@ public Builder withPictureKey(String pictureKey) { return this; } - public Builder withModifiedDate(Date modifiedDate) { - profileAttributes.modifiedDate = modifiedDate == null ? new Date() : modifiedDate; + public Builder withModifiedDate(Instant modifiedDate) { + profileAttributes.modifiedDate = modifiedDate == null ? Instant.now() : modifiedDate; return this; } diff --git a/src/main/java/teammates/common/util/Const.java b/src/main/java/teammates/common/util/Const.java index caa5f0e52bc..a30d4a5fcba 100644 --- a/src/main/java/teammates/common/util/Const.java +++ b/src/main/java/teammates/common/util/Const.java @@ -1,10 +1,10 @@ package teammates.common.util; import java.time.Instant; +import java.time.ZoneId; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -98,9 +98,6 @@ public final class Const { public static final Instant TIME_REPRESENTS_NOW; public static final Instant TIME_REPRESENTS_DEFAULT_TIMESTAMP; - @Deprecated - public static final Date TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE; - public static final String ERROR_FEEDBACK_EMAIL_SUBJECT = "User-submitted Error Report"; static { @@ -110,8 +107,6 @@ public final class Const { TIME_REPRESENTS_LATER = TimeHelper.parseInstant("1970-01-01 12:00 AM +0000"); TIME_REPRESENTS_NOW = TimeHelper.parseInstant("1970-02-14 12:00 AM +0000"); TIME_REPRESENTS_DEFAULT_TIMESTAMP = TimeHelper.parseInstant("2011-01-01 12:00 AM +0000"); - - TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE = TimeHelper.convertInstantToDate(TIME_REPRESENTS_DEFAULT_TIMESTAMP); } /* @@ -143,7 +138,12 @@ public static class SystemParams { /* Field sizes and error messages for invalid fields can be found * in the FieldValidator class. */ - public static final String ADMIN_TIME_ZONE = "Asia/Singapore"; + + // TODO: rename back to ADMIN_TIME_ZONE once the String version has been deleted + public static final ZoneId ADMIN_TIME_ZONE_ID = ZoneId.of("Asia/Singapore"); + @Deprecated // use ZoneId version + public static final String ADMIN_TIME_ZONE = ADMIN_TIME_ZONE_ID.getId(); + @Deprecated // use ZoneId version public static final double ADMIN_TIME_ZONE_DOUBLE = 8.0; public static final TimeZone TIME_ZONE = TimeZone.getTimeZone("UTC"); diff --git a/src/main/java/teammates/logic/api/Logic.java b/src/main/java/teammates/logic/api/Logic.java index b393c42c1fe..55dca49dc6b 100644 --- a/src/main/java/teammates/logic/api/Logic.java +++ b/src/main/java/teammates/logic/api/Logic.java @@ -1,5 +1,6 @@ package teammates.logic.api; +import java.time.Instant; import java.util.Date; import java.util.List; import java.util.Map; @@ -1927,9 +1928,8 @@ public List getFeedbackResponseCommentForGive * Preconditions:
* * All parameters are non-null. */ - public FeedbackResponseCommentAttributes getFeedbackResponseComment(String responseId, - String giverEmail, - Date creationDate) { + public FeedbackResponseCommentAttributes getFeedbackResponseComment( + String responseId, String giverEmail, Instant creationDate) { Assumption.assertNotNull(responseId); Assumption.assertNotNull(giverEmail); Assumption.assertNotNull(creationDate); @@ -2027,7 +2027,7 @@ public AdminEmailAttributes getAdminEmailById(String emailId) { return adminEmailsLogic.getAdminEmailById(emailId); } - public Date createAdminEmail(AdminEmailAttributes newAdminEmail) throws InvalidParametersException { + public Instant createAdminEmail(AdminEmailAttributes newAdminEmail) throws InvalidParametersException { Assumption.assertNotNull(newAdminEmail); return adminEmailsLogic.createAdminEmail(newAdminEmail); } @@ -2098,9 +2098,9 @@ public void updateAdminEmailById(AdminEmailAttributes newAdminEmail, String emai /** * Gets an admin email by subject and createDate. * - * @see AdminEmailsLogic#getAdminEmail(String, Date) + * @see AdminEmailsLogic#getAdminEmail(String, Instant) */ - public AdminEmailAttributes getAdminEmail(String subject, Date createDate) { + public AdminEmailAttributes getAdminEmail(String subject, Instant createDate) { Assumption.assertNotNull(subject); Assumption.assertNotNull(createDate); diff --git a/src/main/java/teammates/logic/core/AdminEmailsLogic.java b/src/main/java/teammates/logic/core/AdminEmailsLogic.java index a24ece8f734..c9f17cb5fe3 100644 --- a/src/main/java/teammates/logic/core/AdminEmailsLogic.java +++ b/src/main/java/teammates/logic/core/AdminEmailsLogic.java @@ -1,6 +1,6 @@ package teammates.logic.core; -import java.util.Date; +import java.time.Instant; import java.util.List; import com.google.appengine.api.blobstore.BlobKey; @@ -44,7 +44,7 @@ public AdminEmailAttributes getAdminEmailById(String emailId) { * Gets an admin email by subject and createDate. * @return null if no matched email found */ - public AdminEmailAttributes getAdminEmail(String subject, Date createDate) { + public AdminEmailAttributes getAdminEmail(String subject, Instant createDate) { Assumption.assertNotNull(subject); Assumption.assertNotNull(createDate); @@ -117,7 +117,7 @@ public List getAdminEmailsInTrashBin() { return adminEmailsDb.getAdminEmailsInTrashBin(); } - public Date createAdminEmail(AdminEmailAttributes newAdminEmail) throws InvalidParametersException { + public Instant createAdminEmail(AdminEmailAttributes newAdminEmail) throws InvalidParametersException { return adminEmailsDb.createAdminEmail(newAdminEmail); } diff --git a/src/main/java/teammates/logic/core/FeedbackResponseCommentsLogic.java b/src/main/java/teammates/logic/core/FeedbackResponseCommentsLogic.java index ebccd476aaa..d2402a7819b 100644 --- a/src/main/java/teammates/logic/core/FeedbackResponseCommentsLogic.java +++ b/src/main/java/teammates/logic/core/FeedbackResponseCommentsLogic.java @@ -1,6 +1,6 @@ package teammates.logic.core; -import java.util.Date; +import java.time.Instant; import java.util.List; import java.util.Set; @@ -77,8 +77,8 @@ public FeedbackResponseCommentAttributes getFeedbackResponseComment(Long feedbac return frcDb.getFeedbackResponseComment(feedbackResponseCommentId); } - public FeedbackResponseCommentAttributes getFeedbackResponseComment(String responseId, String giverEmail, - Date creationDate) { + public FeedbackResponseCommentAttributes getFeedbackResponseComment( + String responseId, String giverEmail, Instant creationDate) { return frcDb.getFeedbackResponseComment(responseId, giverEmail, creationDate); } diff --git a/src/main/java/teammates/storage/api/AdminEmailsDb.java b/src/main/java/teammates/storage/api/AdminEmailsDb.java index 5ca9b263813..23f90299db1 100644 --- a/src/main/java/teammates/storage/api/AdminEmailsDb.java +++ b/src/main/java/teammates/storage/api/AdminEmailsDb.java @@ -2,7 +2,7 @@ import static com.googlecode.objectify.ObjectifyService.ofy; -import java.util.Date; +import java.time.Instant; import java.util.List; import com.google.appengine.api.blobstore.BlobKey; @@ -19,6 +19,7 @@ import teammates.common.util.Const; import teammates.common.util.GoogleCloudStorageHelper; import teammates.common.util.ThreadHelper; +import teammates.common.util.TimeHelper; import teammates.storage.entity.AdminEmail; /** @@ -29,7 +30,7 @@ */ public class AdminEmailsDb extends EntitiesDb { - public Date createAdminEmail(AdminEmailAttributes adminEmailToAdd) throws InvalidParametersException { + public Instant createAdminEmail(AdminEmailAttributes adminEmailToAdd) throws InvalidParametersException { try { AdminEmail ae = createEntity(adminEmailToAdd); return ae.getCreateDate(); @@ -144,7 +145,7 @@ public AdminEmailAttributes getAdminEmailById(String emailId) { * Gets an admin email by subject and createDate. * @return null if no matched email found */ - public AdminEmailAttributes getAdminEmail(String subject, Date createDate) { + public AdminEmailAttributes getAdminEmail(String subject, Instant createDate) { return makeAttributesOrNull(getAdminEmailEntity(subject, createDate)); } @@ -204,10 +205,10 @@ private AdminEmail getAdminEmailEntity(String adminEmailId) { return ofy().load().key(key).now(); } - private AdminEmail getAdminEmailEntity(String subject, Date createDate) { + private AdminEmail getAdminEmailEntity(String subject, Instant createDate) { return load() .filter("subject =", subject) - .filter("createDate =", createDate) + .filter("createDate =", TimeHelper.convertInstantToDate(createDate)) .first().now(); } @@ -226,8 +227,7 @@ protected AdminEmail getEntity(AdminEmailAttributes adminEmailToGet) { return getAdminEmailEntity(adminEmailToGet.getEmailId()); } - return getAdminEmailEntity(adminEmailToGet.getSubject(), - adminEmailToGet.getCreateDate()); + return getAdminEmailEntity(adminEmailToGet.getSubject(), adminEmailToGet.getCreateDate()); } @Override @@ -238,7 +238,7 @@ protected QueryKeys getEntityQueryKeys(AdminEmailAttributes attribut if (key == null) { query = load() .filter("subject =", attributes.subject) - .filter("createDate =", attributes.createDate); + .filter("createDate =", TimeHelper.convertInstantToDate(attributes.createDate)); } else { query = load().filterKey(key); } diff --git a/src/main/java/teammates/storage/api/FeedbackResponseCommentsDb.java b/src/main/java/teammates/storage/api/FeedbackResponseCommentsDb.java index 6967f9b0193..ff39367c478 100644 --- a/src/main/java/teammates/storage/api/FeedbackResponseCommentsDb.java +++ b/src/main/java/teammates/storage/api/FeedbackResponseCommentsDb.java @@ -2,10 +2,10 @@ import static com.googlecode.objectify.ObjectifyService.ofy; +import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -26,6 +26,7 @@ import teammates.common.util.Assumption; import teammates.common.util.Const; import teammates.common.util.Logger; +import teammates.common.util.TimeHelper; import teammates.storage.entity.FeedbackResponseComment; import teammates.storage.search.FeedbackResponseCommentSearchDocument; import teammates.storage.search.FeedbackResponseCommentSearchQuery; @@ -97,7 +98,7 @@ public FeedbackResponseCommentAttributes getFeedbackResponseComment(Long feedbac * @return Null if not found. */ public FeedbackResponseCommentAttributes getFeedbackResponseComment( - String feedbackResponseId, String giverEmail, Date createdAt) { + String feedbackResponseId, String giverEmail, Instant createdAt) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackResponseId); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, giverEmail); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, createdAt); @@ -113,7 +114,7 @@ public FeedbackResponseCommentAttributes getFeedbackResponseComment( * @return Null if not found. */ public FeedbackResponseCommentAttributes getFeedbackResponseComment( - String courseId, Date createdAt, String giverEmail) { + String courseId, Instant createdAt, String giverEmail) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, giverEmail); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, createdAt); @@ -332,10 +333,10 @@ public void deleteCommentById(Long id) { ofy().delete().keys(getEntityQueryKeys(id)).now(); } - private FeedbackResponseComment getFeedbackResponseCommentEntity(String courseId, Date createdAt, String giverEmail) { + private FeedbackResponseComment getFeedbackResponseCommentEntity(String courseId, Instant createdAt, String giverEmail) { return load() .filter("courseId =", courseId) - .filter("createdAt =", createdAt) + .filter("createdAt =", TimeHelper.convertInstantToDate(createdAt)) .filter("giverEmail =", giverEmail) .first().now(); } @@ -345,11 +346,11 @@ private FeedbackResponseComment getFeedbackResponseCommentEntity(Long feedbackRe } private FeedbackResponseComment getFeedbackResponseCommentEntity( - String feedbackResponseId, String giverEmail, Date createdAt) { + String feedbackResponseId, String giverEmail, Instant createdAt) { return load() .filter("feedbackResponseId =", feedbackResponseId) .filter("giverEmail =", giverEmail) - .filter("createdAt =", createdAt) + .filter("createdAt =", TimeHelper.convertInstantToDate(createdAt)) .first().now(); } @@ -439,7 +440,7 @@ protected QueryKeys getEntityQueryKeys(FeedbackResponse return load() .filter("courseId =", attributes.courseId) - .filter("createdAt =", attributes.createdAt) + .filter("createdAt =", TimeHelper.convertInstantToDate(attributes.createdAt)) .filter("giverEmail =", attributes.giverEmail) .keys(); } diff --git a/src/main/java/teammates/storage/api/ProfilesDb.java b/src/main/java/teammates/storage/api/ProfilesDb.java index bc37dd38b40..b955f0c06cc 100644 --- a/src/main/java/teammates/storage/api/ProfilesDb.java +++ b/src/main/java/teammates/storage/api/ProfilesDb.java @@ -2,9 +2,9 @@ import static com.googlecode.objectify.ObjectifyService.ofy; +import java.time.Instant; import java.util.ArrayList; import java.util.Collection; -import java.util.Date; import java.util.List; import com.google.appengine.api.blobstore.BlobKey; @@ -85,7 +85,7 @@ private void updateProfileWithNewValues(StudentProfileAttributes newSpa, Student profileToUpdate.setNationality(newSpa.nationality); profileToUpdate.setGender(newSpa.gender); profileToUpdate.setMoreInfo(new Text(newSpa.moreInfo)); - profileToUpdate.setModifiedDate(new Date()); + profileToUpdate.setModifiedDate(Instant.now()); boolean hasNewNonEmptyPictureKey = !newSpa.pictureKey.isEmpty() && !newSpa.pictureKey.equals(profileToUpdate.getPictureKey().getKeyString()); @@ -113,7 +113,7 @@ public void updateStudentProfilePicture(String googleId, String newPictureKey) t && !newPictureKey.equals(profileToUpdate.getPictureKey().getKeyString()); if (hasNewNonEmptyPictureKey) { profileToUpdate.setPictureKey(new BlobKey(newPictureKey)); - profileToUpdate.setModifiedDate(new Date()); + profileToUpdate.setModifiedDate(Instant.now()); } saveEntity(profileToUpdate); @@ -164,7 +164,7 @@ public void deleteStudentProfilePicture(String googleId) throws EntityDoesNotExi if (!sp.getPictureKey().equals(new BlobKey(""))) { deletePicture(sp.getPictureKey()); sp.setPictureKey(new BlobKey("")); - sp.setModifiedDate(new Date()); + sp.setModifiedDate(Instant.now()); } saveEntity(sp); diff --git a/src/main/java/teammates/storage/entity/Account.java b/src/main/java/teammates/storage/entity/Account.java index 9054f56b27b..47ddd7f0ee5 100644 --- a/src/main/java/teammates/storage/entity/Account.java +++ b/src/main/java/teammates/storage/entity/Account.java @@ -1,5 +1,6 @@ package teammates.storage.entity; +import java.time.Instant; import java.util.Date; import com.googlecode.objectify.Ref; @@ -8,6 +9,8 @@ import com.googlecode.objectify.annotation.Ignore; import com.googlecode.objectify.annotation.Index; +import teammates.common.util.TimeHelper; + /** * Represents a unique user in the system. */ @@ -62,7 +65,7 @@ public Account(String googleId, String name, boolean isInstructor, this.setIsInstructor(isInstructor); this.setEmail(email); this.setInstitute(institute); - this.setCreatedAt(new Date()); + this.setCreatedAt(Instant.now()); this.setStudentProfile(studentProfile); } @@ -111,12 +114,12 @@ public void setInstitute(String institute) { this.institute = institute; } - public Date getCreatedAt() { - return createdAt; + public Instant getCreatedAt() { + return TimeHelper.convertDateToInstant(createdAt); } - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; + public void setCreatedAt(Instant createdAt) { + this.createdAt = TimeHelper.convertInstantToDate(createdAt); } /** diff --git a/src/main/java/teammates/storage/entity/AdminEmail.java b/src/main/java/teammates/storage/entity/AdminEmail.java index 43712b0dba0..4ff0a2e99c4 100644 --- a/src/main/java/teammates/storage/entity/AdminEmail.java +++ b/src/main/java/teammates/storage/entity/AdminEmail.java @@ -1,5 +1,6 @@ package teammates.storage.entity; +import java.time.Instant; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -11,6 +12,8 @@ import com.googlecode.objectify.annotation.Index; import com.googlecode.objectify.annotation.Unindex; +import teammates.common.util.TimeHelper; + /** * Represents emails composed by Admin. */ @@ -52,13 +55,13 @@ private AdminEmail() { * html email content */ public AdminEmail(List addressReceiver, List groupReceiver, String subject, - Text content, Date sendDate) { + Text content, Instant sendDate) { this.emailId = null; this.addressReceiver = addressReceiver == null ? new ArrayList() : addressReceiver; this.groupReceiver = groupReceiver == null ? new ArrayList() : groupReceiver; this.subject = subject; this.content = content; - this.sendDate = sendDate; + this.sendDate = TimeHelper.convertInstantToDate(sendDate); this.createDate = new Date(); this.isInTrashBin = false; } @@ -83,8 +86,8 @@ public void setIsInTrashBin(boolean isInTrashBin) { this.isInTrashBin = isInTrashBin; } - public void setSendDate(Date sendDate) { - this.sendDate = sendDate; + public void setSendDate(Instant sendDate) { + this.sendDate = TimeHelper.convertInstantToDate(sendDate); } public String getEmailId() { @@ -103,8 +106,8 @@ public String getSubject() { return this.subject; } - public Date getSendDate() { - return this.sendDate; + public Instant getSendDate() { + return TimeHelper.convertDateToInstant(this.sendDate); } public Text getContent() { @@ -115,7 +118,7 @@ public boolean getIsInTrashBin() { return this.isInTrashBin; } - public Date getCreateDate() { - return this.createDate; + public Instant getCreateDate() { + return TimeHelper.convertDateToInstant(this.createDate); } } diff --git a/src/main/java/teammates/storage/entity/CourseStudent.java b/src/main/java/teammates/storage/entity/CourseStudent.java index bd8477294a3..cb1210fa528 100644 --- a/src/main/java/teammates/storage/entity/CourseStudent.java +++ b/src/main/java/teammates/storage/entity/CourseStudent.java @@ -1,6 +1,7 @@ package teammates.storage.entity; import java.security.SecureRandom; +import java.time.Instant; import java.util.Date; import com.google.gson.annotations.SerializedName; @@ -13,6 +14,7 @@ import teammates.common.util.Assumption; import teammates.common.util.StringHelper; +import teammates.common.util.TimeHelper; /** * An association class that represents the association Account --> @@ -92,7 +94,7 @@ public CourseStudent(String email, String name, String googleId, String comments setTeamName(teamName); setSectionName(sectionName); - setCreatedAt(new Date()); + setCreatedAt(Instant.now()); this.id = makeId(); registrationKey = generateRegistrationKey(); @@ -102,22 +104,22 @@ private String makeId() { return getEmail() + '%' + getCourseId(); } - public Date getCreatedAt() { - return createdAt; + public Instant getCreatedAt() { + return TimeHelper.convertDateToInstant(createdAt); } - public void setCreatedAt(Date created) { - this.createdAt = created; + public void setCreatedAt(Instant created) { + this.createdAt = TimeHelper.convertInstantToDate(created); setLastUpdate(created); } - public Date getUpdatedAt() { - return updatedAt; + public Instant getUpdatedAt() { + return TimeHelper.convertDateToInstant(updatedAt); } - public void setLastUpdate(Date updatedAt) { + public void setLastUpdate(Instant updatedAt) { if (!keepUpdateTimestamp) { - this.updatedAt = updatedAt; + this.updatedAt = TimeHelper.convertInstantToDate(updatedAt); } } @@ -202,7 +204,7 @@ public void setSectionName(String sectionName) { @OnSave public void updateLastUpdateTimestamp() { - this.setLastUpdate(new Date()); + this.setLastUpdate(Instant.now()); } /** diff --git a/src/main/java/teammates/storage/entity/FeedbackQuestion.java b/src/main/java/teammates/storage/entity/FeedbackQuestion.java index 917ac71825b..b58f2fb7b59 100644 --- a/src/main/java/teammates/storage/entity/FeedbackQuestion.java +++ b/src/main/java/teammates/storage/entity/FeedbackQuestion.java @@ -1,5 +1,6 @@ package teammates.storage.entity; +import java.time.Instant; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -15,6 +16,7 @@ import teammates.common.datatransfer.FeedbackParticipantType; import teammates.common.datatransfer.questions.FeedbackQuestionType; import teammates.common.util.Const; +import teammates.common.util.TimeHelper; /** * Represents a feedback question. @@ -100,25 +102,25 @@ public FeedbackQuestion( this.showGiverNameTo = showGiverNameTo == null ? new ArrayList() : showGiverNameTo; this.showRecipientNameTo = showRecipientNameTo == null ? new ArrayList() : showRecipientNameTo; - this.setCreatedAt(new Date()); + this.setCreatedAt(Instant.now()); } - public Date getCreatedAt() { - return createdAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE : createdAt; + public Instant getCreatedAt() { + return createdAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : TimeHelper.convertDateToInstant(createdAt); } - public Date getUpdatedAt() { - return updatedAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE : updatedAt; + public Instant getUpdatedAt() { + return updatedAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : TimeHelper.convertDateToInstant(updatedAt); } - public void setCreatedAt(Date newDate) { - this.createdAt = newDate; + public void setCreatedAt(Instant newDate) { + this.createdAt = TimeHelper.convertInstantToDate(newDate); setLastUpdate(newDate); } - public void setLastUpdate(Date newDate) { + public void setLastUpdate(Instant newDate) { if (!keepUpdateTimestamp) { - this.updatedAt = newDate; + this.updatedAt = TimeHelper.convertInstantToDate(newDate); } } @@ -234,6 +236,6 @@ public void setShowRecipientNameTo( @OnSave public void updateLastUpdateTimestamp() { - this.setLastUpdate(new Date()); + this.setLastUpdate(Instant.now()); } } diff --git a/src/main/java/teammates/storage/entity/FeedbackResponse.java b/src/main/java/teammates/storage/entity/FeedbackResponse.java index 56567e7e781..943b656687f 100644 --- a/src/main/java/teammates/storage/entity/FeedbackResponse.java +++ b/src/main/java/teammates/storage/entity/FeedbackResponse.java @@ -1,5 +1,6 @@ package teammates.storage.entity; +import java.time.Instant; import java.util.Date; import com.google.appengine.api.datastore.Text; @@ -11,6 +12,7 @@ import teammates.common.datatransfer.questions.FeedbackQuestionType; import teammates.common.util.Const; +import teammates.common.util.TimeHelper; /** * Represents a feedback response. @@ -75,7 +77,7 @@ public FeedbackResponse(String feedbackSessionName, String courseId, this.feedbackResponseId = feedbackQuestionId + "%" + giverEmail + "%" + receiver; - this.setCreatedAt(new Date()); + this.setCreatedAt(Instant.now()); } public String getId() { @@ -154,27 +156,27 @@ public void setAnswer(Text answer) { this.answer = answer; } - public Date getCreatedAt() { - return createdAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE : createdAt; + public Instant getCreatedAt() { + return createdAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : TimeHelper.convertDateToInstant(createdAt); } - public Date getUpdatedAt() { - return updatedAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE : updatedAt; + public Instant getUpdatedAt() { + return updatedAt == null ? Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP : TimeHelper.convertDateToInstant(updatedAt); } - public void setCreatedAt(Date newDate) { - this.createdAt = newDate; + public void setCreatedAt(Instant newDate) { + this.createdAt = TimeHelper.convertInstantToDate(newDate); setLastUpdate(newDate); } - public void setLastUpdate(Date newDate) { + public void setLastUpdate(Instant newDate) { if (!keepUpdateTimestamp) { - this.updatedAt = newDate; + this.updatedAt = TimeHelper.convertInstantToDate(newDate); } } @OnSave public void updateLastUpdateTimestamp() { - this.setLastUpdate(new Date()); + this.setLastUpdate(Instant.now()); } } diff --git a/src/main/java/teammates/storage/entity/FeedbackResponseComment.java b/src/main/java/teammates/storage/entity/FeedbackResponseComment.java index d5dd74101c3..d5bf85987a8 100644 --- a/src/main/java/teammates/storage/entity/FeedbackResponseComment.java +++ b/src/main/java/teammates/storage/entity/FeedbackResponseComment.java @@ -1,5 +1,6 @@ package teammates.storage.entity; +import java.time.Instant; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -12,6 +13,7 @@ import teammates.common.datatransfer.FeedbackParticipantType; import teammates.common.util.SanitizationHelper; +import teammates.common.util.TimeHelper; /** * An association class that represents the association @@ -72,16 +74,16 @@ private FeedbackResponseComment() { public FeedbackResponseComment(String courseId, String feedbackSessionName, String feedbackQuestionId, String giverEmail, String feedbackResponseId, - Date createdAt, Text commentText, + Instant createdAt, Text commentText, String giverSection, String receiverSection, List showCommentTo, - List showGiverNameTo, String lastEditorEmail, Date lastEditedAt) { + List showGiverNameTo, String lastEditorEmail, Instant lastEditedAt) { this.feedbackResponseCommentId = null; // Auto generated by GAE this.courseId = courseId; this.feedbackSessionName = feedbackSessionName; this.feedbackQuestionId = feedbackQuestionId; this.giverEmail = giverEmail; this.feedbackResponseId = feedbackResponseId; - this.createdAt = createdAt; + this.createdAt = TimeHelper.convertInstantToDate(createdAt); this.commentText = SanitizationHelper.sanitizeForRichText(commentText); this.giverSection = giverSection; this.receiverSection = receiverSection; @@ -89,7 +91,7 @@ public FeedbackResponseComment(String courseId, String feedbackSessionName, this.showGiverNameTo = showGiverNameTo == null ? new ArrayList() : showGiverNameTo; this.isVisibilityFollowingFeedbackQuestion = false; this.lastEditorEmail = lastEditorEmail == null ? giverEmail : lastEditorEmail; - this.lastEditedAt = lastEditedAt == null ? createdAt : lastEditedAt; + this.lastEditedAt = lastEditedAt == null ? this.createdAt : TimeHelper.convertInstantToDate(lastEditedAt); } /** @@ -170,12 +172,12 @@ public void setFeedbackResponseId(String feedbackResponseId) { this.feedbackResponseId = feedbackResponseId; } - public Date getCreatedAt() { - return createdAt; + public Instant getCreatedAt() { + return TimeHelper.convertDateToInstant(createdAt); } - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; + public void setCreatedAt(Instant createdAt) { + this.createdAt = TimeHelper.convertInstantToDate(createdAt); } public Text getCommentText() { @@ -210,11 +212,11 @@ public String getLastEditorEmail() { return this.lastEditorEmail; } - public Date getLastEditedAt() { - return this.lastEditedAt; + public Instant getLastEditedAt() { + return TimeHelper.convertDateToInstant(this.lastEditedAt); } - public void setLastEditedAt(Date lastEditedAt) { - this.lastEditedAt = lastEditedAt; + public void setLastEditedAt(Instant lastEditedAt) { + this.lastEditedAt = TimeHelper.convertInstantToDate(lastEditedAt); } } diff --git a/src/main/java/teammates/storage/entity/StudentProfile.java b/src/main/java/teammates/storage/entity/StudentProfile.java index c65dba60144..18b278af858 100644 --- a/src/main/java/teammates/storage/entity/StudentProfile.java +++ b/src/main/java/teammates/storage/entity/StudentProfile.java @@ -1,5 +1,6 @@ package teammates.storage.entity; +import java.time.Instant; import java.util.Date; import com.google.appengine.api.blobstore.BlobKey; @@ -11,6 +12,8 @@ import com.googlecode.objectify.annotation.Parent; import com.googlecode.objectify.annotation.Unindex; +import teammates.common.util.TimeHelper; + /** * Represents profile details for student entities associated with an * account entity. @@ -78,7 +81,7 @@ public StudentProfile(String googleId, String shortName, String email, String in this.setNationality(nationality); this.setGender(gender); this.setMoreInfo(moreInfo); - this.setModifiedDate(new Date()); + this.setModifiedDate(Instant.now()); this.setPictureKey(pictureKey); } @@ -91,7 +94,7 @@ public StudentProfile(String googleId) { this.setGender("other"); this.setMoreInfo(new Text("")); this.setPictureKey(new BlobKey("")); - this.setModifiedDate(new Date()); + this.setModifiedDate(Instant.now()); } public String getGoogleId() { @@ -159,12 +162,12 @@ public void setPictureKey(BlobKey pictureKey) { this.pictureKey = pictureKey; } - public Date getModifiedDate() { - return this.modifiedDate; + public Instant getModifiedDate() { + return TimeHelper.convertDateToInstant(this.modifiedDate); } - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; + public void setModifiedDate(Instant modifiedDate) { + this.modifiedDate = TimeHelper.convertInstantToDate(modifiedDate); } } diff --git a/src/main/java/teammates/storage/search/FeedbackResponseCommentSearchDocument.java b/src/main/java/teammates/storage/search/FeedbackResponseCommentSearchDocument.java index 2011f86fbce..7e4bbb68bda 100644 --- a/src/main/java/teammates/storage/search/FeedbackResponseCommentSearchDocument.java +++ b/src/main/java/teammates/storage/search/FeedbackResponseCommentSearchDocument.java @@ -24,6 +24,7 @@ import teammates.common.util.Const; import teammates.common.util.JsonUtils; import teammates.common.util.StringHelper; +import teammates.common.util.TimeHelper; /** * The {@link SearchDocument} object that defines how we store {@link Document} for response comments. @@ -211,7 +212,7 @@ public Document toDocument() { .addField(Field.newBuilder().setName(Const.SearchDocumentField.SEARCHABLE_TEXT) .setText(searchableText)) .addField(Field.newBuilder().setName(Const.SearchDocumentField.CREATED_DATE) - .setDate(comment.createdAt)) + .setDate(TimeHelper.convertInstantToDate(comment.createdAt))) // attribute field is used to convert a doc back to attribute .addField(Field.newBuilder().setName(Const.SearchDocumentField.FEEDBACK_RESPONSE_COMMENT_ATTRIBUTE) .setText(JsonUtils.toJson(comment))) diff --git a/src/main/java/teammates/ui/controller/AdminEmailComposeSendAction.java b/src/main/java/teammates/ui/controller/AdminEmailComposeSendAction.java index ae64442b4dd..bf17d6c6848 100644 --- a/src/main/java/teammates/ui/controller/AdminEmailComposeSendAction.java +++ b/src/main/java/teammates/ui/controller/AdminEmailComposeSendAction.java @@ -1,7 +1,7 @@ package teammates.ui.controller; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import com.google.appengine.api.blobstore.BlobKey; @@ -144,10 +144,10 @@ private void recordNewSentEmail(String subject, AdminEmailAttributes newDraft = AdminEmailAttributes .builder(subject, addressReceiver, groupReceiver, new Text(content)) - .withSendDate(new Date()) + .withSendDate(Instant.now()) .build(); try { - Date createDate = logic.createAdminEmail(newDraft); + Instant createDate = logic.createAdminEmail(newDraft); emailId = logic.getAdminEmail(subject, createDate).getEmailId(); } catch (Exception e) { isError = true; @@ -168,7 +168,7 @@ private void updateDraftEmailToSent(String emailId, AdminEmailAttributes finalisedEmail = AdminEmailAttributes .builder(subject, addressReceiver, groupReceiver, new Text(content)) - .withSendDate(new Date()) + .withSendDate(Instant.now()) .build(); try { diff --git a/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentAddAction.java b/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentAddAction.java index 4a01f6d976f..09d2d8cc83a 100644 --- a/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentAddAction.java +++ b/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentAddAction.java @@ -1,7 +1,7 @@ package teammates.ui.controller; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import com.google.appengine.api.datastore.Text; @@ -76,7 +76,7 @@ protected ActionResult execute() throws EntityDoesNotExistException { .builder(courseId, feedbackSessionName, instructor.email, new Text(commentText)) .withFeedbackQuestionId(feedbackQuestionId) .withFeedbackResponseId(feedbackResponseId) - .withCreatedAt(new Date()) + .withCreatedAt(Instant.now()) .withGiverSection(response.giverSection) .withReceiverSection(response.recipientSection) .build(); diff --git a/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentEditAction.java b/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentEditAction.java index 4b798e543a5..25e35abbd75 100644 --- a/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentEditAction.java +++ b/src/main/java/teammates/ui/controller/InstructorFeedbackResponseCommentEditAction.java @@ -1,7 +1,7 @@ package teammates.ui.controller; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import com.google.appengine.api.datastore.Text; @@ -56,7 +56,7 @@ protected ActionResult execute() throws EntityDoesNotExistException { FeedbackResponseCommentAttributes feedbackResponseComment = FeedbackResponseCommentAttributes .builder(courseId, feedbackSessionName, instructor.email, new Text(commentText)) - .withCreatedAt(new Date()) + .withCreatedAt(Instant.now()) .withGiverSection(response.giverSection) .withReceiverSection(response.recipientSection) .build(); diff --git a/src/main/java/teammates/ui/pagedata/InstructorFeedbackResponseCommentAjaxPageData.java b/src/main/java/teammates/ui/pagedata/InstructorFeedbackResponseCommentAjaxPageData.java index 099aeebc9a3..a746a5ebab5 100644 --- a/src/main/java/teammates/ui/pagedata/InstructorFeedbackResponseCommentAjaxPageData.java +++ b/src/main/java/teammates/ui/pagedata/InstructorFeedbackResponseCommentAjaxPageData.java @@ -93,8 +93,10 @@ public boolean isResponseVisibleTo(FeedbackParticipantType participantType, Feed public String createEditedCommentDetails(String giverName, String editorName) { boolean isGiverAnonymous = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT.equals(giverName); - return "From: " + giverName + " [" + TimeHelper.formatDateTimeForSessions(comment.createdAt, sessionTimeZone) + "] " - + "(last edited " + (isGiverAnonymous ? "" : "by " + editorName + " ") - + "at " + TimeHelper.formatDateTimeForSessions(comment.lastEditedAt, sessionTimeZone) + ")"; + return "From: " + giverName + " [" + + TimeHelper.formatDateTimeForSessions(comment.createdAt, TimeHelper.convertToZoneId(sessionTimeZone)) + + "] (last edited " + (isGiverAnonymous ? "" : "by " + editorName + " ") + "at " + + TimeHelper.formatDateTimeForSessions(comment.lastEditedAt, TimeHelper.convertToZoneId(sessionTimeZone)) + + ")"; } } diff --git a/src/main/java/teammates/ui/pagedata/PageData.java b/src/main/java/teammates/ui/pagedata/PageData.java index 19f1da8f03b..d3567f716a1 100644 --- a/src/main/java/teammates/ui/pagedata/PageData.java +++ b/src/main/java/teammates/ui/pagedata/PageData.java @@ -2,7 +2,6 @@ import java.time.LocalDateTime; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.Set; @@ -76,10 +75,6 @@ public static String truncate(String untruncatedString, int truncateLength) { return StringHelper.truncate(untruncatedString, truncateLength); } - public static String displayDateTime(Date date) { - return TimeHelper.formatTime12H(date); - } - public String addUserIdToUrl(String link) { return Url.addParamToUrl(link, Const.ParamsNames.USER_ID, account.googleId); } diff --git a/src/main/java/teammates/ui/template/AdminAccountManagementAccountTableRow.java b/src/main/java/teammates/ui/template/AdminAccountManagementAccountTableRow.java index d9f37377e6d..231d3e75fb0 100644 --- a/src/main/java/teammates/ui/template/AdminAccountManagementAccountTableRow.java +++ b/src/main/java/teammates/ui/template/AdminAccountManagementAccountTableRow.java @@ -5,8 +5,8 @@ import teammates.common.datatransfer.attributes.AccountAttributes; import teammates.common.datatransfer.attributes.InstructorAttributes; import teammates.common.util.Const; +import teammates.common.util.TimeHelper; import teammates.common.util.Url; -import teammates.ui.pagedata.AdminAccountManagementPageData; public class AdminAccountManagementAccountTableRow { private AccountAttributes account; @@ -35,7 +35,8 @@ public String getInstructorHomePageViewLink() { } public String getCreatedAt() { - return AdminAccountManagementPageData.displayDateTime(account.createdAt); + return TimeHelper.formatTime12H(TimeHelper.convertInstantToLocalDateTime( + account.createdAt, Const.SystemParams.ADMIN_TIME_ZONE_ID)); } public String getAdminViewAccountDetailsLink() { diff --git a/src/main/java/teammates/ui/template/AdminActivityLogTableRow.java b/src/main/java/teammates/ui/template/AdminActivityLogTableRow.java index d3440e38e18..0e30e68f674 100644 --- a/src/main/java/teammates/ui/template/AdminActivityLogTableRow.java +++ b/src/main/java/teammates/ui/template/AdminActivityLogTableRow.java @@ -112,8 +112,7 @@ public String getDisplayedActionUrl() { public String getDisplayedLogTime() { Instant logInstant = Instant.ofEpochMilli(activityLog.getLogTime()); - return TimeHelper.formatActivityLogTime(logInstant, - TimeHelper.convertToZoneId(Const.SystemParams.ADMIN_TIME_ZONE_DOUBLE)); + return TimeHelper.formatActivityLogTime(logInstant, Const.SystemParams.ADMIN_TIME_ZONE_ID); } public String getDisplayedRole() { diff --git a/src/main/java/teammates/ui/template/FeedbackResponseCommentRow.java b/src/main/java/teammates/ui/template/FeedbackResponseCommentRow.java index b9aa903a7f0..62495785966 100644 --- a/src/main/java/teammates/ui/template/FeedbackResponseCommentRow.java +++ b/src/main/java/teammates/ui/template/FeedbackResponseCommentRow.java @@ -1,6 +1,6 @@ package teammates.ui.template; -import java.util.Date; +import java.time.Instant; import java.util.List; import java.util.Map; @@ -43,7 +43,8 @@ public FeedbackResponseCommentRow(FeedbackResponseCommentAttributes frc, String this.commentId = frc.getId(); this.giverDisplay = giverDisplay; this.sessionTimeZone = sessionTimeZone; - this.createdAt = TimeHelper.formatDateTimeForSessions(frc.createdAt, this.sessionTimeZone); + this.createdAt = TimeHelper.formatDateTimeForSessions( + frc.createdAt, TimeHelper.convertToZoneId(this.sessionTimeZone)); this.commentText = frc.commentText.getValue(); this.commentGiverName = getCommentGiverNameFromEmail(giverDisplay); this.editedAt = getEditedAtText(frc.lastEditorEmail, frc.createdAt, frc.lastEditedAt); @@ -252,13 +253,14 @@ private String getCommentGiverNameFromEmail(String giverEmail) { return instructorEmailNameTable.get(giverEmail); } - private String getEditedAtText(String lastEditorEmail, Date createdAt, Date lastEditedAt) { + private String getEditedAtText(String lastEditorEmail, Instant createdAt, Instant lastEditedAt) { if (lastEditedAt == null || lastEditedAt.equals(createdAt)) { return ""; } boolean isGiverAnonymous = Const.DISPLAYED_NAME_FOR_ANONYMOUS_PARTICIPANT.equals(commentGiverName); return "(last edited " + (isGiverAnonymous ? "" : "by " + instructorEmailNameTable.get(lastEditorEmail) + " ") - + "at " + TimeHelper.formatDateTimeForSessions(lastEditedAt, sessionTimeZone) + ")"; + + "at " + TimeHelper.formatDateTimeForSessions(lastEditedAt, TimeHelper.convertToZoneId(sessionTimeZone)) + + ")"; } } diff --git a/src/main/resources/InstructorSampleData.json b/src/main/resources/InstructorSampleData.json index 8673e1f0008..5efbc1dc942 100644 --- a/src/main/resources/InstructorSampleData.json +++ b/src/main/resources/InstructorSampleData.json @@ -2784,12 +2784,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:17 PM UTC", + "createdAt": "2012-04-30T21:17:00Z", "commentText": { "value": "

Alice, good to know that you liked applying software engineering skills in the project. Don’t forget to use the project to practice communication skills too.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:17 PM UTC" + "lastEditedAt": "2012-04-30T21:17:00Z" }, "comment1FromT1C1ToR1Q5S1C1": { "courseId": "demo.course", @@ -2810,12 +2810,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:20 PM UTC", + "createdAt": "2012-04-30T21:20:00Z", "commentText": { "value": "

Completely agree, the application does look pretty.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:20 PM UTC" + "lastEditedAt": "2012-04-30T21:20:00Z" }, "comment1FromT1C1ToR3Q5S1C1": { "courseId": "demo.course", @@ -2836,12 +2836,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:23 PM UTC", + "createdAt": "2012-04-30T21:23:00Z", "commentText": { "value": "

Alice, He's one of the best designers in our institute and always amazes everyone with his work.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:23 PM UTC" + "lastEditedAt": "2012-04-30T21:23:00Z" }, "comment1FromT1C1ToR2Q2S1C1": { "courseId": "demo.course", @@ -2862,12 +2862,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:26 PM UTC", + "createdAt": "2012-04-30T21:26:00Z", "commentText": { "value": "

Hoping you keep using them on future projects.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:26 PM UTC" + "lastEditedAt": "2012-04-30T21:26:00Z" }, "comment1FromT1C1ToR1Q2S2C1": { "courseId": "demo.course", @@ -2892,12 +2892,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:29 PM UTC", + "createdAt": "2012-04-30T21:29:00Z", "commentText": { "value": "

Nice work Alice, Impressed by clean, portable and well-documented code.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:29 PM UTC" + "lastEditedAt": "2012-04-30T21:29:00Z" }, "comment1FromT1C1ToR2Q2S2C1": { "courseId": "demo.course", @@ -2922,12 +2922,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:33 PM UTC", + "createdAt": "2012-04-30T21:33:00Z", "commentText": { "value": "

Although there are some loopholes in UI, But overall looks good.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:33 PM UTC" + "lastEditedAt": "2012-04-30T21:33:00Z" }, "comment1FromT1C1ToR5Q2S2C1": { "courseId": "demo.course", @@ -2952,12 +2952,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:36 PM UTC", + "createdAt": "2012-04-30T21:36:00Z", "commentText": { "value": "

Well, Being your first team project always takes some time. I hope you had nice experience working with the team.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:36 PM UTC" + "lastEditedAt": "2012-04-30T21:36:00Z" }, "comment1FromT1C1ToR6Q2S2C1": { "courseId": "demo.course", @@ -2982,12 +2982,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-30 9:39 PM UTC", + "createdAt": "2012-04-30T21:39:00Z", "commentText": { "value": "

Design could have been more interactive.

" }, "lastEditorEmail": "teammates.demo.instructor@demo.course", - "lastEditedAt": "2012-04-30 9:39 PM UTC" + "lastEditedAt": "2012-04-30T21:39:00Z" } }, "profiles": {} diff --git a/src/test/java/teammates/test/cases/datatransfer/AccountAttributesTest.java b/src/test/java/teammates/test/cases/datatransfer/AccountAttributesTest.java index 726e95ac3dd..d43cb032442 100644 --- a/src/test/java/teammates/test/cases/datatransfer/AccountAttributesTest.java +++ b/src/test/java/teammates/test/cases/datatransfer/AccountAttributesTest.java @@ -1,6 +1,6 @@ package teammates.test.cases.datatransfer; -import java.util.Date; +import java.time.Instant; import org.testng.annotations.Test; @@ -161,7 +161,7 @@ public void testBuilderWithPopulatedFieldValues() { String expectedName = "dummyName"; String expectedInstitute = "dummyInstitute"; boolean expectedIsInstructor = true; //since false case is covered in default test - Date expectedCreatedAt = new Date(98765); + Instant expectedCreatedAt = Instant.ofEpochMilli(98765); AccountAttributes observedAccountAttributes = AccountAttributes.builder() .withGoogleId(expectedGoogleId) diff --git a/src/test/java/teammates/test/cases/datatransfer/AdminEmailAttributesTest.java b/src/test/java/teammates/test/cases/datatransfer/AdminEmailAttributesTest.java index 5ebd7cd3280..f35bb14193b 100644 --- a/src/test/java/teammates/test/cases/datatransfer/AdminEmailAttributesTest.java +++ b/src/test/java/teammates/test/cases/datatransfer/AdminEmailAttributesTest.java @@ -1,8 +1,8 @@ package teammates.test.cases.datatransfer; +import java.time.Instant; +import java.time.LocalDateTime; import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; import java.util.List; import org.testng.annotations.Test; @@ -26,7 +26,7 @@ public class AdminEmailAttributesTest extends BaseAttributesTest { private List groupReceiverListFileKey = Arrays.asList("listfilekey", "listfilekey"); private String subject = "subject of email"; private Text content = new Text("valid email content"); - private Date date = new Date(); + private Instant date = Instant.now(); private AdminEmailAttributes validAdminEmailAttributesObject = AdminEmailAttributes .builder(subject, addressReceiverListString, groupReceiverListFileKey, content) .build(); @@ -43,7 +43,7 @@ public void testBuilderWithDefaultValues() { assertEquals(Const.ParamsNames.ADMIN_EMAIL_ID, attributesWithDefaultValues.getEmailId()); assertFalse("Default false for isInTrashBin", attributesWithDefaultValues.isInTrashBin); - assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE, attributesWithDefaultValues.getCreateDate()); + assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, attributesWithDefaultValues.getCreateDate()); assertTrue("Valid input", attributesWithDefaultValues.isValid()); } @@ -64,7 +64,7 @@ public void testBuilderWithNullOptionalArguments() { assertEquals(Const.ParamsNames.ADMIN_EMAIL_ID, attributesWithNullOptionalArguments.getEmailId()); assertFalse("Default false for isInTrashBin", attributesWithNullOptionalArguments.isInTrashBin); - assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE, attributesWithNullOptionalArguments.getCreateDate()); + assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, attributesWithNullOptionalArguments.getCreateDate()); assertEquals(null, attributesWithNullOptionalArguments.getSendDate()); } @@ -259,26 +259,22 @@ public void testSanitizeForSaving() { @Test public void testSendDateForDisplay() { - Calendar calendar = formatDateForAdminEmailAttributesTest(validAdminEmailAttributesObject.sendDate); - String expectedDate = TimeHelper.formatTime12H(calendar.getTime()); + validAdminEmailAttributesObject.sendDate = Instant.now(); + String expectedDate = TimeHelper.formatTime12H(convertToAdminTime(validAdminEmailAttributesObject.sendDate)); String actualDate = validAdminEmailAttributesObject.getSendDateForDisplay(); assertEquals(expectedDate, actualDate); } @Test public void testCreateDateForDisplay() { - validAdminEmailAttributesObject.createDate = new Date(); - Calendar calendar = formatDateForAdminEmailAttributesTest(validAdminEmailAttributesObject.createDate); - String expectedDate = TimeHelper.formatTime12H(calendar.getTime()); + validAdminEmailAttributesObject.createDate = Instant.now(); + String expectedDate = TimeHelper.formatTime12H(convertToAdminTime(validAdminEmailAttributesObject.createDate)); String actualDate = validAdminEmailAttributesObject.getCreateDateForDisplay(); assertEquals(expectedDate, actualDate); } - private Calendar formatDateForAdminEmailAttributesTest(Date date) { - validAdminEmailAttributesObject.sendDate = new Date(); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - return TimeHelper.convertToUserTimeZone(calendar, Const.SystemParams.ADMIN_TIME_ZONE_DOUBLE); + private LocalDateTime convertToAdminTime(Instant date) { + return TimeHelper.convertInstantToLocalDateTime(date, Const.SystemParams.ADMIN_TIME_ZONE_ID); } private String getInvalidityInfoForSubject(String emailSubject) throws Exception { diff --git a/src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java b/src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java index 3dc1d54137c..0b0338948c8 100644 --- a/src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java +++ b/src/test/java/teammates/test/cases/datatransfer/FeedbackQuestionAttributesTest.java @@ -1,7 +1,7 @@ package teammates.test.cases.datatransfer; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import org.testng.annotations.Test; @@ -27,11 +27,11 @@ public class FeedbackQuestionAttributesTest extends BaseTestCase { private static class FeedbackQuestionAttributesWithModifiableTimestamp extends FeedbackQuestionAttributes { - void setCreatedAt(Date createdAt) { + void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; } - void setUpdatedAt(Date updatedAt) { + void setUpdatedAt(Instant updatedAt) { this.updatedAt = updatedAt; } @@ -46,7 +46,7 @@ public void testDefaultTimestamp() { fq.setCreatedAt(null); fq.setUpdatedAt(null); - Date defaultTimeStamp = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE; + Instant defaultTimeStamp = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; ______TS("success : defaultTimeStamp for createdAt date"); diff --git a/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseAttributesTest.java b/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseAttributesTest.java index b1655a71531..02a92483dab 100644 --- a/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseAttributesTest.java +++ b/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseAttributesTest.java @@ -1,6 +1,6 @@ package teammates.test.cases.datatransfer; -import java.util.Date; +import java.time.Instant; import org.testng.annotations.Test; @@ -15,11 +15,11 @@ public class FeedbackResponseAttributesTest extends BaseTestCase { private static class FeedbackResponseAttributesWithModifiableTimestamp extends FeedbackResponseAttributes { - void setCreatedAt(Date createdAt) { + void setCreatedAt(Instant createdAt) { this.createdAt = createdAt; } - void setUpdatedAt(Date updatedAt) { + void setUpdatedAt(Instant updatedAt) { this.updatedAt = updatedAt; } @@ -33,7 +33,7 @@ public void testDefaultTimestamp() { fra.setCreatedAt(null); fra.setUpdatedAt(null); - Date defaultTimeStamp = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE; + Instant defaultTimeStamp = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; ______TS("success : defaultTimeStamp for createdAt date"); diff --git a/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseCommentAttributesTest.java b/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseCommentAttributesTest.java index 08b1dbc423e..7f414794ab4 100644 --- a/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseCommentAttributesTest.java +++ b/src/test/java/teammates/test/cases/datatransfer/FeedbackResponseCommentAttributesTest.java @@ -1,7 +1,7 @@ package teammates.test.cases.datatransfer; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import org.testng.annotations.Test; @@ -41,7 +41,7 @@ public void testBuilderWithNullValues() { .withLastEditorEmail(null) .withReceiverSection(null) .withGiverSection(null) - .withCreatedAt(new Date()) + .withCreatedAt(Instant.now()) .withLastEditedAt(null) .withFeedbackResponseCommentId(null) .withVisibilityFollowingFeedbackQuestion(null) @@ -58,7 +58,7 @@ public void testBuilderWithNullValues() { @Test public void testValueOf() { FeedbackResponseComment responseComment = new FeedbackResponseComment("course", "name", - "question", "giver", "response", new Date(), + "question", "giver", "response", Instant.now(), new Text("comment"), "giverSection", "receiverSection", null, null, null, null); diff --git a/src/test/java/teammates/test/cases/datatransfer/StudentAttributesTest.java b/src/test/java/teammates/test/cases/datatransfer/StudentAttributesTest.java index 1e8fcf63213..7daee61f304 100644 --- a/src/test/java/teammates/test/cases/datatransfer/StudentAttributesTest.java +++ b/src/test/java/teammates/test/cases/datatransfer/StudentAttributesTest.java @@ -26,8 +26,8 @@ public void testBuilderWithDefaultValues() { .builder("courseId", "Joe White", "e@e.com") .build(); - assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE, sd.getCreatedAt()); - assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE, sd.getUpdatedAt()); + assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getCreatedAt()); + assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getUpdatedAt()); assertEquals("", sd.googleId); assertEquals(Const.DEFAULT_SECTION, sd.section); assertEquals(StudentUpdateStatus.UNKNOWN, sd.updateStatus); @@ -45,8 +45,8 @@ public void testBuilderWithNullValues() { .build(); // Fields with default values - assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE, sd.getCreatedAt()); - assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP_DATE, sd.getUpdatedAt()); + assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getCreatedAt()); + assertEquals(Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP, sd.getUpdatedAt()); assertEquals("", sd.googleId); assertEquals(Const.DEFAULT_SECTION, sd.section); assertEquals(StudentUpdateStatus.UNKNOWN, sd.updateStatus); diff --git a/src/test/java/teammates/test/cases/datatransfer/StudentProfileAttributesTest.java b/src/test/java/teammates/test/cases/datatransfer/StudentProfileAttributesTest.java index 3ab97f864db..a7f0e3c0b7d 100644 --- a/src/test/java/teammates/test/cases/datatransfer/StudentProfileAttributesTest.java +++ b/src/test/java/teammates/test/cases/datatransfer/StudentProfileAttributesTest.java @@ -106,13 +106,13 @@ public void testGetIdentificationString() { @Test public void testGetJsonString() throws Exception { StudentProfileAttributes spa = StudentProfileAttributes.valueOf(profile.toEntity()); - spa.modifiedDate = TimeHelper.convertToDate("2015-05-21 8:34 AM +0000"); + spa.modifiedDate = TimeHelper.parseInstant("2015-05-21 8:34 AM +0000"); assertEquals("{\n \"googleId\": \"valid.googleId\",\n \"shortName\": \"shor\"," + "\n \"email\": \"valid@email.com\",\n \"institute\": \"institute\"," + "\n \"nationality\": \"Lebanese\",\n \"gender\": \"female\"," + "\n \"moreInfo\": \"moreInfo can have a lot more than this...\"," + "\n \"pictureKey\": \"profile Pic Key\"," - + "\n \"modifiedDate\": \"2015-05-21 8:34 AM +0000\"\n}", + + "\n \"modifiedDate\": \"2015-05-21T08:34:00Z\"\n}", spa.getJsonString()); } diff --git a/src/test/java/teammates/test/cases/storage/AccountsDbTest.java b/src/test/java/teammates/test/cases/storage/AccountsDbTest.java index 28f4edbdb86..b90766502e6 100644 --- a/src/test/java/teammates/test/cases/storage/AccountsDbTest.java +++ b/src/test/java/teammates/test/cases/storage/AccountsDbTest.java @@ -1,7 +1,7 @@ package teammates.test.cases.storage; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import org.testng.annotations.Test; @@ -201,7 +201,7 @@ public void testEditAccount() throws Exception { ______TS("success: profile not modified in the default case"); - Date expectedModifiedDate = actualAccount.studentProfile.modifiedDate; + Instant expectedModifiedDate = actualAccount.studentProfile.modifiedDate; String expectedNationality = actualAccount.studentProfile.nationality; actualAccount.studentProfile.nationality = "Andorran"; diff --git a/src/test/java/teammates/test/cases/storage/FeedbackQuestionsDbTest.java b/src/test/java/teammates/test/cases/storage/FeedbackQuestionsDbTest.java index d3c355e97c3..53b59dd3683 100644 --- a/src/test/java/teammates/test/cases/storage/FeedbackQuestionsDbTest.java +++ b/src/test/java/teammates/test/cases/storage/FeedbackQuestionsDbTest.java @@ -46,8 +46,8 @@ public void testTimestamp() throws InvalidParametersException, EntityAlreadyExis fqDb.getFeedbackQuestion(feedbackSessionName, courseId, questionNumber); // Assert dates are now. - AssertHelper.assertDateIsNow(feedbackQuestion.getCreatedAt()); - AssertHelper.assertDateIsNow(feedbackQuestion.getUpdatedAt()); + AssertHelper.assertInstantIsNow(feedbackQuestion.getCreatedAt()); + AssertHelper.assertInstantIsNow(feedbackQuestion.getUpdatedAt()); ______TS("success : update lastUpdated"); @@ -59,7 +59,7 @@ public void testTimestamp() throws InvalidParametersException, EntityAlreadyExis // Assert lastUpdate has changed, and is now. assertFalse(feedbackQuestion.getUpdatedAt().equals(updatedFq.getUpdatedAt())); - AssertHelper.assertDateIsNow(updatedFq.getUpdatedAt()); + AssertHelper.assertInstantIsNow(updatedFq.getUpdatedAt()); ______TS("success : keep lastUpdated"); diff --git a/src/test/java/teammates/test/cases/storage/FeedbackResponseCommentsDbTest.java b/src/test/java/teammates/test/cases/storage/FeedbackResponseCommentsDbTest.java index 7d5c3a6db7c..5669e00add3 100644 --- a/src/test/java/teammates/test/cases/storage/FeedbackResponseCommentsDbTest.java +++ b/src/test/java/teammates/test/cases/storage/FeedbackResponseCommentsDbTest.java @@ -1,7 +1,7 @@ package teammates.test.cases.storage; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import org.testng.annotations.BeforeClass; @@ -74,7 +74,7 @@ public void testAll() throws Exception { private void testEntityCreationAndDeletion() throws Exception { FeedbackResponseCommentAttributes frcaTemp = dataBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q2S1C1"); - frcaTemp.createdAt = new Date(); + frcaTemp.createdAt = Instant.now(); frcaTemp.commentText = new Text("test creation and deletion"); ______TS("Entity creation"); @@ -119,14 +119,14 @@ private void testGetFeedbackResponseCommentFromCommentDetails() { ______TS("null parameter"); try { - frcDb.getFeedbackResponseComment(null, "", new Date()); + frcDb.getFeedbackResponseComment(null, "", Instant.now()); signalFailureToDetectException(); } catch (AssertionError ae) { assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, ae.getMessage()); } try { - frcDb.getFeedbackResponseComment("", null, new Date()); + frcDb.getFeedbackResponseComment("", null, Instant.now()); signalFailureToDetectException(); } catch (AssertionError ae) { assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, ae.getMessage()); @@ -224,7 +224,7 @@ private void testUpdateFeedbackResponseComment() throws Exception { FeedbackResponseCommentAttributes frcaTemp = dataBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q2S1C1"); - frcaTemp.createdAt = new Date(); + frcaTemp.createdAt = Instant.now(); frcaTemp.commentText = new Text("Update feedback response comment"); frcDb.createEntity(frcaTemp); frcaTemp = frcDb.getFeedbackResponseComment(frcaTemp.feedbackResponseId, @@ -308,7 +308,7 @@ private void testUpdateFeedbackResponseCommentsGiverEmail() dataBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q3S1C1"); String giverEmail = "frcdb.newGiver@email.com"; String courseId = "frcdb.giver.courseId"; - Date createdAt = new Date(); + Instant createdAt = Instant.now(); frcaDataOfNewGiver.createdAt = createdAt; frcaDataOfNewGiver.commentText = new Text("another comment for this response"); frcaDataOfNewGiver.setId(null); @@ -367,7 +367,7 @@ private void testDeleteFeedbackResponseCommentsForResponse() // get another frc from data bundle and use it to create another feedback response FeedbackResponseCommentAttributes tempFrcaData = dataBundle.feedbackResponseComments.get("comment1FromT1C1ToR1Q2S1C1"); - tempFrcaData.createdAt = new Date(); + tempFrcaData.createdAt = Instant.now(); tempFrcaData.commentText = new Text("another comment for this response"); // for some reason, the id is 0 instead of null. so we explicitly set it to be null tempFrcaData.setId(null); diff --git a/src/test/java/teammates/test/cases/storage/FeedbackResponsesDbTest.java b/src/test/java/teammates/test/cases/storage/FeedbackResponsesDbTest.java index 59461f1a5a0..b34e63c76b2 100644 --- a/src/test/java/teammates/test/cases/storage/FeedbackResponsesDbTest.java +++ b/src/test/java/teammates/test/cases/storage/FeedbackResponsesDbTest.java @@ -67,8 +67,8 @@ public void testTimestamp() frDb.getFeedbackResponse(feedbackQuestionId, giverEmail, recipientEmail); // Assert dates are now. - AssertHelper.assertDateIsNow(feedbackResponse.getCreatedAt()); - AssertHelper.assertDateIsNow(feedbackResponse.getUpdatedAt()); + AssertHelper.assertInstantIsNow(feedbackResponse.getCreatedAt()); + AssertHelper.assertInstantIsNow(feedbackResponse.getUpdatedAt()); ______TS("success : update lastUpdated"); @@ -80,7 +80,7 @@ public void testTimestamp() // Assert lastUpdate has changed, and is now. assertFalse(feedbackResponse.getUpdatedAt().equals(updatedFr.getUpdatedAt())); - AssertHelper.assertDateIsNow(updatedFr.getUpdatedAt()); + AssertHelper.assertInstantIsNow(updatedFr.getUpdatedAt()); ______TS("success : keep lastUpdated"); diff --git a/src/test/java/teammates/test/cases/storage/StudentsDbTest.java b/src/test/java/teammates/test/cases/storage/StudentsDbTest.java index 085080fa5f8..bdc9c6716ba 100644 --- a/src/test/java/teammates/test/cases/storage/StudentsDbTest.java +++ b/src/test/java/teammates/test/cases/storage/StudentsDbTest.java @@ -33,8 +33,8 @@ public void testTimestamp() throws InvalidParametersException, EntityDoesNotExis assertNotNull(student); // Assert dates are now. - AssertHelper.assertDateIsNow(student.getCreatedAt()); - AssertHelper.assertDateIsNow(student.getUpdatedAt()); + AssertHelper.assertInstantIsNow(student.getCreatedAt()); + AssertHelper.assertInstantIsNow(student.getUpdatedAt()); ______TS("success : update lastUpdated"); @@ -45,7 +45,7 @@ public void testTimestamp() throws InvalidParametersException, EntityDoesNotExis // Assert lastUpdate has changed, and is now. assertFalse(student.getUpdatedAt().equals(updatedStudent.getUpdatedAt())); - AssertHelper.assertDateIsNow(updatedStudent.getUpdatedAt()); + AssertHelper.assertInstantIsNow(updatedStudent.getUpdatedAt()); ______TS("success : keep lastUpdated"); diff --git a/src/test/java/teammates/test/driver/AssertHelper.java b/src/test/java/teammates/test/driver/AssertHelper.java index 19fb77fba70..a5fd0eda6e6 100644 --- a/src/test/java/teammates/test/driver/AssertHelper.java +++ b/src/test/java/teammates/test/driver/AssertHelper.java @@ -3,9 +3,9 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; +import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; -import java.util.Date; import java.util.List; import java.util.regex.Pattern; @@ -23,15 +23,15 @@ private AssertHelper() { } /** - * Assert date is now +- 1 min. + * Assert instant is now +- 1 min. */ - public static void assertDateIsNow(Date date) { - assertDateWithinRange(date, Date.from(TimeHelperExtension.getInstantMinutesOffsetFromNow(-1)), - Date.from(TimeHelperExtension.getInstantMinutesOffsetFromNow(1))); + public static void assertInstantIsNow(Instant instant) { + assertInstantWithinRange(instant, TimeHelperExtension.getInstantMinutesOffsetFromNow(-1), + TimeHelperExtension.getInstantMinutesOffsetFromNow(1)); } - private static void assertDateWithinRange(Date date, Date startDate, Date endDate) { - assertTrue(!(date.before(startDate) || date.after(endDate))); + private static void assertInstantWithinRange(Instant instant, Instant start, Instant end) { + assertTrue(!(instant.isBefore(start) || instant.isAfter(end))); } /** diff --git a/src/test/resources/data/AllAccessControlUiTest.json b/src/test/resources/data/AllAccessControlUiTest.json index 8ce3f918370..ceea3a111c7 100644 --- a/src/test/resources/data/AllAccessControlUiTest.json +++ b/src/test/resources/data/AllAccessControlUiTest.json @@ -1168,7 +1168,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback" } @@ -1184,7 +1184,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-02-01 11:59 PM UTC", + "createdAt": "2026-02-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 2" } @@ -1200,7 +1200,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-01-01 11:59 PM UTC", + "createdAt": "2026-01-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 3" } diff --git a/src/test/resources/data/FeedbackSessionsLogicTest.json b/src/test/resources/data/FeedbackSessionsLogicTest.json index f6306117ff5..74df22f0166 100644 --- a/src/test/resources/data/FeedbackSessionsLogicTest.json +++ b/src/test/resources/data/FeedbackSessionsLogicTest.json @@ -1354,7 +1354,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2016-03-01 11:59 PM UTC", + "createdAt": "2016-03-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback" } @@ -1370,7 +1370,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2016-02-01 11:59 PM UTC", + "createdAt": "2016-02-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 2" } @@ -1386,7 +1386,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2016-01-01 11:59 PM UTC", + "createdAt": "2016-01-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 3" } diff --git a/src/test/resources/data/InstructorFeedbackResultsPageUiTest.json b/src/test/resources/data/InstructorFeedbackResultsPageUiTest.json index 3ba9321d106..466ab499396 100644 --- a/src/test/resources/data/InstructorFeedbackResultsPageUiTest.json +++ b/src/test/resources/data/InstructorFeedbackResultsPageUiTest.json @@ -1786,12 +1786,12 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "

Some comment from instructor

a link attempted script injection " }, "lastEditorEmail": "CFResultsUiT.instr@gmail.tmt", - "lastEditedAt": "2026-03-02 11:59 PM UTC" + "lastEditedAt": "2026-03-02T23:59:00Z" }, "comment2ToBeEditedByDifferentInstructor": { "courseId": "CFResultsUiT.CS2104", @@ -1816,12 +1816,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-02 11:59 PM UTC", + "createdAt": "2012-04-02T23:59:00Z", "commentText": { "value": "Comment to be edited by different instructor." }, "lastEditorEmail": "CFResultsUiT.instr2@gmail.tmt", - "lastEditedAt": "2012-04-02 11:59 PM UTC" + "lastEditedAt": "2012-04-02T23:59:00Z" } }, "profiles": {} diff --git a/src/test/resources/data/InstructorSearchPageUiTest.json b/src/test/resources/data/InstructorSearchPageUiTest.json index 9a97ec9f887..876531d8c21 100644 --- a/src/test/resources/data/InstructorSearchPageUiTest.json +++ b/src/test/resources/data/InstructorSearchPageUiTest.json @@ -559,7 +559,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback" } @@ -578,7 +578,7 @@ ], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2015-02-02 11:59 PM UTC", + "createdAt": "2015-02-02T23:59:00Z", "commentText": { "value": "Anonymous comment to feedback Question 2" } @@ -602,7 +602,7 @@ "RECEIVER_TEAM_MEMBERS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2015-02-03 11:59 PM UTC", + "createdAt": "2015-02-03T23:59:00Z", "commentText": { "value": "Instructor 2 comment to feedback Question 2 (Student 3 see this as anonymous comment)" } @@ -618,7 +618,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2015-02-01 11:59 PM UTC", + "createdAt": "2015-02-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to feedback Question 2" } @@ -638,12 +638,12 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2015-02-04 11:59 PM UTC", + "createdAt": "2015-02-04T23:59:00Z", "commentText": { "value": "Instructor 3 edited comment to feedback Question 2" }, "lastEditorEmail": "searchUI.instructor3@course1.tmt", - "lastEditedAt": "2015-02-05 11:59 PM UTC" + "lastEditedAt": "2015-02-05T23:59:00Z" }, "comment1ForR1S1TSC": { "courseId": "searchUI.idOfTestingSanitizationCourse", @@ -656,7 +656,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "Comment value. Testing quotation marks '\" Testing unclosed tags Testing script injection " } diff --git a/src/test/resources/data/InstructorStudentRecordsPageUiTest.json b/src/test/resources/data/InstructorStudentRecordsPageUiTest.json index a2fc4e3e72a..063da539f47 100644 --- a/src/test/resources/data/InstructorStudentRecordsPageUiTest.json +++ b/src/test/resources/data/InstructorStudentRecordsPageUiTest.json @@ -706,7 +706,7 @@ "INSTRUCTORS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2012-04-02 11:59 PM UTC", + "createdAt": "2012-04-02T23:59:00Z", "commentText": { "value": "First comment to Alice about feedback to Benny from different instructor" } @@ -722,12 +722,12 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "Instructor second comment to Alice about feedback to Benny" }, "lastEditorEmail": "teammates.test@gmail.tmt", - "lastEditedAt": "2026-03-02 11:59 PM UTC" + "lastEditedAt": "2026-03-02T23:59:00Z" }, "comment3FromT1C1ToR1Q2S1C1": { "courseId": "ISR.CS2104", @@ -740,7 +740,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-02 11:59 PM UTC", + "createdAt": "2026-03-02T23:59:00Z", "commentText": { "value": "Instructor third comment to Alice about feedback to Benny" } diff --git a/src/test/resources/data/MashupPageUiTest.json b/src/test/resources/data/MashupPageUiTest.json index 5975c37c539..c2588edccac 100644 --- a/src/test/resources/data/MashupPageUiTest.json +++ b/src/test/resources/data/MashupPageUiTest.json @@ -867,7 +867,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "This instructor's comment to student self feedback" } @@ -883,7 +883,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-02 11:59 PM UTC", + "createdAt": "2026-03-02T23:59:00Z", "commentText": { "value": "Other instructor's comment to student self feedback" } diff --git a/src/test/resources/data/StudentFeedbackResultsPageUiTest.json b/src/test/resources/data/StudentFeedbackResultsPageUiTest.json index 131db6d597e..a1a762bba9d 100644 --- a/src/test/resources/data/StudentFeedbackResultsPageUiTest.json +++ b/src/test/resources/data/StudentFeedbackResultsPageUiTest.json @@ -1781,12 +1781,12 @@ "STUDENTS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "Instructor first comment to Alice" }, "lastEditorEmail": "SFResultsUiT.instr@gmail.tmt", - "lastEditedAt": "2026-03-02 11:59 PM UTC" + "lastEditedAt": "2026-03-02T23:59:00Z" }, "comment2FromT1C1ToR1Q1S1C1": { "courseId": "SFResultsUiT.CS2104", @@ -1803,7 +1803,7 @@ "STUDENTS" ], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-02 11:59 PM UTC", + "createdAt": "2026-03-02T23:59:00Z", "commentText": { "value": "Instructor second comment to Alice" } diff --git a/src/test/resources/data/StudentFeedbackSubmissionEditPageActionTest.json b/src/test/resources/data/StudentFeedbackSubmissionEditPageActionTest.json index 93ea9b57295..b2ccbc2d83b 100644 --- a/src/test/resources/data/StudentFeedbackSubmissionEditPageActionTest.json +++ b/src/test/resources/data/StudentFeedbackSubmissionEditPageActionTest.json @@ -1333,7 +1333,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback" } @@ -1349,7 +1349,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-02-01 11:59 PM UTC", + "createdAt": "2026-02-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 2" } @@ -1365,7 +1365,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-01-01 11:59 PM UTC", + "createdAt": "2026-01-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 3" } diff --git a/src/test/resources/data/typicalDataBundle.json b/src/test/resources/data/typicalDataBundle.json index 641916930dc..05a350a09ac 100644 --- a/src/test/resources/data/typicalDataBundle.json +++ b/src/test/resources/data/typicalDataBundle.json @@ -1439,12 +1439,12 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-03-01 11:59 PM UTC", + "createdAt": "2026-03-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback" }, "lastEditorEmail": "instructor1@course1.tmt", - "lastEditedAt": "2012-04-02 11:59 PM UTC" + "lastEditedAt": "2012-04-02T23:59:00Z" }, "comment1FromT1C1ToR1Q2S1C1": { "courseId": "idOfTypicalCourse1", @@ -1457,7 +1457,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-02-01 11:59 PM UTC", + "createdAt": "2026-02-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 2" } @@ -1473,7 +1473,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2026-01-01 11:59 PM UTC", + "createdAt": "2026-01-01T23:59:00Z", "commentText": { "value": "Instructor 1 comment to student 1 self feedback Question 3" } @@ -1489,7 +1489,7 @@ "showCommentTo": [], "showGiverNameTo": [], "isVisibilityFollowingFeedbackQuestion": false, - "createdAt": "2027-01-01 11:59 PM UTC", + "createdAt": "2027-01-01T23:59:00Z", "commentText": { "value": "Instructor 3 comment to instr1C2 response to student1C2" }