james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [12/15] james-project git commit: JAMES-2255 Message from JMAP should use Number for number data
Date Fri, 05 Jan 2018 09:17:38 GMT
JAMES-2255 Message from JMAP should use Number for number data


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

Branch: refs/heads/master
Commit: 8e71c4f51ceb3585131012a15cc9bea3f6921ba6
Parents: a802602
Author: quynhn <qnguyen@linagora.com>
Authored: Tue Dec 12 13:58:47 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Jan 5 16:11:09 2018 +0700

----------------------------------------------------------------------
 .../main/java/org/apache/james/jmap/model/Message.java    | 10 +++++-----
 .../org/apache/james/jmap/model/MessageFactoryTest.java   |  4 ++--
 .../java/org/apache/james/jmap/model/MessageTest.java     |  6 ++++--
 3 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8e71c4f5/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 557e99f..9d679b2 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,7 +65,7 @@ public class Message {
         private final ImmutableList.Builder<Emailer> replyTo;
         private String subject;
         private Instant date;
-        private Long size;
+        private Number size;
         private String preview;
         private Optional<String> textBody = Optional.empty();
         private Optional<String> htmlBody = Optional.empty();
@@ -163,7 +163,7 @@ public class Message {
         }
 
         public Builder size(long size) {
-            this.size = size;
+            this.size = Number.fromOutboundLong(size);
             return this;
         }
 
@@ -244,7 +244,7 @@ public class Message {
     private final ImmutableList<Emailer> replyTo;
     private final String subject;
     private final Instant date;
-    private final long size;
+    private final Number size;
     private final String preview;
     private final Optional<String> textBody;
     private final Optional<String> htmlBody;
@@ -266,7 +266,7 @@ public class Message {
                                ImmutableList<Emailer> replyTo,
                                String subject,
                                Instant date,
-                               long size,
+                               Number size,
                                String preview,
                                Optional<String> textBody,
                                Optional<String> htmlBody,
@@ -372,7 +372,7 @@ public class Message {
         return date;
     }
 
-    public long getSize() {
+    public Number getSize() {
         return size;
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/8e71c4f5/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
index 2ae24b8..ef69791 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
@@ -82,7 +82,7 @@ public class MessageFactoryTest {
         Message testee = messageFactory.fromMetaDataWithContent(testMail);
         assertThat(testee)
             .extracting(Message::getPreview, Message::getSize, Message::getSubject, Message::getHeaders,
Message::getDate)
-            .containsExactly("(Empty)", 0L, "", ImmutableMap.of("MIME-Version", "1.0"), INTERNAL_DATE);
+            .containsExactly("(Empty)", Number.ZERO, "", ImmutableMap.of("MIME-Version",
"1.0"), INTERNAL_DATE);
     }
 
     @Test
@@ -549,7 +549,7 @@ public class MessageFactoryTest {
         Message testee = messageFactory.fromMetaDataWithContent(testMail);
         assertThat(testee)
             .extracting(Message::getPreview, Message::getSize, Message::getSubject, Message::getHeaders,
Message::getDate)
-            .containsExactly("(Empty)", 1010L, "", ImmutableMap.of("MIME-Version", "1.0"),
INTERNAL_DATE);
+            .containsExactly("(Empty)", Number.fromLong(1010L), "", ImmutableMap.of("MIME-Version",
"1.0"), INTERNAL_DATE);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/8e71c4f5/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageTest.java
index 3a838fb..2665d5a 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageTest.java
@@ -101,8 +101,9 @@ public class MessageTest {
     @Test
     public void buildShouldWorkWhenMandatoryFieldsArePresent() {
         Instant currentDate = Instant.now();
+        Number messageSize = Number.fromLong(123);
         Message expected = new Message(TestMessageId.of(1), BlobId.of("blobId"), "threadId",
ImmutableList.of(InMemoryId.of(456)), Optional.empty(), false, ImmutableMap.of("key", "value"),
Optional.empty(),
-                ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(),
"subject", currentDate, 123, "preview", Optional.empty(), Optional.empty(),
+                ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(),
"subject", currentDate, messageSize, "preview", Optional.empty(), Optional.empty(),
                 ImmutableList.of(), ImmutableMap.of(), Keywords.DEFAULT_VALUE);
         Message tested = Message.builder()
                 .id(TestMessageId.of(1))
@@ -163,6 +164,7 @@ public class MessageTest {
         Keywords keywords = Keywords.factory()
             .from(Keyword.DRAFT, Keyword.ANSWERED, Keyword.FLAGGED);
 
+        Number messageSize = Number.fromLong(123);
         Message expected = new Message(
             TestMessageId.of(1),
             BlobId.of("blobId"),
@@ -178,7 +180,7 @@ public class MessageTest {
             replyTo,
             "subject",
             currentDate,
-            123,
+            messageSize,
             "preview",
             Optional.of("textBody"),
             Optional.of("htmlBody"),


---------------------------------------------------------------------
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