james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [23/24] james-project git commit: JAMES-2366 Factorize some common constants in JMAP integration tests
Date Fri, 06 Apr 2018 13:20:42 GMT
JAMES-2366 Factorize some common constants in JMAP integration tests


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

Branch: refs/heads/master
Commit: 686a75e11aba3128fa1c209c30bd8eaa99d4e343
Parents: e229cb2
Author: benwa <btellier@linagora.com>
Authored: Thu Apr 5 17:27:08 2018 +0700
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Fri Apr 6 15:04:50 2018 +0200

----------------------------------------------------------------------
 .../org/apache/james/jmap/TestingConstants.java |  14 +
 .../james/jmap/VacationIntegrationTest.java     |   2 +-
 .../jmap/VacationRelayIntegrationTest.java      |   6 +-
 .../integration/ForwardIntegrationTest.java     |  16 +-
 .../integration/GetMailboxesMethodTest.java     | 191 ++++---
 .../integration/GetMessageListMethodTest.java   | 513 +++++++++----------
 .../integration/GetVacationResponseTest.java    |  28 +-
 .../methods/integration/SendMDNMethodTest.java  |   8 +-
 .../integration/SetMailboxesMethodTest.java     |  23 +-
 .../integration/SetMessagesMethodTest.java      |  55 +-
 .../integration/SetVacationResponseTest.java    |   6 +-
 .../integration/SpamAssassinContract.java       |  12 +-
 .../integration/cucumber/ImapStepdefs.java      |   6 +-
 13 files changed, 441 insertions(+), 439 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
