You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2021/01/29 03:09:01 UTC

[james-project] 01/13: JAMES-3495 Reproduce the null messageId bug

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit debe5f18cf12502b994750f19db95ca22fc383ae
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Jan 27 20:24:45 2021 +0700

    JAMES-3495 Reproduce the null messageId bug
    
    This likely occurs due to the EXPUNGE model used by IMAP (Update the message
    to mark it as deleted then remove it)
---
 .../cassandra/mail/CassandraMessageIdDAOTest.java  | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAOTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAOTest.java
index e76637e..d72d2c2 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAOTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdDAOTest.java
@@ -39,6 +39,7 @@ import org.apache.james.mailbox.model.ComposedMessageIdWithMetaData;
 import org.apache.james.mailbox.model.MessageRange;
 import org.apache.james.util.streams.Limit;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
@@ -85,6 +86,32 @@ class CassandraMessageIdDAOTest {
         assertThat(message.isPresent()).isFalse();
     }
 
+    @Disabled("A record with a 'null' messageId is returned")
+    @Test
+    void outOfOrderUpdatesShouldBeIgnored() {
+        CassandraId mailboxId = CassandraId.timeBased();
+        MessageUid messageUid = MessageUid.of(1);
+        CassandraMessageId messageId = messageIdFactory.generate();
+        testee.insert(ComposedMessageIdWithMetaData.builder()
+                .composedMessageId(new ComposedMessageId(mailboxId, messageId, messageUid))
+                .flags(new Flags())
+                .modSeq(ModSeq.of(1))
+                .build())
+            .block();
+
+        testee.delete(mailboxId, messageUid).block();
+
+        testee.updateMetadata(ComposedMessageIdWithMetaData.builder()
+                .composedMessageId(new ComposedMessageId(mailboxId, messageId, messageUid))
+                .flags(new Flags(org.apache.james.mailbox.cassandra.table.Flag.ANSWERED))
+                .modSeq(ModSeq.of(2))
+                .build())
+            .block();
+
+        Optional<ComposedMessageIdWithMetaData> message = testee.retrieve(mailboxId, messageUid).block();
+        assertThat(message.isPresent()).isFalse();
+    }
+
     @Test
     void deleteShouldDeleteOnlyConcernedRowWhenMultipleRowExists() {
         CassandraId mailboxId = CassandraId.timeBased();


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org