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 7245b4e325195139970070172f30d67b1fdeb803
Author: Rene Cordier <rcord...@linagora.com>
AuthorDate: Fri Aug 21 15:26:32 2020 +0700

    [Refactoring] Use properties field of Mailbox/get in integration tests when 
no need to check all fields
---
 .../contract/MailboxGetMethodContract.scala        |   2 -
 .../contract/MailboxSetMethodContract.scala        | 283 ++-------------------
 2 files changed, 22 insertions(+), 263 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
index 7776b26..b819316 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
@@ -571,7 +571,6 @@ trait MailboxGetMethodContract {
                |    "Mailbox/get",
                |    {
                |      "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-               |      "properties": ["id", "name", "rights"],
                |      "ids": ["invalid"]
                |    },
                |    "c1"]]
@@ -612,7 +611,6 @@ trait MailboxGetMethodContract {
                |    "Mailbox/get",
                |    {
                |      "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-               |      "properties": ["id", "name", "rights"],
                |      "ids": ["#C42"]
                |    },
                |    "c1"]]
diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
index 0398c0e..12f1a4d 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
@@ -852,7 +852,7 @@ trait MailboxSetMethodContract {
   }
 
   @Test
-  def createSHouldNotReturnSubscribeWhenSpecified(server: GuiceJamesServer): 
Unit = {
+  def createShouldNotReturnSubscribeWhenSpecified(server: GuiceJamesServer): 
Unit = {
     val request =
       """
         |{
@@ -1031,6 +1031,7 @@ trait MailboxSetMethodContract {
         |       ["Mailbox/get",
         |         {
         |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+        |           "properties": ["id", "name", "rights"],
         |           "ids": ["#C42"]
         |          },
         |       "c2"]
@@ -1091,24 +1092,6 @@ trait MailboxSetMethodContract {
          |                     "list": [{
          |                             "id": "$mailboxId",
          |                             "name": "myMailbox",
-         |                             "sortOrder": 1000,
-         |                             "totalEmails": 0,
-         |                             "unreadEmails": 0,
-         |                             "totalThreads": 0,
-         |                             "unreadThreads": 0,
-         |                             "myRights": {
-         |                                     "mayReadItems": true,
-         |                                     "mayAddItems": true,
-         |                                     "mayRemoveItems": true,
-         |                                     "maySetSeen": true,
-         |                                     "maySetKeywords": true,
-         |                                     "mayCreateChild": true,
-         |                                     "mayRename": true,
-         |                                     "mayDelete": true,
-         |                                     "maySubmit": true
-         |                             },
-         |                             "isSubscribed": true,
-         |        "namespace":"Personal",
          |                             "rights": {
          |                                     "an...@domain.tld": ["l", "r"]
          |                             }
@@ -1255,6 +1238,7 @@ trait MailboxSetMethodContract {
         |       ["Mailbox/get",
         |         {
         |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+        |           "properties": ["id", "name"],
         |           "ids": ["#C42"]
         |          },
         |       "c2"]
@@ -1314,24 +1298,7 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "$mailboxId",
-         |        "name": "myMailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
-         |        "isSubscribed": true
+         |        "name": "myMailbox"
          |      }],
          |      "notFound":[]
          |    }, "c2"]
@@ -2716,6 +2683,7 @@ trait MailboxSetMethodContract {
         |      ["Mailbox/get",
         |         {
         |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+        |           "properties": ["id", "name"],
         |           "ids": ["${mailboxId.serialize()}"]
         |          },
         |       "c2"]
@@ -2752,24 +2720,7 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "1",
-         |        "name": "newName",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
-         |        "isSubscribed": false
+         |        "name": "newName"
          |      }],
          |      "notFound": []
          |    }, "c2"]
@@ -3462,6 +3413,7 @@ trait MailboxSetMethodContract {
         |       ["Mailbox/get",
         |         {
         |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+        |           "properties": ["id", "name", "parentId"],
         |           "ids": ["${childId.serialize()}"]
         |          },
         |       "c2"]
@@ -3499,24 +3451,7 @@ trait MailboxSetMethodContract {
          |      "list": [{
          |        "id": "${childId.serialize()}",
          |        "name": "newChild",
-         |        "parentId": "${parentId.serialize()}",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
-         |        "isSubscribed": false
+         |        "parentId": "${parentId.serialize()}"
          |      }],
          |      "notFound": []
          |    }, "c2"]
@@ -3550,6 +3485,7 @@ trait MailboxSetMethodContract {
         |       ["Mailbox/get",
         |         {
         |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+        |           "properties": ["id", "name", "parentId"],
         |           "ids": ["${childId.serialize()}"]
         |          },
         |       "c2"]
@@ -3587,24 +3523,7 @@ trait MailboxSetMethodContract {
          |      "list": [{
          |        "id": "${childId.serialize()}",
          |        "name": "child",
-         |        "parentId": "${parentId.serialize()}",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
-         |        "isSubscribed": false
+         |        "parentId": "${parentId.serialize()}"
          |      }],
          |      "notFound": []
          |    }, "c2"]
@@ -3890,6 +3809,7 @@ trait MailboxSetMethodContract {
          |      ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c2"]
@@ -3926,23 +3846,6 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
          |        "isSubscribed": true
          |      }],
          |      "notFound": []
@@ -3983,6 +3886,7 @@ trait MailboxSetMethodContract {
          |      ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c4"]
@@ -4026,23 +3930,6 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
          |        "isSubscribed": false
          |      }],
          |      "notFound": []
@@ -4073,6 +3960,7 @@ trait MailboxSetMethodContract {
          |      ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c4"]
@@ -4109,23 +3997,6 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
          |        "isSubscribed": true
          |      }],
          |      "notFound": []
@@ -4161,6 +4032,7 @@ trait MailboxSetMethodContract {
          |      ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed", "namespace"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c4"]
@@ -4197,28 +4069,8 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": false,
-         |          "mayAddItems": false,
-         |          "mayRemoveItems": false,
-         |          "maySetSeen": false,
-         |          "maySetKeywords": false,
-         |          "mayCreateChild": false,
-         |          "mayRename": false,
-         |          "mayDelete": false,
-         |          "maySubmit": false
-         |        },
          |        "isSubscribed": true,
-         |        "namespace": "Delegated[an...@domain.tld]",
-         |        "rights": {
-         |          "b...@domain.tld": ["l"]
-         |        }
+         |        "namespace": "Delegated[an...@domain.tld]"
          |      }],
          |      "notFound": []
          |    }, "c4"]
@@ -4262,6 +4114,7 @@ trait MailboxSetMethodContract {
          |      ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed", "namespace"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c4"]
@@ -4305,28 +4158,8 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": false,
-         |          "mayAddItems": false,
-         |          "mayRemoveItems": false,
-         |          "maySetSeen": false,
-         |          "maySetKeywords": false,
-         |          "mayCreateChild": false,
-         |          "mayRename": false,
-         |          "mayDelete": false,
-         |          "maySubmit": false
-         |        },
          |        "isSubscribed": false,
-         |        "namespace": "Delegated[an...@domain.tld]",
-         |        "rights": {
-         |          "b...@domain.tld": ["l"]
-         |        }
+         |        "namespace": "Delegated[an...@domain.tld]"
          |      }],
          |      "notFound": []
          |    }, "c4"]
@@ -4449,6 +4282,7 @@ trait MailboxSetMethodContract {
          |      ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "isSubscribed", "namespace"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c4"]
@@ -4492,28 +4326,8 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": false,
-         |          "mayAddItems": false,
-         |          "mayRemoveItems": false,
-         |          "maySetSeen": false,
-         |          "maySetKeywords": false,
-         |          "mayCreateChild": false,
-         |          "mayRename": false,
-         |          "mayDelete": false,
-         |          "maySubmit": false
-         |        },
          |        "isSubscribed": false,
-         |        "namespace": "Delegated[an...@domain.tld]",
-         |        "rights": {
-         |          "b...@domain.tld": ["l"]
-         |        }
+         |        "namespace": "Delegated[an...@domain.tld]"
          |      }],
          |      "notFound": []
          |    }, "c4"]
@@ -4686,6 +4500,7 @@ trait MailboxSetMethodContract {
          |       ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "rights"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c2"]
@@ -4722,25 +4537,6 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
-         |        "isSubscribed": false,
-         |        "namespace": "Personal",
          |        "rights": {
          |          "${ANDRE.asString()}": ["l", "r"]
          |        }
@@ -4784,6 +4580,7 @@ trait MailboxSetMethodContract {
          |       ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "rights"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c2"]
@@ -4820,25 +4617,6 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": true,
-         |          "mayAddItems": true,
-         |          "mayRemoveItems": true,
-         |          "maySetSeen": true,
-         |          "maySetKeywords": true,
-         |          "mayCreateChild": true,
-         |          "mayRename": true,
-         |          "mayDelete": true,
-         |          "maySubmit": true
-         |        },
-         |        "isSubscribed": false,
-         |        "namespace": "Personal",
          |        "rights": {
          |          "${ANDRE.asString()}": ["l", "r"],
          |          "${DAVID.asString()}": ["l", "r", "w"]
@@ -4881,6 +4659,7 @@ trait MailboxSetMethodContract {
          |       ["Mailbox/get",
          |         {
          |           "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+         |           "properties": ["id", "namespace", "rights"],
          |           "ids": ["${mailboxId.serialize()}"]
          |          },
          |       "c2"]
@@ -4920,24 +4699,6 @@ trait MailboxSetMethodContract {
          |      "state": "000001",
          |      "list": [{
          |        "id": "${mailboxId.serialize()}",
-         |        "name": "mailbox",
-         |        "sortOrder": 1000,
-         |        "totalEmails": 0,
-         |        "unreadEmails": 0,
-         |        "totalThreads": 0,
-         |        "unreadThreads": 0,
-         |        "myRights": {
-         |          "mayReadItems": false,
-         |          "mayAddItems": false,
-         |          "mayRemoveItems": false,
-         |          "maySetSeen": false,
-         |          "maySetKeywords": false,
-         |          "mayCreateChild": false,
-         |          "mayRename": false,
-         |          "mayDelete": false,
-         |          "maySubmit": false
-         |        },
-         |        "isSubscribed": false,
          |        "namespace": "Delegated[an...@domain.tld]",
          |        "rights": {
          |          "b...@domain.tld": ["l"]


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

Reply via email to