index aa1da2f..7dba329 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/TestingConstants.java
@@ -51,4 +51,18 @@ public interface TestingConstants {
     String SECOND_NAME = "[1][0]";
     String SECOND_ARGUMENTS = "[1][1]";
 
+    String DOMAIN = "domain.tld";
+    String BOB = "bob@" + DOMAIN;
+    String BOB_PASSWORD = "123456";
+    String ALICE = "alice@" + DOMAIN;
+    String ALICE_PASSWORD = "789123";
+    String CEDRIC = "cedric@" + DOMAIN;
+    String CEDRIC_PASSWORD = "456789";
+
+
+    String LOCALHOST_IP = "127.0.0.1";
+    int SMTP_PORT = 1025;
+    int IMAP_PORT = 1143;
+
+
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
index 5afcdec..ef954df 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationIntegrationTest.java
@@ -24,6 +24,7 @@ import static com.jayway.restassured.RestAssured.with;
 import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
 import static org.apache.james.jmap.TestingConstants.SECOND_ARGUMENTS;
 import static org.apache.james.jmap.TestingConstants.SECOND_NAME;
 import static org.apache.james.jmap.TestingConstants.calmlyAwait;
@@ -55,7 +56,6 @@ import com.jayway.restassured.RestAssured;
 
 public abstract class VacationIntegrationTest {
 
-    private static final String DOMAIN = "mydomain.tld";
     private static final String USER_1 = "benwa@" + DOMAIN;
     private static final String USER_2 = "matthieu@" + DOMAIN;
     private static final String PASSWORD = "secret";

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
index 8620089..ce1706f 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
@@ -20,6 +20,9 @@
 package org.apache.james.jmap;
 
 import static com.jayway.awaitility.Duration.ONE_MINUTE;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
+import static org.apache.james.jmap.TestingConstants.LOCALHOST_IP;
+import static org.apache.james.jmap.TestingConstants.SMTP_PORT;
 import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.hamcrest.Matchers.equalTo;
 
@@ -45,14 +48,11 @@ import org.junit.Test;
 
 public abstract class VacationRelayIntegrationTest {
 
-    private static final String DOMAIN = "mydomain.tld";
     private static final String USER = "benwa";
     private static final String USER_WITH_DOMAIN = USER + '@' + DOMAIN;
     private static final String PASSWORD = "secret";
     private static final String REASON = "Message explaining my wonderful vacations";
 
-    private static final String LOCALHOST_IP = "127.0.0.1";
-    private static final int SMTP_PORT = 1025;
 
     @Rule
     public FakeSmtp fakeSmtp = new FakeSmtp();

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/ForwardIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/ForwardIntegrationTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/ForwardIntegrationTest.java
index 8aa0908..71d8d3e 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/ForwardIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/ForwardIntegrationTest.java
@@ -25,7 +25,14 @@ import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser
 import static org.apache.james.jmap.JmapCommonRequests.getOutboxId;
 import static org.apache.james.jmap.JmapCommonRequests.isAnyMessageFoundInRecipientsMailboxes;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
+import static org.apache.james.jmap.TestingConstants.ALICE;
+import static org.apache.james.jmap.TestingConstants.ALICE_PASSWORD;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.BOB;
+import static org.apache.james.jmap.TestingConstants.BOB_PASSWORD;
+import static org.apache.james.jmap.TestingConstants.CEDRIC;
+import static org.apache.james.jmap.TestingConstants.CEDRIC_PASSWORD;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.calmlyAwait;
 import static org.apache.james.jmap.TestingConstants.jmapRequestSpecBuilder;
@@ -50,15 +57,6 @@ import com.jayway.restassured.specification.RequestSpecification;
 
 public abstract class ForwardIntegrationTest {
 
-    private static final String DOMAIN = "domain";
-    private static final String BOB = "bob@" + DOMAIN;
-    private static final String BOB_PASSWORD = "123456";
-    private static final String ALICE = "alice@" + DOMAIN;
-    private static final String ALICE_PASSWORD = "789123";
-    private static final String CEDRIC = "cedric@" + DOMAIN;
-    private static final String CEDRIC_PASSWORD = "456789";
-
-
     protected abstract GuiceJamesServer createJmapServer();
 
     private GuiceJamesServer jmapServer;

http://git-wip-us.apache.org/repos/asf/james-project/blob/686a75e1/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
index 97d3510..0cda516 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
@@ -22,7 +22,13 @@ package org.apache.james.jmap.methods.integration;
 import static com.jayway.restassured.RestAssured.given;
 import static org.apache.james.jmap.HttpJmapAuthentication.authenticateJamesUser;
 import static org.apache.james.jmap.JmapURIBuilder.baseUri;
+import static org.apache.james.jmap.TestingConstants.ALICE;
+import static org.apache.james.jmap.TestingConstants.ALICE_PASSWORD;
 import static org.apache.james.jmap.TestingConstants.ARGUMENTS;
+import static org.apache.james.jmap.TestingConstants.BOB;
+import static org.apache.james.jmap.TestingConstants.BOB_PASSWORD;
+import static org.apache.james.jmap.TestingConstants.CEDRIC;
+import static org.apache.james.jmap.TestingConstants.DOMAIN;
 import static org.apache.james.jmap.TestingConstants.FIRST_MAILBOX;
 import static org.apache.james.jmap.TestingConstants.NAME;
 import static org.apache.james.jmap.TestingConstants.SECOND_MAILBOX;
@@ -89,10 +95,6 @@ public abstract class GetMailboxesMethodTest {
     protected abstract GuiceJamesServer createJmapServer();
 
     private AccessToken accessToken;
-    private String domain;
-    private String alice;
-    private String bob;
-    private String cedric;
     private GuiceJamesServer jmapServer;
     private MailboxProbe mailboxProbe;
     private ACLProbe aclProbe;
@@ -111,16 +113,11 @@ public abstract class GetMailboxesMethodTest {
                 .build();
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
 
-        domain = "domain.tld";
-        alice = "alice@" + domain;
-        String alicePassword = "aliceSecret";
-        bob = "bob@" + domain;
-        cedric = "cedric@" + domain;
         DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class);
-        dataProbe.addDomain(domain);
-        dataProbe.addUser(alice, alicePassword);
-        dataProbe.addUser(bob, "bobSecret");
-        accessToken = authenticateJamesUser(baseUri(jmapServer), alice, alicePassword);
+        dataProbe.addDomain(DOMAIN);
+        dataProbe.addUser(ALICE, ALICE_PASSWORD);
+        dataProbe.addUser(BOB, BOB_PASSWORD);
+        accessToken = authenticateJamesUser(baseUri(jmapServer), ALICE, ALICE_PASSWORD);
     }
 
     @After
@@ -143,9 +140,9 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnEmptyWhenIdsDoesntMatch() {
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, "name");
-        String removedId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
"quicklyRemoved").serialize();
-        mailboxProbe.deleteMailbox(MailboxConstants.USER_NAMESPACE, alice, "quicklyRemoved");
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "name");
+        String removedId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
"quicklyRemoved").serialize();
+        mailboxProbe.deleteMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "quicklyRemoved");
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -173,8 +170,8 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnMailboxesWhenIdsMatch() {
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
-        String mailboxId2 = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
"myMailbox").serialize();
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
+        String mailboxId2 = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
"myMailbox").serialize();
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -191,8 +188,8 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnOnlyMatchingMailboxesWhenIdsGiven() {
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, "myMailbox");
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "myMailbox");
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -208,7 +205,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnEmptyWhenIdsIsEmpty() {
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, DefaultMailboxes.INBOX);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, DefaultMailboxes.INBOX);
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -223,8 +220,8 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnAllMailboxesWhenIdsIsNull() {
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, "myMailbox");
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, "myMailbox2");
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "myMailbox");
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "myMailbox2");
 
         List<String> expectedMailboxes = ImmutableList.<String>builder()
                 .addAll(DefaultMailboxes.DEFAULT_MAILBOXES)
