james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject james-project git commit: JAMES-2339 Provision Spam mailbox in JMAP
Date Wed, 21 Feb 2018 10:35:22 GMT
Repository: james-project
Updated Branches:
  refs/heads/master faf7aa52c -> 21bd4ffad


JAMES-2339 Provision Spam mailbox in JMAP


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

Branch: refs/heads/master
Commit: 21bd4ffadc717946f7f7b959df27a275e25d8d1b
Parents: faf7aa5
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Tue Feb 20 10:00:18 2018 +0100
Committer: Antoine Duprat <aduprat@linagora.com>
Committed: Tue Feb 20 10:32:53 2018 +0100

----------------------------------------------------------------------
 .../java/org/apache/james/jmap/ProvisioningTest.java   |  2 +-
 .../methods/integration/GetMailboxesMethodTest.java    |  6 +++---
 .../java/org/apache/james/jmap/DefaultMailboxes.java   |  2 +-
 .../jmap/DefaultMailboxesProvisioningFilterTest.java   | 13 +++++++++++++
 4 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/21bd4ffa/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
index c0faa3c..805a0c9 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
@@ -96,7 +96,7 @@ public abstract class ProvisioningTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("mailboxes"))
-            .body(ARGUMENTS + ".list", hasSize(5))
+            .body(ARGUMENTS + ".list", hasSize(6))
             .body(ARGUMENTS + ".list.name", hasItems(DefaultMailboxes.DEFAULT_MAILBOXES.toArray()));
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/21bd4ffa/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 aff09e3..243156a 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
@@ -245,7 +245,7 @@ public abstract class GetMailboxesMethodTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("mailboxes"))
-            .body(ARGUMENTS + ".list", hasSize(7))
+            .body(ARGUMENTS + ".list", hasSize(8))
             .body(ARGUMENTS + ".list.name", hasItems(expectedMailboxes.toArray()));
     }
 
@@ -362,7 +362,7 @@ public abstract class GetMailboxesMethodTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("mailboxes"))
-            .body(ARGUMENTS + ".list", hasSize(5))
+            .body(ARGUMENTS + ".list", hasSize(6))
             .body(ARGUMENTS + ".list.name", hasItems(DefaultMailboxes.DEFAULT_MAILBOXES.toArray()));
     }
 
@@ -633,7 +633,7 @@ public abstract class GetMailboxesMethodTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("mailboxes"))
-            .body(ARGUMENTS + ".list", hasSize(6))
+            .body(ARGUMENTS + ".list", hasSize(7))
             .body(ARGUMENTS + ".list.name", hasItems(expectedMailboxes.toArray()));
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/21bd4ffa/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultMailboxes.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultMailboxes.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultMailboxes.java
index 2cdfbec..9ae4234 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultMailboxes.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/DefaultMailboxes.java
@@ -35,5 +35,5 @@ public interface DefaultMailboxes {
     String SPAM = "Spam";
     String TEMPLATES = "Templates";
 
-    List<String> DEFAULT_MAILBOXES = ImmutableList.of(INBOX, OUTBOX, SENT, TRASH, DRAFTS);
+    List<String> DEFAULT_MAILBOXES = ImmutableList.of(INBOX, OUTBOX, SENT, TRASH, DRAFTS,
SPAM);
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/21bd4ffa/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
index 5ed1da4..6653417 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterTest.java
@@ -34,6 +34,7 @@ import org.apache.james.util.concurrency.ConcurrentTestRunner;
 import org.junit.Before;
 import org.junit.Test;
 
+import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
 
 public class DefaultMailboxesProvisioningFilterTest {
@@ -66,6 +67,18 @@ public class DefaultMailboxesProvisioningFilterTest {
     }
 
     @Test
+    public void createMailboxesIfNeededShouldCreateSpamWhenOtherSystemMailboxesExist() throws
Exception {
+        DefaultMailboxes.DEFAULT_MAILBOXES
+            .stream()
+            .filter(mailbox -> !DefaultMailboxes.SPAM.equals(mailbox))
+            .forEach(Throwing.consumer(mailbox -> mailboxManager.createMailbox(MailboxPath.forUser(USERNAME,
mailbox), session)));
+
+        testee.createMailboxesIfNeeded(session);
+
+        assertThat(mailboxManager.list(session)).contains(MailboxPath.forUser(USERNAME, DefaultMailboxes.SPAM));
+    }
+
+    @Test
     public void createMailboxesIfNeededShouldSubscribeMailboxes() throws Exception {
         testee.createMailboxesIfNeeded(session);
 


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