james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [7/7] james-project git commit: JAMES-1664 threadId is set to messageId for now
Date Mon, 01 Feb 2016 12:25:28 GMT
JAMES-1664 threadId is set to messageId for now

	It will make threads of 1 message but nevertheless jmap semantic is
	enforced.


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/fec98a5d
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/fec98a5d
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/fec98a5d

Branch: refs/heads/master
Commit: fec98a5d673e4cef56173be5c6d771a454c03032
Parents: fa18d26
Author: Matthieu Baechler <matthieu.baechler@gmail.com>
Authored: Thu Jan 28 10:06:22 2016 +0100
Committer: Antoine Duprat <antduprat@gmail.com>
Committed: Mon Feb 1 13:21:06 2016 +0100

----------------------------------------------------------------------
 .../jmap/methods/GetMessagesMethodTest.java     |  1 +
 .../org/apache/james/jmap/model/Message.java    |  5 +-
 .../james/jmap/model/MailboxMessageTest.java    | 64 +++-----------------
 3 files changed, 13 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/fec98a5d/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
index 9feda38..3356b1f 100644
--- a/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/src/test/java/org/apache/james/jmap/methods/GetMessagesMethodTest.java
@@ -204,6 +204,7 @@ public abstract class GetMessagesMethodTest {
         assertThat(JsonPath.parse(response).<Integer>read("$.length()")).isEqualTo(1);
         assertThat(JsonPath.parse(response).<Integer>read(firstResponsePath + ".list.length()")).isEqualTo(1);
         assertThat(JsonPath.parse(response).<String>read(firstMessagePath + ".id")).isEqualTo(username
+ "|inbox|1");
+        assertThat(JsonPath.parse(response).<String>read(firstMessagePath + ".threadId")).isEqualTo(username
+ "|inbox|1");
         assertThat(JsonPath.parse(response).<String>read(firstMessagePath + ".subject")).isEqualTo("my
test subject");
         assertThat(JsonPath.parse(response).<String>read(firstMessagePath + ".textBody")).isEqualTo("testmail");
         assertThat(JsonPath.parse(response).<Boolean>read(firstMessagePath + ".isUnread")).isTrue();

http://git-wip-us.apache.org/repos/asf/james-project/blob/fec98a5d/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Message.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Message.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Message.java
index 53363ea..a7e3609 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Message.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Message.java
@@ -65,10 +65,11 @@ public class Message {
         if (im.getHasAttachment()) {
             throw new NotImplementedException();
         }
+        MessageId messageId = uidToMessageId.apply(im.getId());
         return builder()
-                .id(uidToMessageId.apply(im.getId()))
+                .id(messageId)
                 .blobId(String.valueOf(im.getId()))
-                .threadId(String.valueOf(im.getId()))
+                .threadId(messageId.serialize())
                 .mailboxIds(ImmutableList.of(im.getMailboxId()))
                 .inReplyToMessageId(getHeaderAsSingleValue(im, "in-reply-to"))
                 .isUnread(im.isUnRead())

http://git-wip-us.apache.org/repos/asf/james-project/blob/fec98a5d/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxMessageTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxMessageTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxMessageTest.java
index 12b327f..bb68450 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxMessageTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MailboxMessageTest.java
@@ -244,18 +244,9 @@ public class MailboxMessageTest {
         testMail.setModSeq(MOD_SEQ);
         
         Message testee = Message.fromMailboxMessage(testMail, x -> MessageId.of("user|box|"
+ x));
-        Message expected = Message.builder()
-                .id(MessageId.of("user|box|0"))
-                .blobId("0")
-                .threadId("0")
-                .mailboxIds(ImmutableList.of(MAILBOX_ID.serialize()))
-                .headers(ImmutableMap.of())
-                .subject("(No subject)")
-                .size(0)
-                .date(ZONED_DATE)
-                .preview("(Empty)")
-                .build();
-        assertThat(testee).isEqualToComparingFieldByField(expected);
+        assertThat(testee)
+            .extracting(Message::getPreview, Message::getSize, Message::getSubject, Message::getHeaders,
Message::getDate)
+            .containsExactly("(Empty)", 0L, "(No subject)", ImmutableMap.of(), ZONED_DATE);
     }
 
     @Test
@@ -275,22 +266,9 @@ public class MailboxMessageTest {
         testMail.setModSeq(MOD_SEQ);
         
         Message testee = Message.fromMailboxMessage(testMail, x -> MessageId.of("user|box|"
+ x));
-        Message expected = Message.builder()
-                .id(MessageId.of("user|box|0"))
-                .blobId("0")
-                .threadId("0")
-                .mailboxIds(ImmutableList.of(MAILBOX_ID.serialize()))
-                .isUnread(true)
-                .isFlagged(true)
-                .isAnswered(true)
-                .isDraft(true)
-                .headers(ImmutableMap.of())
-                .subject("(No subject)")
-                .size(0)
-                .date(ZONED_DATE)
-                .preview("(Empty)")
-                .build();
-        assertThat(testee).isEqualToComparingFieldByField(expected);
+        assertThat(testee)
+            .extracting(Message::isIsUnread, Message::isIsFlagged, Message::isIsAnswered,
Message::isIsDraft)
+            .containsExactly(true, true, true, true);
     }
 
     @Test
@@ -333,7 +311,7 @@ public class MailboxMessageTest {
         Message expected = Message.builder()
                 .id(MessageId.of("user|box|0"))
                 .blobId("0")
-                .threadId("0")
+                .threadId("user|box|0")
                 .mailboxIds(ImmutableList.of(MAILBOX_ID.serialize()))
                 .inReplyToMessageId("<SNT124-W2664003139C1E520CF4F6787D30@phx.gbl>")
                 .headers(headersMap)
@@ -366,19 +344,7 @@ public class MailboxMessageTest {
         testMail.setModSeq(MOD_SEQ);
         
         Message testee = Message.fromMailboxMessage(testMail, x -> MessageId.of("user|box|"
+ x));
-        Message expected = Message.builder()
-                .id(MessageId.of("user|box|0"))
-                .blobId("0")
-                .threadId("0")
-                .mailboxIds(ImmutableList.of(MAILBOX_ID.serialize()))
-                .headers(ImmutableMap.of("subject", "test subject"))
-                .subject("test subject")
-                .size(mail.length())
-                .date(ZONED_DATE)
-                .preview("Mail body")
-                .textBody("Mail body")
-                .build();
-        assertThat(testee).isEqualToComparingFieldByField(expected);
+        assertThat(testee.getTextBody()).hasValue("Mail body");
     }
     
     @Test
@@ -426,19 +392,7 @@ public class MailboxMessageTest {
         testMail.setModSeq(MOD_SEQ);
         
         Message testee = Message.fromMailboxMessage(testMail, x -> MessageId.of("user|box|"
+ x));
-        Message expected = Message.builder()
-                .id(MessageId.of("user|box|0"))
-                .blobId("0")
-                .threadId("0")
-                .mailboxIds(ImmutableList.of(MAILBOX_ID.serialize()))
-                .headers(ImmutableMap.of("subject", "test subject"))
-                .subject("test subject")
-                .size(mail.length())
-                .date(ZONED_DATE)
-                .preview(expectedPreview)
-                .textBody(body300)
-                .build();
-        assertThat(testee).isEqualToComparingFieldByField(expected);
+        assertThat(testee.getPreview()).isEqualTo(expectedPreview);
     }
     
     @Test(expected=NotImplementedException.class)


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


Mime
View raw message