@@ -247,10 +244,10 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnSharedWithProperty() throws Exception {
         String mailboxName = "myMailbox";
-        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, mailboxName).serialize();
-        String targetUser1 = "toUser1@" + domain;
-        String targetUser2 = "toUser2@" + domain;
-        Mailbox myMailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, alice,
mailboxName);
+        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, mailboxName).serialize();
+        String targetUser1 = "toUser1@" + DOMAIN;
+        String targetUser2 = "toUser2@" + DOMAIN;
+        Mailbox myMailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
mailboxName);
         aclProbe.replaceRights(myMailbox.generateAssociatedPath(), targetUser1, new Rfc4314Rights(Right.Lookup,
Right.Administer));
         aclProbe.replaceRights(myMailbox.generateAssociatedPath(), targetUser2, new Rfc4314Rights(Right.Read,
Right.Lookup));
 
@@ -270,10 +267,10 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldRemoveOwnerRight() throws Exception {
         String mailboxName = "myMailbox";
-        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, mailboxName).serialize();
-        String targetUser1 = "toUser1@" + domain;
-        Mailbox myMailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, alice,
mailboxName);
-        aclProbe.replaceRights(myMailbox.generateAssociatedPath(), alice, new Rfc4314Rights(Right.Read,
Right.Administer));
+        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, mailboxName).serialize();
+        String targetUser1 = "toUser1@" + DOMAIN;
+        Mailbox myMailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
mailboxName);
+        aclProbe.replaceRights(myMailbox.generateAssociatedPath(), ALICE, new Rfc4314Rights(Right.Read,
Right.Administer));
         aclProbe.replaceRights(myMailbox.generateAssociatedPath(), targetUser1, new Rfc4314Rights(Right.Read,
Right.Lookup));
 
         given()
