You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/03/20 12:15:44 UTC

[james-project] 01/08: Upgrade play-json to 2.8

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 058a83fa109eb36e9508606988ef3453ea3514ac
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Thu Mar 19 10:51:34 2020 +0100

    Upgrade play-json to 2.8
---
 mailbox/event/json/pom.xml                                         | 4 ++--
 .../main/scala/org/apache/james/event/json/EventSerializer.scala   | 6 ++++--
 .../test/java/org/apache/james/event/json/dtos/QuotaCountTest.java | 6 +++---
 .../test/java/org/apache/james/event/json/dtos/QuotaSizeTest.java  | 7 ++++---
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/mailbox/event/json/pom.xml b/mailbox/event/json/pom.xml
index bfd77a5..6b391ee 100644
--- a/mailbox/event/json/pom.xml
+++ b/mailbox/event/json/pom.xml
@@ -60,7 +60,7 @@
         <dependency>
             <groupId>com.typesafe.play</groupId>
             <artifactId>play-json_${scala.base}</artifactId>
-            <version>2.7.4</version>
+            <version>2.8.1</version>
         </dependency>
         <dependency>
             <groupId>net.javacrumbs.json-unit</groupId>
@@ -70,7 +70,7 @@
         <dependency>
             <groupId>org.julienrf</groupId>
             <artifactId>play-json-derived-codecs_${scala.base}</artifactId>
-            <version>6.0.0</version>
+            <version>7.0.0</version>
         </dependency>
         <dependency>
             <groupId>org.scala-lang</groupId>
diff --git a/mailbox/event/json/src/main/scala/org/apache/james/event/json/EventSerializer.scala b/mailbox/event/json/src/main/scala/org/apache/james/event/json/EventSerializer.scala
index bf0bc87..4c7a2a2 100644
--- a/mailbox/event/json/src/main/scala/org/apache/james/event/json/EventSerializer.scala
+++ b/mailbox/event/json/src/main/scala/org/apache/james/event/json/EventSerializer.scala
@@ -205,9 +205,11 @@ class JsonSerialize(mailboxIdFactory: MailboxId.Factory, messageIdFactory: Messa
   implicit val systemFlagsWrites: Writes[SystemFlag] = Writes.enumNameWrites
   implicit val userWriters: Writes[Username] = (user: Username) => JsString(user.asString)
   implicit val quotaRootWrites: Writes[QuotaRoot] = quotaRoot => JsString(quotaRoot.getValue)
-  implicit val quotaUsageValueWrites: Writes[QuotaUsageValue[_, _]] = value => JsNumber(value.asLong())
-  implicit val quotaLimitValueWrites: Writes[QuotaLimitValue[_]] = value => if (value.isUnlimited) JsNull else JsNumber(value.asLong())
   implicit val quotaScopeWrites: Writes[JavaQuota.Scope] = value => JsString(value.name)
+  implicit val quotaCountLimitWrites: Writes[QuotaCountLimit] = value => if (value.isUnlimited) JsNull else JsNumber(value.asLong())
+  implicit val quotaCountUsageWrites: Writes[QuotaCountUsage] = value => JsNumber(value.asLong())
+  implicit val quotaSizeLimitWrites: Writes[QuotaSizeLimit] = value => if (value.isUnlimited) JsNull else JsNumber(value.asLong())
+  implicit val quotaSizeUsageWrites: Writes[QuotaSizeUsage] = value => JsNumber(value.asLong())
   implicit val quotaCountWrites: Writes[Quota[QuotaCountLimit, QuotaCountUsage]] = Json.writes[Quota[QuotaCountLimit, QuotaCountUsage]]
   implicit val quotaSizeWrites: Writes[Quota[QuotaSizeLimit, QuotaSizeUsage]] = Json.writes[Quota[QuotaSizeLimit, QuotaSizeUsage]]
   implicit val mailboxPathWrites: Writes[MailboxPath] = Json.writes[MailboxPath]
diff --git a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java
index 43cb574..5b06266 100644
--- a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java
+++ b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaCountTest.java
@@ -41,7 +41,7 @@ import scala.math.BigDecimal;
 class QuotaCountTest {
     @Test
     void quotaCountLimitShouldBeWellSerialized() {
-        assertThat(DTO_JSON_SERIALIZE.quotaLimitValueWrites().writes(QuotaCountLimit.count(18)))
+        assertThat(DTO_JSON_SERIALIZE.quotaCountLimitWrites().writes(QuotaCountLimit.count(18)))
             .isEqualTo(new JsNumber(BigDecimal.valueOf(18)));
     }
 
@@ -53,7 +53,7 @@ class QuotaCountTest {
 
     @Test
     void quotaCountLimitShouldBeWellSerializedWhenUnlimited() {
-        assertThat(DTO_JSON_SERIALIZE.quotaLimitValueWrites().writes(QuotaCountLimit.unlimited()))
+        assertThat(DTO_JSON_SERIALIZE.quotaCountLimitWrites().writes(QuotaCountLimit.unlimited()))
             .isEqualTo(JsNull$.MODULE$);
     }
 
@@ -71,7 +71,7 @@ class QuotaCountTest {
 
     @Test
     void quotaCountUsageShouldBeWellSerialized() {
-        assertThat(DTO_JSON_SERIALIZE.quotaUsageValueWrites().writes(QuotaCountUsage.count(18)))
+        assertThat(DTO_JSON_SERIALIZE.quotaCountUsageWrites().writes(QuotaCountUsage.count(18)))
             .isEqualTo(new JsNumber(BigDecimal.valueOf(18)));
     }
 
diff --git a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaSizeTest.java b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaSizeTest.java
index cdb800b..e19ec08 100644
--- a/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaSizeTest.java
+++ b/mailbox/event/json/src/test/java/org/apache/james/event/json/dtos/QuotaSizeTest.java
@@ -38,9 +38,10 @@ import play.api.libs.json.Json;
 import scala.math.BigDecimal;
 
 class QuotaSizeTest {
+
     @Test
     void quotaSizeLimitShouldBeWellSerialized() {
-        assertThat(DTO_JSON_SERIALIZE.quotaLimitValueWrites().writes(QuotaSizeLimit.size(18)))
+        assertThat(DTO_JSON_SERIALIZE.quotaSizeLimitWrites().writes(QuotaSizeLimit.size(18)))
             .isEqualTo(new JsNumber(BigDecimal.valueOf(18)));
     }
 
@@ -52,7 +53,7 @@ class QuotaSizeTest {
 
     @Test
     void quotaSizeLimitShouldBeWellSerializedWhenUnlimited() {
-        assertThat(DTO_JSON_SERIALIZE.quotaLimitValueWrites().writes(QuotaSizeLimit.unlimited()))
+        assertThat(DTO_JSON_SERIALIZE.quotaSizeLimitWrites().writes(QuotaSizeLimit.unlimited()))
             .isEqualTo(JsNull$.MODULE$);
     }
 
@@ -70,7 +71,7 @@ class QuotaSizeTest {
 
     @Test
     void quotaSizeUsageShouldBeWellSerialized() {
-        assertThat(DTO_JSON_SERIALIZE.quotaUsageValueWrites().writes(QuotaSizeUsage.size(18)))
+        assertThat(DTO_JSON_SERIALIZE.quotaSizeUsageWrites().writes(QuotaSizeUsage.size(18)))
             .isEqualTo(new JsNumber(BigDecimal.valueOf(18)));
     }
 


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