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/11/27 07:10:16 UTC
[james-project] 04/05: JAMES-3861 Handle Added event message format migration
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 5a7b5c1c4324d38f4c26e4581796b3afb94cc74a
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Wed Nov 23 09:47:38 2022 +0700
JAMES-3861 Handle Added event message format migration
`previousAddedFormatShouldBeWellDeserialized` test already exists for this backward
---
.../org/apache/james/event/json/MailboxEventSerializer.scala | 8 +++++---
.../java/org/apache/james/event/json/AddedSerializationTest.java | 1 -
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/mailbox/event/json/src/main/scala/org/apache/james/event/json/MailboxEventSerializer.scala b/mailbox/event/json/src/main/scala/org/apache/james/event/json/MailboxEventSerializer.scala
index 433c6c58f6..23cf3d8298 100644
--- a/mailbox/event/json/src/main/scala/org/apache/james/event/json/MailboxEventSerializer.scala
+++ b/mailbox/event/json/src/main/scala/org/apache/james/event/json/MailboxEventSerializer.scala
@@ -69,7 +69,7 @@ private object DTO {
}
case class Added(eventId: EventId, sessionId: SessionId, user: Username, path: MailboxPath, mailboxId: MailboxId,
- added: Map[MessageUid, DTOs.MessageMetaData], isDelivery: IsDelivery) extends Event {
+ added: Map[MessageUid, DTOs.MessageMetaData], isDelivery: Option[IsDelivery]) extends Event {
override def toJava: JavaEvent = new JavaAdded(
sessionId,
user,
@@ -77,7 +77,9 @@ private object DTO {
mailboxId,
new JavaTreeMap[MessageUid, JavaMessageMetaData](added.view.mapValues(_.toJava).toMap.asJava),
eventId,
- isDelivery.value)
+ fallbackIsDelivery())
+
+ def fallbackIsDelivery(): Boolean = isDelivery.exists(_.value)
}
case class Expunged(eventId: EventId, sessionId: SessionId, user: Username, path: MailboxPath, mailboxId: MailboxId,
@@ -166,7 +168,7 @@ private object ScalaConverter {
path = MailboxPath.fromJava(event.getMailboxPath),
mailboxId = event.getMailboxId,
added = event.getAdded.asScala.view.mapValues(DTOs.MessageMetaData.fromJava).toMap,
- isDelivery = IsDelivery(event.isDelivery))
+ isDelivery = Option(IsDelivery(event.isDelivery)))
private def toScala(event: JavaExpunged): DTO.Expunged = DTO.Expunged(
eventId = event.getEventId,
diff --git a/mailbox/event/json/src/test/java/org/apache/james/event/json/AddedSerializationTest.java b/mailbox/event/json/src/test/java/org/apache/james/event/json/AddedSerializationTest.java
index 78cfac48f2..40df84bb4c 100644
--- a/mailbox/event/json/src/test/java/org/apache/james/event/json/AddedSerializationTest.java
+++ b/mailbox/event/json/src/test/java/org/apache/james/event/json/AddedSerializationTest.java
@@ -154,7 +154,6 @@ class AddedSerializationTest {
" }" +
" }," +
" \"sessionId\": 42," +
- " \"isDelivery\": false," +
" \"user\": \"user\"" +
" }" +
"}";
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org