@@ -291,7 +288,7 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxShouldReturnEmptySharedWithWhenNoDelegation() {
         String mailboxName = "myMailbox";
-        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, mailboxName).serialize();
+        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, mailboxName).serialize();
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -308,9 +305,9 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void nonHandledRightsShouldBeFilteredOut() throws Exception {
         String mailboxName = "myMailbox";
-        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, mailboxName).serialize();
-        String targetUser1 = "toUser1@" + domain;
-        Mailbox myMailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, alice,
mailboxName);
+        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, mailboxName).serialize();
+        String targetUser1 = "toUser1@" + DOMAIN;
+        Mailbox myMailbox = mailboxProbe.getMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
mailboxName);
         aclProbe.replaceRights(myMailbox.generateAssociatedPath(), targetUser1, new Rfc4314Rights(Right.Lookup,
Right.Post));
 
         given()
@@ -380,9 +377,9 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnMailboxesWhenAvailable() throws Exception {
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, "name");
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "name");
 
-        mailboxProbe.appendMessage(alice, MailboxPath.forUser(alice, "name"),
+        mailboxProbe.appendMessage(ALICE, MailboxPath.forUser(ALICE, "name"),
                 new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
 
         given()
@@ -398,9 +395,9 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnMailboxPropertiesWhenAvailable() throws Exception
{
-        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, "name").serialize();
+        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, "name").serialize();
 
-        mailboxProbe.appendMessage(alice, MailboxPath.forUser(alice, "name"),
+        mailboxProbe.appendMessage(ALICE, MailboxPath.forUser(ALICE, "name"),
                 new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new
Date(), false, new Flags());
 
         given()
@@ -429,7 +426,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnFilteredMailboxesPropertiesWhenRequestContainsFilterProperties()
{
-        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, "name").serialize();
+        String myMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, "name").serialize();
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -458,7 +455,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnIdWhenRequestContainsEmptyPropertyListFilter() {
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, "name");
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "name");
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -474,7 +471,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldIgnoreUnknownPropertiesWhenRequestContainsUnknownPropertyListFilter()
{
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, "name");
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, "name");
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -490,8 +487,8 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnMailboxesWithSortOrder() {
-        MailboxId inboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX);
-        MailboxId trashId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.TRASH);
+        MailboxId inboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX);
+        MailboxId trashId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.TRASH);
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -510,7 +507,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnMailboxesWithRolesInLowerCase() {
-        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, DefaultMailboxes.OUTBOX);
+        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, DefaultMailboxes.OUTBOX);
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -527,10 +524,10 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnMailboxesWithFilteredSharedWithWhenShared() throws
Exception {
         String mailboxName = "name";
-        MailboxId bobMailbox = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
bob, mailboxName);
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, mailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup));
-        aclProbe.replaceRights(bobMailboxPath, cedric, new Rfc4314Rights(Right.Lookup));
+        MailboxId bobMailbox = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
BOB, mailboxName);
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, mailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup));
+        aclProbe.replaceRights(bobMailboxPath, CEDRIC, new Rfc4314Rights(Right.Lookup));
 
         Map<String, String> sharedWith = given()
             .header("Authorization", accessToken.serialize())
@@ -545,16 +542,16 @@ public abstract class GetMailboxesMethodTest {
             .jsonPath()
             .get(FIRST_MAILBOX + ".sharedWith");
 
-        assertThat(sharedWith).containsOnlyKeys(alice);
+        assertThat(sharedWith).containsOnlyKeys(ALICE);
     }
 
     @Test
     public void getMailboxesShouldReturnMailboxesWithFullSharedWithWhenHasAdminRight() throws
Exception {
         String mailboxName = "name";
-        MailboxId bobMailbox = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
bob, mailboxName);
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, mailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup, Right.Administer));
-        aclProbe.replaceRights(bobMailboxPath, cedric, new Rfc4314Rights(Right.Lookup));
+        MailboxId bobMailbox = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
BOB, mailboxName);
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, mailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup, Right.Administer));
+        aclProbe.replaceRights(bobMailboxPath, CEDRIC, new Rfc4314Rights(Right.Lookup));
 
         Map<String, String> sharedWith = given()
             .header("Authorization", accessToken.serialize())
