This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new 4234ae9dc1 JAMES-4176 Fix
combiningSortPositionAndLimitShouldYieldExpectedResult (#2962)
4234ae9dc1 is described below
commit 4234ae9dc1b66be72c4c8f35483eef1ebf967237
Author: Trần Hồng Quân <[email protected]>
AuthorDate: Thu Mar 5 21:28:27 2026 +0700
JAMES-4176 Fix combiningSortPositionAndLimitShouldYieldExpectedResult
(#2962)
This test was failed against Disitributed/Postgres.
Before, these 3 messages shared a same sentAt (Date header). Somehow the
test passed, likely because ordering by messageId?
We need to explicitly set the sentAt date.
---
.../rfc8621/contract/EmailQueryMethodContract.scala | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
index ebc55a5dc3..ebe7ec5ffc 100644
---
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
+++
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
@@ -143,6 +143,15 @@ trait EmailQueryMethodContract {
.build
}
+ private def buildTestMessage(sentAt: Date): Message = {
+ Message.Builder
+ .of
+ .setDate(sentAt)
+ .setSubject("test")
+ .setBody("testmail", StandardCharsets.UTF_8)
+ .build
+ }
+
@Test
def hasAttachmentShouldKeepMessageWithAttachmentWhenTrue(server:
GuiceJamesServer): Unit = {
val mailboxProbe = server.getProbe(classOf[MailboxProbeImpl])
@@ -5018,21 +5027,17 @@ trait EmailQueryMethodContract {
@Test
def combiningSortPositionAndLimitShouldYieldExpectedResult(server:
GuiceJamesServer): Unit = {
val mailboxId =
server.getProbe(classOf[MailboxProbeImpl]).createMailbox(MailboxPath.inbox(BOB))
- val message: Message = buildTestMessage
val messageId1: MessageId = server.getProbe(classOf[MailboxProbeImpl])
.appendMessage(BOB.asString, MailboxPath.inbox(BOB),
AppendCommand.builder()
-
.withInternalDate(Date.from(ZonedDateTime.now().minusDays(2).toInstant))
- .build(message))
+
.build(buildTestMessage(Date.from(ZonedDateTime.now().minusDays(3).toInstant))))
.getMessageId
val messageId2: MessageId = server.getProbe(classOf[MailboxProbeImpl])
.appendMessage(BOB.asString, MailboxPath.inbox(BOB),
AppendCommand.builder()
-
.withInternalDate(Date.from(ZonedDateTime.now().minusDays(2).toInstant))
- .build(message))
+
.build(buildTestMessage(Date.from(ZonedDateTime.now().minusDays(2).toInstant))))
.getMessageId
val messageId3: MessageId = server.getProbe(classOf[MailboxProbeImpl])
.appendMessage(BOB.asString, MailboxPath.inbox(BOB),
AppendCommand.builder()
-
.withInternalDate(Date.from(ZonedDateTime.now().minusDays(2).toInstant))
- .build(message))
+
.build(buildTestMessage(Date.from(ZonedDateTime.now().minusDays(1).toInstant))))
.getMessageId
val request =
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]