jaeyun0503 commented on code in PR #3736:
URL: https://github.com/apache/texera/pull/3736#discussion_r2357410187
##########
core/amber/src/test/scala/edu/uci/ics/texera/web/resource/dashboard/file/WorkflowResourceSpec.scala:
##########
@@ -201,6 +206,51 @@ class WorkflowResourceSpec
assert(a.getName == b.workflow.getName)
}
+ "User.accountCreationTime" should "be persisted and retrievable via UserDao"
in {
+ val userDao = new UserDao(getDSLContext.configuration())
+ val u1 = userDao.fetchOneByUid(Integer.valueOf(1))
+ val u2 = userDao.fetchOneByUid(Integer.valueOf(2))
+
+ assert(u1.getAccountCreationTime != null)
+ assert(u2.getAccountCreationTime != null)
+
+ assert(u1.getAccountCreationTime.isEqual(exampleCreationTime))
+ assert(u2.getAccountCreationTime.isEqual(exampleCreationTime))
+ }
+
+ it should "remain unchanged when updating unrelated fields" in {
+ val userDao = new UserDao(getDSLContext.configuration())
+ val u1 = userDao.fetchOneByUid(Integer.valueOf(1))
+ val originalTime = u1.getAccountCreationTime
+
+ u1.setComment("updated_comment")
+ userDao.update(u1)
+
+ val test_u1 = userDao.fetchOneByUid(Integer.valueOf(1))
+ assert(test_u1.getAccountCreationTime.isEqual(originalTime))
+ }
+
+ it should "fallback to DB default when not explicitly set on insert" in {
+ // account_creation_time TIMESTAMPTZ NOT NULL DEFAULT now()
+ val userDao = new UserDao(getDSLContext.configuration())
+
+ val tmp = new User
+ tmp.setUid(Integer.valueOf(9999))
+ tmp.setName("tmp_user")
+ tmp.setRole(UserRoleEnum.REGULAR)
+ tmp.setPassword("pw")
+ tmp.setComment("tmp")
+ // Account creation time not set
+ userDao.insert(tmp)
+
+ val fetched = userDao.fetchOneByUid(Integer.valueOf(9999))
Review Comment:
Made changes accordingly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]