@@ -569,18 +566,18 @@ public abstract class GetMailboxesMethodTest {
             .jsonPath()
             .get(FIRST_MAILBOX + ".sharedWith");
 
-        assertThat(sharedWith).containsOnlyKeys(alice, cedric);
+        assertThat(sharedWith).containsOnlyKeys(ALICE, CEDRIC);
     }
 
     @Test
     public void getMailboxesShouldReturnAllAccessibleMailboxesWhenEmptyIds() throws Exception
{
         String sharedMailboxName = "BobShared";
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, DefaultMailboxes.INBOX);
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, sharedMailboxName);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, DefaultMailboxes.INBOX);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, sharedMailboxName);
 
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, DefaultMailboxes.INBOX);
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, sharedMailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup));
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, DefaultMailboxes.INBOX);
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, sharedMailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup));
 
         List<String> expectedMailboxes = ImmutableList.<String>builder()
             .addAll(DefaultMailboxes.DEFAULT_MAILBOXES)
@@ -603,16 +600,16 @@ public abstract class GetMailboxesMethodTest {
     public void getMailboxesShouldFilterMailboxesWithLookupRightWhenEmptyIds() throws Exception
{
         String sharedReadMailboxName = "BobShared";
         String sharedAdministerMailboxName = "BobShared1";
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, DefaultMailboxes.INBOX);
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, sharedReadMailboxName);
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, sharedAdministerMailboxName);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, DefaultMailboxes.INBOX);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, sharedReadMailboxName);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, sharedAdministerMailboxName);
 
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, DefaultMailboxes.INBOX);
-        MailboxPath bobSharedReadMailboxPath = MailboxPath.forUser(bob, sharedReadMailboxName);
-        MailboxPath bobSharedAdministerMailboxPath = MailboxPath.forUser(bob, sharedAdministerMailboxName);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, DefaultMailboxes.INBOX);
+        MailboxPath bobSharedReadMailboxPath = MailboxPath.forUser(BOB, sharedReadMailboxName);
+        MailboxPath bobSharedAdministerMailboxPath = MailboxPath.forUser(BOB, sharedAdministerMailboxName);
 
-        aclProbe.replaceRights(bobSharedReadMailboxPath, alice, new Rfc4314Rights(Right.Lookup));
-        aclProbe.replaceRights(bobSharedAdministerMailboxPath, alice, new Rfc4314Rights(Right.Administer));
+        aclProbe.replaceRights(bobSharedReadMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup));
+        aclProbe.replaceRights(bobSharedAdministerMailboxPath, ALICE, new Rfc4314Rights(Right.Administer));
 
         List<String> expectedMailboxes = ImmutableList.<String>builder()
             .addAll(DefaultMailboxes.DEFAULT_MAILBOXES)
@@ -634,11 +631,11 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnExactUserInbox() throws Exception {
         String mailboxName = "BobShared";
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, mailboxName);
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, DefaultMailboxes.INBOX);
-        MailboxId aliceInboxMailbox = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, DefaultMailboxes.INBOX);
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, mailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup));
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, mailboxName);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, DefaultMailboxes.INBOX);
+        MailboxId aliceInboxMailbox = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, DefaultMailboxes.INBOX);
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, mailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup));
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -655,12 +652,12 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnSharedMailboxesWithRead() throws Exception {
         String sharedMailboxName = "BobShared";
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, bob, DefaultMailboxes.INBOX);
-        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
bob, sharedMailboxName);
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB, DefaultMailboxes.INBOX);
+        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
BOB, sharedMailboxName);
 
