You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/12/28 02:05:32 UTC

[james-project] 03/04: JAMES-3754 IMAP FETCH for save date extension

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

commit 2960c2a734eaff6984ae57a380d306d0f122dbf1
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Thu Dec 8 15:39:47 2022 +0700

    JAMES-3754 IMAP FETCH for save date extension
---
 .../apache/james/mpt/imapmailbox/suite/Fetch.java  |  8 +++-
 .../james/imap/scripts/FetchNILSaveDate.test       | 44 ++++++++++++++++++++++
 .../apache/james/imap/scripts/FetchSaveDate.test   | 44 ++++++++++++++++++++++
 .../james/mpt/imapmailbox/jpa/JpaFetchTest.java    |  8 ++++
 .../org/apache/james/imap/api/ImapConstants.java   |  1 +
 .../apache/james/imap/api/message/FetchData.java   |  4 +-
 .../imap/decode/parser/FetchCommandParser.java     |  3 ++
 .../james/imap/encode/FetchResponseEncoder.java    | 19 ++++++++++
 .../james/imap/message/response/FetchResponse.java |  9 ++++-
 .../imap/processor/AbstractMailboxProcessor.java   |  4 +-
 .../james/imap/processor/StoreProcessor.java       |  6 +--
 .../imap/processor/fetch/FetchResponseBuilder.java | 15 +++++++-
 .../encode/FetchResponseEncoderEnvelopeTest.java   |  2 +-
 .../FetchResponseEncoderNoExtensionsTest.java      |  8 ++--
 .../imap/encode/FetchResponseEncoderTest.java      |  6 +--
 15 files changed, 164 insertions(+), 17 deletions(-)

diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java
index 526b036f99..ca160afaa3 100644
--- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java
+++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/Fetch.java
@@ -33,7 +33,7 @@ public abstract class Fetch implements ImapTestConstants {
     protected abstract ImapHostSystem createImapHostSystem();
     
     private ImapHostSystem system;
-    private SimpleScriptedTestProtocol simpleScriptedTestProtocol;
+    protected SimpleScriptedTestProtocol simpleScriptedTestProtocol;
 
     @BeforeEach
     public void setUp() throws Exception {
@@ -213,4 +213,10 @@ public abstract class Fetch implements ImapTestConstants {
             .withLocale(Locale.ITALY)
             .run("FetchRFC822Mixed");
     }
+
+    @Test
+    public void testFetchSaveDate() throws Exception {
+        simpleScriptedTestProtocol
+            .run("FetchSaveDate");
+    }
 }
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/FetchNILSaveDate.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/FetchNILSaveDate.test
new file mode 100644
index 0000000000..9324d45a38
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/FetchNILSaveDate.test
@@ -0,0 +1,44 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+C: f CREATE anothermailbox
+S: f OK \[MAILBOXID \(.+\)\] CREATE completed\.
+C: g APPEND anothermailbox {704+}
+C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
+C: Message-ID: <f4...@mail.gmail.com>
+C: Date: Sat, 2 Feb 2008 13:14:19 +0000
+C: From: "Robert Burrell Donkin" <ro...@gmail.com>
+C: To: "James Developers List" <se...@james.apache.org>
+C: Subject: JCR -> trunk ...?
+C: MIME-Version: 1.0
+C: Content-Type: text/plain; charset=ISO-8859-1
+C: Content-Transfer-Encoding: 7bit
+C: Content-Disposition: inline
+C: Delivered-To: robertburrelldonkin@gmail.com
+C: 
+C: i'd like to copy james-jcr into trunk and add some example
+C: configurations. development can continue in the sandbox (or not) and
+C: merged in later (if necessary).
+C: 
+C: any objections?
+C: 
+C: - robert
+S: g OK (\[.+\] )?APPEND completed\.
+C: f FETCH 1 (SAVEDATE)
+S: \* 1 FETCH \(SAVEDATE NIL\)
+S: f OK FETCH completed.
\ No newline at end of file
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/FetchSaveDate.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/FetchSaveDate.test
new file mode 100644
index 0000000000..0f74c33ec4
--- /dev/null
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/FetchSaveDate.test
@@ -0,0 +1,44 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+C: f CREATE anothermailbox
+S: f OK \[MAILBOXID \(.+\)\] CREATE completed\.
+C: g APPEND anothermailbox {704+}
+C: Received: by 10.114.81.13 with HTTP; Sat, 2 Feb 2008 05:14:19 -0800 (PST)
+C: Message-ID: <f4...@mail.gmail.com>
+C: Date: Sat, 2 Feb 2008 13:14:19 +0000
+C: From: "Robert Burrell Donkin" <ro...@gmail.com>
+C: To: "James Developers List" <se...@james.apache.org>
+C: Subject: JCR -> trunk ...?
+C: MIME-Version: 1.0
+C: Content-Type: text/plain; charset=ISO-8859-1
+C: Content-Transfer-Encoding: 7bit
+C: Content-Disposition: inline
+C: Delivered-To: robertburrelldonkin@gmail.com
+C: 
+C: i'd like to copy james-jcr into trunk and add some example
+C: configurations. development can continue in the sandbox (or not) and
+C: merged in later (if necessary).
+C: 
+C: any objections?
+C: 
+C: - robert
+S: g OK (\[.+\] )?APPEND completed\.
+C: f FETCH 1 (SAVEDATE)
+S: \* 1 FETCH \(SAVEDATE "[^"]*"\)
+S: f OK FETCH completed.
\ No newline at end of file
diff --git a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/JpaFetchTest.java b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/JpaFetchTest.java
index 5a0e6322d9..f2dc2af758 100644
--- a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/JpaFetchTest.java
+++ b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/JpaFetchTest.java
@@ -22,6 +22,7 @@ package org.apache.james.mpt.imapmailbox.jpa;
 import org.apache.james.mpt.api.ImapHostSystem;
 import org.apache.james.mpt.imapmailbox.jpa.host.JPAHostSystemExtension;
 import org.apache.james.mpt.imapmailbox.suite.Fetch;
+import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class JpaFetchTest extends Fetch {
@@ -32,4 +33,11 @@ public class JpaFetchTest extends Fetch {
     protected ImapHostSystem createImapHostSystem() {
         return hostSystemExtension.getHostSystem();
     }
+
+    @Override
+    @Test
+    public void testFetchSaveDate() throws Exception {
+        simpleScriptedTestProtocol
+            .run("FetchNILSaveDate");
+    }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java b/protocols/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java
index 746dc87c3f..8900fcc2ee 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/api/ImapConstants.java
@@ -261,4 +261,5 @@ public interface ImapConstants {
     String MESSAGE_QUOTA_RESOURCE = "MESSAGE";
     String EMAILID = "EMAILID";
     String THREADID = "THREADID";
+    String SAVEDATE = "SAVEDATE";
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java
index 50cf6159b2..5fb6e496a8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/FetchData.java
@@ -104,7 +104,9 @@ public class FetchData {
         MODSEQ,
         // https://www.rfc-editor.org/rfc/rfc8474.html#section-5.3
         EMAILID,
-        THREADID
+        THREADID,
+        // https://www.rfc-editor.org/rfc/rfc8514.html#section-4.2
+        SAVEDATE
     }
 
     public static Builder builder() {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
index f4d36f9091..10dad694d6 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/FetchCommandParser.java
@@ -25,6 +25,7 @@ import static org.apache.james.imap.api.message.FetchData.Item.ENVELOPE;
 import static org.apache.james.imap.api.message.FetchData.Item.FLAGS;
 import static org.apache.james.imap.api.message.FetchData.Item.INTERNAL_DATE;
 import static org.apache.james.imap.api.message.FetchData.Item.MODSEQ;
+import static org.apache.james.imap.api.message.FetchData.Item.SAVEDATE;
 import static org.apache.james.imap.api.message.FetchData.Item.SIZE;
 import static org.apache.james.imap.api.message.FetchData.Item.THREADID;
 import static org.apache.james.imap.api.message.FetchData.Item.UID;
@@ -194,6 +195,8 @@ public class FetchCommandParser extends AbstractUidCommandParser {
                 return fetch.fetch(EMAILID);
             case "THREADID":
                 return fetch.fetch(THREADID);
+            case "SAVEDATE":
+                return fetch.fetch(SAVEDATE);
             default:
                 throw new DecodingException(HumanReadableText.ILLEGAL_ARGUMENTS, "Invalid fetch attribute: " + name);
         }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java
index d0f9d68bd7..bae4e76b9e 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/FetchResponseEncoder.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.imap.encode;
 
+import static org.apache.james.imap.api.ImapConstants.SAVEDATE;
+
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.Collection;
@@ -26,6 +28,7 @@ import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -43,6 +46,8 @@ import org.apache.james.mailbox.model.ThreadId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.github.fge.lambdas.Throwing;
+
 public class FetchResponseEncoder implements ImapResponseEncoder<FetchResponse> {
     private static final Logger LOGGER = LoggerFactory.getLogger(FetchResponseEncoder.class);
 
@@ -91,6 +96,7 @@ public class FetchResponseEncoder implements ImapResponseEncoder<FetchResponse>
         encodeBodyElements(composer, fetchResponse.getElements());
         encodeEmailId(composer, fetchResponse);
         encodeThreadId(composer, fetchResponse);
+        encodeSaveDate(composer, fetchResponse);
         composer.closeParen().end();
     }
 
@@ -296,6 +302,19 @@ public class FetchResponseEncoder implements ImapResponseEncoder<FetchResponse>
         }
     }
 
+    private void encodeSaveDate(ImapResponseComposer composer, FetchResponse fetchResponse) throws IOException {
+        final Optional<Date> saveDate = fetchResponse.getSaveDate();
+        if (isSaveDateFetched(saveDate)) {
+            composer.message(SAVEDATE);
+            saveDate.ifPresentOrElse(Throwing.consumer(date -> composer.quote(EncoderUtils.encodeDateTime(date))),
+                Throwing.runnable(composer::nil));
+        }
+    }
+
+    private boolean isSaveDateFetched(Optional<Date> saveDate) {
+        return saveDate != null;
+    }
+
     private void encodeUid(ImapResponseComposer composer, FetchResponse fetchResponse) throws IOException {
         final MessageUid uid = fetchResponse.getUid();
         if (uid != null) {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/message/response/FetchResponse.java b/protocols/imap/src/main/java/org/apache/james/imap/message/response/FetchResponse.java
index 3a66268fde..9a513d9d25 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/message/response/FetchResponse.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/message/response/FetchResponse.java
@@ -22,6 +22,7 @@ import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 
 import javax.mail.Flags;
 
@@ -38,6 +39,7 @@ public final class FetchResponse implements ImapResponseMessage {
     private final Flags flags;
     private final MessageUid uid;
     private final Date internalDate;
+    private final Optional<Date> saveDate;
     private final Long size;
     private final List<BodyElement> elements;
     private final Envelope envelope;
@@ -47,11 +49,12 @@ public final class FetchResponse implements ImapResponseMessage {
     private final MessageId emailId;
     private final ThreadId threadId;
 
-    public FetchResponse(MessageSequenceNumber messageNumber, Flags flags, MessageUid uid, ModSeq modSeq, Date internalDate, Long size, Envelope envelope, Structure body, Structure bodystructure, List<BodyElement> elements, MessageId emailId, ThreadId threadId) {
+    public FetchResponse(MessageSequenceNumber messageNumber, Flags flags, MessageUid uid, Optional<Date> saveDate, ModSeq modSeq, Date internalDate, Long size, Envelope envelope, Structure body, Structure bodystructure, List<BodyElement> elements, MessageId emailId, ThreadId threadId) {
         this.messageNumber = messageNumber;
         this.flags = flags;
         this.uid = uid;
         this.internalDate = internalDate;
+        this.saveDate = saveDate;
         this.size = size;
         this.envelope = envelope;
         this.elements = elements;
@@ -169,6 +172,10 @@ public final class FetchResponse implements ImapResponseMessage {
         return threadId;
     }
 
+    public Optional<Date> getSaveDate() {
+        return saveDate;
+    }
+
     /**
      * Describes the message structure.
      */
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index 5c4be73ce8..b4b314dc51 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -265,9 +265,9 @@ public abstract class AbstractMailboxProcessor<R extends ImapRequest> extends Ab
                     // Check if we also need to return the MODSEQ in the response. This is true if CONDSTORE or
                     // if QRESYNC was enabled, and the mailbox supports the permant storage of mod-sequences
                     if (condstoreEnabled || qresyncEnabled) {
-                        response = new FetchResponse(msn, flags, uidOut, mr.getModSeq(), null, null, null, null, null, null, null, null);
+                        response = new FetchResponse(msn, flags, uidOut, null, mr.getModSeq(), null, null, null, null, null, null, null, null);
                     } else {
-                        response = new FetchResponse(msn, flags, uidOut, null, null, null, null, null, null, null, null, null);
+                        response = new FetchResponse(msn, flags, uidOut, null, null, null, null, null, null, null, null, null, null);
                     }
                     responder.respond(response);
                     return null;
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
index 71acdae0a3..2fe3a33d48 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
@@ -315,14 +315,14 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
         if (unchangedSince != -1 || qresyncEnabled || condstoreEnabled) {
             if (silent) {
                 // We need to return an FETCH response which contains the mod-sequence of the message even if FLAGS.SILENT was used
-                return new FetchResponse(msn, null, resultUid, modSeqs.get(uid), null, null, null, null, null, null, null, null);
+                return new FetchResponse(msn, null, resultUid, null, modSeqs.get(uid), null, null, null, null, null, null, null, null);
             } else {
                 // Use a FETCH response which contains the mod-sequence and the flags
-                return new FetchResponse(msn, resultFlags, resultUid, modSeqs.get(uid), null, null, null, null, null, null, null, null);
+                return new FetchResponse(msn, resultFlags, resultUid, null, modSeqs.get(uid), null, null, null, null, null, null, null, null);
             }
         } else {
             // Use a FETCH response which only contains the flags as no CONDSTORE was used
-            return new FetchResponse(msn, resultFlags, resultUid, null, null, null, null, null, null, null, null, null);
+            return new FetchResponse(msn, resultFlags, resultUid, null, null, null, null, null, null, null, null, null, null);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java
index a33c2421bc..3143983011 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchResponseBuilder.java
@@ -65,6 +65,7 @@ public final class FetchResponseBuilder {
     private MessageUid uid;
     private Flags flags;
     private Date internalDate;
+    private Optional<Date> saveDate;
     private Long size;
     private ModSeq modSeq;
     private List<FetchResponse.BodyElement> elements;
@@ -83,6 +84,7 @@ public final class FetchResponseBuilder {
         uid = null;
         flags = null;
         internalDate = null;
+        saveDate = null;
         size = null;
         body = null;
         bodystructure = null;
@@ -106,13 +108,16 @@ public final class FetchResponseBuilder {
         this.modSeq = modSeq;
     }
 
+    private void setSaveDate(Optional<Date> saveDate) {
+        this.saveDate = saveDate;
+    }
     
     public void setFlags(Flags flags) {
         this.flags = flags;
     }
 
     public FetchResponse build() {
-        return new FetchResponse(msn, flags, uid, modSeq, internalDate, size, envelope, body, bodystructure, elements, messageId, threadId);
+        return new FetchResponse(msn, flags, uid, saveDate, modSeq, internalDate, size, envelope, body, bodystructure, elements, messageId, threadId);
     }
 
     public Mono<FetchResponse> build(FetchData fetch, MessageResult result, MessageManager mailbox, SelectedMailbox selectedMailbox, MailboxSession mailboxSession) throws MessageRangeException, MailboxException {
@@ -168,6 +173,7 @@ public final class FetchResponseBuilder {
 
             addThreadId(fetch, result.getThreadId());
             addMessageId(fetch, result.getMessageId());
+            addSaveDate(fetch, result.getSaveDate());
 
             addModSeq(fetch, result.getModSeq());
 
@@ -201,6 +207,13 @@ public final class FetchResponseBuilder {
         }
     }
 
+    private void addSaveDate(FetchData fetch, Optional<Date> saveDate) {
+        // SAVEDATE response
+        if (fetch.contains(Item.SAVEDATE)) {
+            setSaveDate(saveDate);
+        }
+    }
+
     private void addModSeq(FetchData fetch, ModSeq modSeq) {
         if (fetch.contains(Item.MODSEQ)) {
             long changedSince = fetch.getChangedSince();
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java
index e42dadd105..1198141fbf 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderEnvelopeTest.java
@@ -97,7 +97,7 @@ public class FetchResponseEncoderEnvelopeTest {
         subject = null;
         to = null;
 
-        message = new FetchResponse(MSN, null, null, null, null, null, envelope, null, null, null, null, null);
+        message = new FetchResponse(MSN, null, null, null, null, null, null, envelope, null, null, null, null, null);
         encoder = new FetchResponseEncoder(false);
     }
 
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java
index 0bd013a916..6930d6ca5c 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderNoExtensionsTest.java
@@ -57,7 +57,7 @@ class FetchResponseEncoderNoExtensionsTest {
 
     @Test
     void testShouldEncodeFlagsResponse() throws Exception {
-        FetchResponse message = new FetchResponse(MSN, flags, null, null, null, null,
+        FetchResponse message = new FetchResponse(MSN, flags, null, null, null, null, null,
                 null, null, null, null, null, null);
         encoder.encode(message, composer);
         assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted))\r\n");
@@ -65,7 +65,7 @@ class FetchResponseEncoderNoExtensionsTest {
 
     @Test
     void testShouldEncodeUidResponse() throws Exception {
-        FetchResponse message = new FetchResponse(MSN, null, MessageUid.of(72), null,
+        FetchResponse message = new FetchResponse(MSN, null, MessageUid.of(72), null, null,
                 null, null, null, null, null, null, null, null);
         encoder.encode(message, composer);
         assertThat(writer.getString()).isEqualTo("* 100 FETCH (UID 72)\r\n");
@@ -74,7 +74,7 @@ class FetchResponseEncoderNoExtensionsTest {
 
     @Test
     void testShouldEncodeAllResponse() throws Exception {
-        FetchResponse message = new FetchResponse(MSN, flags, MessageUid.of(72), null,
+        FetchResponse message = new FetchResponse(MSN, flags, MessageUid.of(72), null, null,
                 null, null, null, null, null, null, null, null);
         encoder.encode(message, composer);
         assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted) UID 72)\r\n");
@@ -83,7 +83,7 @@ class FetchResponseEncoderNoExtensionsTest {
 
     @Test
     void testShouldNotAddExtensionsWithEncodingBodyStructure() throws Exception {
-        FetchResponse message = new FetchResponse(MSN, flags, MessageUid.of(72), null,
+        FetchResponse message = new FetchResponse(MSN, flags, MessageUid.of(72), null, null,
                 null, null, null, null, stubStructure, null, null, null);
         final Map<String, String> parameters = new HashMap<>();
         parameters.put("CHARSET", "US-ASCII");
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java
index 395ebb44ad..2575b652fa 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/encode/FetchResponseEncoderTest.java
@@ -51,7 +51,7 @@ class FetchResponseEncoderTest  {
 
     @Test
     void testShouldEncodeFlagsResponse() throws Exception {
-        FetchResponse message = new FetchResponse(MSN, flags, null, null, null, null,
+        FetchResponse message = new FetchResponse(MSN, flags, null, null, null, null, null,
                 null, null, null, null, null, null);
         encoder.encode(message, composer);
         assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted))\r\n");
@@ -61,7 +61,7 @@ class FetchResponseEncoderTest  {
 
     @Test
     void testShouldEncodeUidResponse() throws Exception {
-        FetchResponse message = new FetchResponse(MSN, null, MessageUid.of(72), null,
+        FetchResponse message = new FetchResponse(MSN, null, MessageUid.of(72), null, null,
                 null, null, null, null, null, null, null, null);
         encoder.encode(message, composer);
         assertThat(writer.getString()).isEqualTo("* 100 FETCH (UID 72)\r\n");
@@ -71,7 +71,7 @@ class FetchResponseEncoderTest  {
 
     @Test
     void testShouldEncodeAllResponse() throws Exception {
-        FetchResponse message = new FetchResponse(MSN, flags, MessageUid.of(72), null,
+        FetchResponse message = new FetchResponse(MSN, flags, MessageUid.of(72), null, null,
                 null, null, null, null, null, null, null, null);
         encoder.encode(message, composer);
         assertThat(writer.getString()).isEqualTo("* 100 FETCH (FLAGS (\\Deleted) UID 72)\r\n");


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