-        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice, DefaultMailboxes.INBOX);
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, sharedMailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup));
+        mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE, DefaultMailboxes.INBOX);
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, sharedMailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup));
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -677,10 +674,10 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnDelegatedNamespaceWhenSharedMailbox() throws Exception
{
         String sharedMailboxName = "BobShared";
-        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
bob, sharedMailboxName);
+        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
BOB, sharedMailboxName);
 
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, sharedMailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup));
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, sharedMailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup));
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -692,12 +689,12 @@ public abstract class GetMailboxesMethodTest {
             .body(NAME, equalTo("mailboxes"))
             .body(ARGUMENTS + ".list", hasSize(1))
             .body(FIRST_MAILBOX + ".namespace.type", equalTo(MailboxNamespace.Type.Delegated.toString()))
-            .body(FIRST_MAILBOX + ".namespace.owner", equalTo(bob));
+            .body(FIRST_MAILBOX + ".namespace.owner", equalTo(BOB));
     }
 
     @Test
     public void getMailboxesShouldReturnPersonalNamespaceWhenOwnerMailbox() {
-        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, DefaultMailboxes.INBOX);
+        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, DefaultMailboxes.INBOX);
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -715,7 +712,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnAllowedForAllMayPropertiesWhenOwner() {
-        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
alice, DefaultMailboxes.INBOX);
+        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
ALICE, DefaultMailboxes.INBOX);
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -737,10 +734,10 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnPartiallyAllowedMayPropertiesWhenDelegated() throws
Exception {
         String sharedMailboxName = "BobShared";
-        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
bob, sharedMailboxName);
+        MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
BOB, sharedMailboxName);
 
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, sharedMailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup, Right.Read));
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, sharedMailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup, Right.Read));
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -761,7 +758,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnUnlimitedQuotasForInboxByDefault() {
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -779,7 +776,7 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnMaxStorageQuotasForInboxWhenSet() throws Exception
{
         quotaProbe.setGlobalMaxStorage(SerializableQuotaValue.valueOf(Optional.of(QuotaSize.size(42))));
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -796,7 +793,7 @@ public abstract class GetMailboxesMethodTest {
     @Test
     public void getMailboxesShouldReturnMaxMessageQuotasForInboxWhenSet() throws Exception
{
         quotaProbe.setGlobalMaxMessageCount(SerializableQuotaValue.valueOf(Optional.of(QuotaCount.count(43))));
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -812,12 +809,12 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldDisplayDifferentMaxQuotaPerMailboxWhenSet() throws Exception
{
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
         String sharedMailboxName = "BobShared";
-        MailboxId sharedMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
bob, sharedMailboxName);
+        MailboxId sharedMailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE,
BOB, sharedMailboxName);
 
-        MailboxPath bobMailboxPath = MailboxPath.forUser(bob, sharedMailboxName);
-        aclProbe.replaceRights(bobMailboxPath, alice, new Rfc4314Rights(Right.Lookup, Right.Read));
+        MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, sharedMailboxName);
+        aclProbe.replaceRights(bobMailboxPath, ALICE, new Rfc4314Rights(Right.Lookup, Right.Read));
 
         quotaProbe.setMaxMessageCount("#private&alice@domain.tld", SerializableQuotaValue.valueOf(Optional.of(QuotaCount.count(42))));
         quotaProbe.setMaxMessageCount("#private&bob@domain.tld", SerializableQuotaValue.valueOf(Optional.of(QuotaCount.count(43))));
@@ -850,7 +847,7 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnEmptyQuotasForInboxWhenNoMail() {
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
 
         given()
             .header("Authorization", accessToken.serialize())
@@ -867,9 +864,9 @@ public abstract class GetMailboxesMethodTest {
 
     @Test
     public void getMailboxesShouldReturnUpdatedQuotasForInboxWhenMailReceived() throws Exception
{
-        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, alice,
DefaultMailboxes.INBOX).serialize();
+        String mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE,
DefaultMailboxes.INBOX).serialize();
         String message = "Subject: hello\r\n\r\nContent";
-        mailboxProbe.appendMessage(alice, MailboxPath.forUser(alice, DefaultMailboxes.INBOX),
+        mailboxProbe.appendMessage(ALICE, MailboxPath.forUser(ALICE, DefaultMailboxes.INBOX),
                 new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8)),
                 new Date(), true, new Flags());
 


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